Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting oldest package version when downloading from deb sources #516

Open
Megver83 opened this issue May 6, 2022 · 2 comments
Open

Getting oldest package version when downloading from deb sources #516

Megver83 opened this issue May 6, 2022 · 2 comments

Comments

@Megver83
Copy link

Megver83 commented May 6, 2022

So I was trying to create an AppImage for UnityHub v3, as Unity provides an APT repo to get the .deb, and ended up with the following:

app: UnityHub

ingredients:
  dist: jammy
  sources:
    - deb http://us.archive.ubuntu.com/ubuntu/ jammy main
    - deb https://hub.unity3d.com/linux/repos/deb stable main

script:
  - touch opt/unityhub/resources/app-update.yml
  - ( cd usr/bin/ ; rm -f * ; mv ../../opt/unityhub/* . )
  - rmdir -p opt/unityhub

But realized that, instead of getting the latest version of the unityhub package (3.1.2 at the moment of writing), I got the oldest one available (3.0.0). I had to use a custom functions.sh script to change this behavior, looks like the Unity repo stores the older packages and, hence, they appear in cache.txt first.

diff --git a/functions.sh b/functions.sh
index 08f50d9..e6e9fdf 100644
--- a/functions.sh
+++ b/functions.sh
@@ -401,14 +401,14 @@ function apt-get.do-download(){
   
   already_downloaded_package+=(${1})
    
-  local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${1}"$    \
+  local dependencies=($(tac cache.txt | grep -B 2 -m 1 ^"Package: ${1}"$    \
                                       | grep ^"Depends: "                   \
                                       | cut -c 9-                           \
                                       | sed "s|([^)]*)||g;s|[[:space:]]||g" \
                                       | sed "s|,|\n|g"                      \
                                       | cut -d"|" -f1 ))
 
-  local package_url=$(cat cache.txt | grep -A 3 -m 1 ^"Package: ${1}"$ \
+  local package_url=$(tac cache.txt | grep -B 3 -m 1 ^"Package: ${1}"$ \
                                     | grep ^"Filename: "               \
                                     | cut -c 11-)

Shouldn't this be the default behavior? I mean, assume that you want the latest version of all packages whenever you want to build an AppImage, specially from a deb source. Or, at least, have some flexibility regarding package versions.

P.S.: You can add the UnityHub yml under recipes/ if you wish, works fine.

@probonopd
Copy link
Member

Hello @Megver83

According to https://docs.unity3d.com/es/2019.4/Manual/GettingStartedInstallingHub.html UnityHub comes as an AppImage officially - no need to make your own?

@Megver83
Copy link
Author

Megver83 commented May 8, 2022

Yes they do, but up to Unity v2, from v3+ they only provide .deb and .rpm packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants