tazpkg rev 965
modules/get: get_pkg(): introduce architecture-dependent packages filenames to tazpkg
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Apr 27 13:29:11 2018 +0300 (2018-04-27) |
parents | 440f0df6d457 |
children | bef0471b87ea |
files | modules/get |
line diff
1.1 --- a/modules/get Thu Apr 26 10:33:16 2018 +0300 1.2 +++ b/modules/get Fri Apr 27 13:29:11 2018 +0300 1.3 @@ -343,7 +343,7 @@ 1.4 # output: full path to the downloaded package 1.5 1.6 debug "\nget_pkg('$1', '$2')" 1.7 - local repo line namever pkgsum 1.8 + local repo line namever pkgsum pkgfile 1.9 1.10 IFS=$'\n' 1.11 for rep in $PRIORITY; do 1.12 @@ -351,14 +351,20 @@ 1.13 # If found, output string "<name>-<ver>" 1.14 namever=$(awk -F$'\t' -vpkg="$(virtual_pkg "$1" "$rep")" \ 1.15 '$1==pkg || $1"-"$2==pkg {printf "%s-%s", $1, $2; exit}' "$rep/packages.info") 1.16 + 1.17 + case $SLITAZ_ARCH in 1.18 + i?86) pkgfile="$namever.tazpkg";; 1.19 + *) pkgfile="$namever-$SLITAZ_ARCH.tazpkg";; 1.20 + esac 1.21 + 1.22 if [ -n "$namever" ]; then 1.23 - pkgsum=$(awk -vfile="$namever.tazpkg" '{if($2==file)print $1}' $rep/packages.md5) 1.24 + pkgsum=$(awk -vfile="$pkgfile" '{if($2==file)print $1}' $rep/packages.md5) 1.25 break 1.26 fi 1.27 done 1.28 unset IFS 1.29 1.30 - debug " rep='$rep'\n namever='$namever'\n pkgsum='$pkgsum'" 1.31 + debug " rep='$rep'\n namever='$namever'\n pkgfile='$pkgfile'\n pkgsum='$pkgsum'" 1.32 1.33 if [ -z "$namever" ]; then 1.34 _ 'Unable to find package "%s" in the mirrored packages list.' "$1" >&2 1.35 @@ -372,7 +378,7 @@ 1.36 fi 1.37 fi 1.38 1.39 - # We need package "$namever.tazpkg" from "$rep" with "$pkgsum" 1.40 + # We need package "$pkgfile" from "$rep" with "$pkgsum" 1.41 1.42 if [ -z "$nocache" ]; then 1.43 # Go to cache for "get-install" command; don't move for "get" command 1.44 @@ -381,24 +387,24 @@ 1.45 fi 1.46 1.47 # Check if package already downloaded 1.48 - if [ -f "$namever.tazpkg" ]; then 1.49 + if [ -f "$pkgfile" ]; then 1.50 [ -z "$nocache" -a -z "$quiet" ] && _ 'Package "%s" already in the cache' "$namever" >&2 1.51 1.52 # Check if downloading complete, resume if not complete 1.53 - if ! tail -c 2k "$namever.tazpkg" | fgrep -q '00000000TRAILER'; then 1.54 + if ! tail -c 2k "$pkgfile" | fgrep -q '00000000TRAILER'; then 1.55 [ -z "$quiet" ] && _ 'Continuing package "%s" download' "$namever" >&2 1.56 - download_from "$(cat "$rep/mirror")" "$namever.tazpkg" 1.57 + download_from "$(cat "$rep/mirror")" "$pkgfile" 1.58 fi 1.59 else 1.60 # Package absent in the cache, "cold" downloading 1.61 - download_from "$(cat "$rep/mirror")" "$namever.tazpkg" 1.62 + download_from "$(cat "$rep/mirror")" "$pkgfile" 1.63 fi 1.64 1.65 # Make sure we downloaded what we want with checksum 1.66 1.67 - if [ "$($CHECKSUM "$namever.tazpkg" | cut -d' ' -f1)" != "$pkgsum" ]; then 1.68 - _ 'Checksum error for "%s"' "$namever.tazpkg" >&2 1.69 - rm "$namever.tazpkg" 1.70 + if [ "$($CHECKSUM "$pkgfile" | cut -d' ' -f1)" != "$pkgsum" ]; then 1.71 + _ 'Checksum error for "%s"' "$pkgfile" >&2 1.72 + rm "$pkgfile" 1.73 1.74 # Recharge DBs and try again; prevent looping with 'redo' 1.75 if [ "$2" != 'redo' ]; then 1.76 @@ -412,7 +418,7 @@ 1.77 fi 1.78 1.79 # Output: path to downloaded package 1.80 - printf '%s/%s.tazpkg\n' "$(pwd)" "$namever" 1.81 + printf '%s/%s\n' "$(pwd)" "$pkgfile" 1.82 } 1.83 1.84