# HG changeset patch # User Aleksej Bobylev # Date 1543256876 -7200 # Node ID d2dc3d5ed06de0ce82976d8e30c81a74d173d5e4 # Parent f079c87ba41932f02508fa40d8f4eed167ecebbe modules/get: fix plain mode and cookmode again diff -r f079c87ba419 -r d2dc3d5ed06d modules/get --- a/modules/get Mon Nov 26 18:53:08 2018 +0200 +++ b/modules/get Mon Nov 26 20:27:56 2018 +0200 @@ -363,23 +363,29 @@ [ -e "$pi" ] || pi="$rep/packages.info" [ -e "$pi" ] || continue - # If found, output string "-" - namever=$(awk -F$'\t' -vpkg="$(virtual_pkg "$1" "$rep")" \ - '$1==pkg || $1"-"$2==pkg {printf "%s-%s", $1, $2; exit}' "$pi") + # If found, output string "--.tazpkg" + # Field #11 may be: + # - empty (old format): treat as arch-dependent, use $SLITAZ_ARCH + # - 0: arch-independent (*-any.tazpkg) + # - 3: 32-bit \ just use $SLITAZ_ARCH in both cases - + # - 6: 64-bit / there's no 32-bit package in 64-bit repo + pkgfile=$(awk -F$'\t' -vpkg="$(virtual_pkg "$1" "$rep")" -varch="$SLITAZ_ARCH" ' + $1==pkg || $1"-"$2==pkg { + a = ($11 == "0") ? "any" : arch; + printf("%s-%s-%s.tazpkg", $1, $2, a); + exit + }' "$pi") - pkgfile="$namever-$SLITAZ_ARCH.tazpkg" - [ -e "$pkgfile" ] || pkgfile="$namever-any.tazpkg" - - if [ -n "$namever" ]; then + if [ -n "$pkgfile" ]; then pkgsum=$(awk -vfile="$pkgfile" '{if($2==file)print $1}' $rep/packages.md5) break fi done unset IFS - debug " rep='$rep'\n namever='$namever'\n pkgfile='$pkgfile'\n pkgsum='$pkgsum'" + debug " rep='$rep'\n pkgfile='$pkgfile'\n pkgsum='$pkgsum'" - if [ -z "$namever" ]; then + if [ -z "$pkgfile" ]; then _ 'Unable to find package "%s" in the mirrored packages list.' "$1" >&2 # Retry with "get-package"; prevent looping with 'redo' if [ "$2" != 'redo' ]; then @@ -401,11 +407,11 @@ # Check if package already downloaded if [ -f "$pkgfile" ]; then - [ -z "$nocache" -a -z "$quiet" ] && _ 'Package "%s" already in the cache' "$namever" >&2 + [ -z "$nocache" -a -z "$quiet" ] && _ 'Package "%s" already in the cache' "$pkgfile" >&2 # Check if downloading complete, resume if not complete if ! tail -c 2k "$pkgfile" | fgrep -q '00000000TRAILER'; then - [ -z "$quiet" ] && _ 'Continuing package "%s" download' "$namever" >&2 + [ -z "$quiet" ] && _ 'Continuing package "%s" download' "$pkgfile" >&2 download_from "$(cat "$rep/mirror")" "$pkgfile" fi else @@ -450,26 +456,30 @@ pi="$PKGS/packages-$SLITAZ_ARCH.info" [ -e "$pi" ] || pi="$PKGS/packages.info" - namever="$(awk -F$'\t' -vpkg="$1" '{ - if ($1 == pkg) { printf("%s-%s", $1, $2); exit; } + pkgfile="$(awk -F$'\t' -vpkg="$1" -varch="$SLITAZ_ARCH" '{ + if ($1 == pkg) { + a = ($11 == "0") ? "any" : arch; + printf("%s-%s-%s.tazpkg", $1, $2, a); + exit; + } }' $pi)" # Find local provided package - [ -n "$namever" ] || - namever="$(awk -F$'\t' -vpkg="$1" '{ - if (index(" " $10 " ", " " pkg " ")) { printf("%s-%s", $1, $2); exit; } + [ -n "$pkgfile" ] || + pkgfile="$(awk -F$'\t' -vpkg="$1" -varch="$SLITAZ_ARCH" '{ + if (index(" " $10 " ", " " pkg " ")) { + a = ($11 == "0") ? "any" : arch; + printf("%s-%s-%s.tazpkg", $1, $2, a); + exit; + } }' $pi)" - for i in $SLITAZ_ARCH any; do - pkgfile="$PKGS/$namever-$i.tazpkg" - if [ -e "$pkgfile" ]; then - echo "$pkgfile" - return - fi - done - - # Proceed to get package as usual (non-local) - get_pkg "$1" + if [ -e "$PKGS/$pkgfile" ]; then + echo "$PKGS/$pkgfile" + else + # Proceed to get package as usual (non-local) + get_pkg "$1" + fi }