Skip to content

Commit c471f6f

Browse files
committed
added code to allow to specify specific versions for packages, since OBS does not list them in the correct order
1 parent c3265ac commit c471f6f

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

functions.sh

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,17 @@ function apt-get.update(){
378378

379379
cat Packages.gz | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" >> cache.txt || true
380380

381+
echo APT_GET_UPDATE
381382
while read line; do
382383
local line=$(echo "${line}" | sed 's|[[:space:]]| |g')
383384
local repo_info=($(echo ${line} | tr " " "\n"))
384385
local base_url=${repo_info[1]}
385386
local dist_name=${repo_info[2]}
387+
388+
echo line=${line}
389+
echo repo_info=${repo_info}
390+
echo base_url=${base_url}
391+
echo dist_name=${dist_name}
386392

387393
# Detect openSUSE Build Service (OBS) repositories, which are listed using a single / at the end (according to pkg2appimage documentation)
388394
if test "${dist_name}" = "/" ; then
@@ -404,21 +410,36 @@ function apt-get.do-download(){
404410
grep -q ^"Package: ${1}"$ status && return
405411
}
406412

407-
echo "${already_downloaded_package[@]}" | sed 's| |\n|g' | grep -q ^"${1}"$ && return
413+
local package_name=$(echo ${1} | cut -d= -f1)
414+
local package_version=`echo ${1} | cut -s -d= -f2-`
415+
416+
echo "${already_downloaded_package[@]}" | sed 's| |\n|g' | grep -q ^"${package_name}"$ && return
408417

409-
already_downloaded_package+=(${1})
418+
if ! test -z "${package_version}" ; then
419+
local package_url=`cat cache.txt | grep -v ^"Depends: " \
420+
| grep -A 3 ^"Package: ${package_name}"$ \
421+
| grep -A 2 ^"Version: ${package_version}" \
422+
| grep ^"Filename: " \
423+
| cut -c 11-`
424+
else
425+
local package_url=`cat cache.txt | grep -v ^"Depends: " \
426+
| grep -A 3 -m 1 ^"Package: ${package_name}"$ \
427+
| grep ^"Filename: " \
428+
| cut -c 11-`
429+
fi
430+
431+
already_downloaded_package+=(${package_name})
410432

411-
local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${1}"$ \
433+
local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${package_name}"$ \
412434
| grep ^"Depends: " \
413435
| cut -c 9- \
414436
| sed "s|([^)]*)||g;s|[[:space:]]||g" \
415437
| sed "s|,|\n|g" \
416438
| cut -d"|" -f1 ))
417439

418-
local package_url=$(cat cache.txt | grep -A 3 -m 1 ^"Package: ${1}"$ \
419-
| grep ^"Filename: " \
420-
| cut -c 11-)
421-
440+
echo PACKAGE NAME: ${package_name}
441+
echo PACKAGE_VERSION: ${package_version}
442+
echo PACKAGE_URL: ${package_url}
422443

423444
[ ! -f "${package_url}" ] && {
424445
[ ! "${package_url}" = "" ] && {

0 commit comments

Comments
 (0)