From 7837cb571061c74afa27a1343176c62e29deef4a Mon Sep 17 00:00:00 2001 From: Cyril Soler Date: Sun, 7 Jan 2024 22:27:37 +0100 Subject: [PATCH 1/3] fixed correct handling of OBS repositories as debian source --- functions.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/functions.sh b/functions.sh index 058f5a60..06b59c2f 100644 --- a/functions.sh +++ b/functions.sh @@ -383,12 +383,19 @@ function apt-get.update(){ local repo_info=($(echo ${line} | tr " " "\n")) local base_url=${repo_info[1]} local dist_name=${repo_info[2]} - - for i in $(seq 3 $((${#repo_info[@]} - 1))); do - echo "Caching ${base_url} ${dist_name} ${repo_info[${i}]}..." - local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-amd64/Packages.gz" + + # detect opensuze build service repositories, which are listed using a single / at the end (according to pkg2appimage documentation) + if test "${dist_name}" = "/" ; then + echo "Caching ${base_url} ${dist_name}..." + local repo_url="${base_url}/Packages.gz" wget -q "${repo_url}" -O - | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" | sed "s|^Filename: |Filename: ${base_url}/|g" >> cache.txt - done + else + for i in $(seq 3 $((${#repo_info[@]} - 1))); do + echo "Caching ${base_url} ${dist_name} ${repo_info[${i}]}..." + local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-amd64/Packages.gz" + wget -q "${repo_url}" -O - | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" | sed "s|^Filename: |Filename: ${base_url}/|g" >> cache.txt + done + fi done Date: Sat, 13 Jan 2024 13:29:32 +0100 Subject: [PATCH 2/3] Fix spelling --- functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index 06b59c2f..16af20eb 100644 --- a/functions.sh +++ b/functions.sh @@ -384,7 +384,7 @@ function apt-get.update(){ local base_url=${repo_info[1]} local dist_name=${repo_info[2]} - # detect opensuze build service repositories, which are listed using a single / at the end (according to pkg2appimage documentation) + # Detect openSUSE Build Service (OBS) repositories, which are listed using a single / at the end (according to pkg2appimage documentation) if test "${dist_name}" = "/" ; then echo "Caching ${base_url} ${dist_name}..." local repo_url="${base_url}/Packages.gz" From c471f6feb5bc6eae497ca462725eb96dc87b6c30 Mon Sep 17 00:00:00 2001 From: Cyril Soler Date: Sat, 13 Jan 2024 15:48:44 +0100 Subject: [PATCH 3/3] added code to allow to specify specific versions for packages, since OBS does not list them in the correct order --- functions.sh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/functions.sh b/functions.sh index 16af20eb..8c892700 100644 --- a/functions.sh +++ b/functions.sh @@ -378,11 +378,17 @@ function apt-get.update(){ cat Packages.gz | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" >> cache.txt || true + echo APT_GET_UPDATE while read line; do local line=$(echo "${line}" | sed 's|[[:space:]]| |g') local repo_info=($(echo ${line} | tr " " "\n")) local base_url=${repo_info[1]} local dist_name=${repo_info[2]} + + echo line=${line} + echo repo_info=${repo_info} + echo base_url=${base_url} + echo dist_name=${dist_name} # Detect openSUSE Build Service (OBS) repositories, which are listed using a single / at the end (according to pkg2appimage documentation) if test "${dist_name}" = "/" ; then @@ -404,21 +410,36 @@ function apt-get.do-download(){ grep -q ^"Package: ${1}"$ status && return } - echo "${already_downloaded_package[@]}" | sed 's| |\n|g' | grep -q ^"${1}"$ && return + local package_name=$(echo ${1} | cut -d= -f1) + local package_version=`echo ${1} | cut -s -d= -f2-` + + echo "${already_downloaded_package[@]}" | sed 's| |\n|g' | grep -q ^"${package_name}"$ && return - already_downloaded_package+=(${1}) + if ! test -z "${package_version}" ; then + local package_url=`cat cache.txt | grep -v ^"Depends: " \ + | grep -A 3 ^"Package: ${package_name}"$ \ + | grep -A 2 ^"Version: ${package_version}" \ + | grep ^"Filename: " \ + | cut -c 11-` + else + local package_url=`cat cache.txt | grep -v ^"Depends: " \ + | grep -A 3 -m 1 ^"Package: ${package_name}"$ \ + | grep ^"Filename: " \ + | cut -c 11-` + fi + + already_downloaded_package+=(${package_name}) - local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${1}"$ \ + local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${package_name}"$ \ | 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}"$ \ - | grep ^"Filename: " \ - | cut -c 11-) - + echo PACKAGE NAME: ${package_name} + echo PACKAGE_VERSION: ${package_version} + echo PACKAGE_URL: ${package_url} [ ! -f "${package_url}" ] && { [ ! "${package_url}" = "" ] && {