pkg2appimage icon indicating copy to clipboard operation
pkg2appimage copied to clipboard

Getting oldest package version when downloading from deb sources

Open Megver83 opened this issue 2 years ago • 2 comments

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.

Megver83 avatar May 06 '22 21:05 Megver83

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?

probonopd avatar May 07 '22 07:05 probonopd

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

Megver83 avatar May 08 '22 00:05 Megver83