tazpkg rev 968

Modules "get" and "install": initial support for Cooker contain two architectures packages in one "packages" folder
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 26 12:33:58 2018 +0200 (7 months ago)
parents efd6e87f46d8
children f40de1e052aa
files modules/get modules/install
line diff
     1.1 --- a/modules/get	Tue May 08 08:23:30 2018 +0200
     1.2 +++ b/modules/get	Mon Nov 26 12:33:58 2018 +0200
     1.3 @@ -157,14 +157,18 @@
     1.4  
     1.5  		# Extra-cache should contain packages DB files (packages.info, etc.)
     1.6  		# to list extra-packages contained in the extra-cache
     1.7 -		[ ! -f 'packages.info' ] && tazpkg mkdb "$extra_cache" --root='' --forced >/dev/null
     1.8 +		[ ! -e 'packages.info' -a ! -e "packages-$SLITAZ_ARCH.info" ] &&
     1.9 +			tazpkg mkdb "$extra_cache" --root='' --forced >/dev/null
    1.10  
    1.11 -		if [ -f 'packages.info' ]; then
    1.12 -			awk -F$'\t' -vp="$1" '$1==p{exit 1}' packages.info
    1.13 +		pi='packages.info'
    1.14 +		[ -e "$pi" ] || pi="packages-$SLITAZ_ARCH.info"
    1.15 +
    1.16 +		if [ -e "$pi" ]; then
    1.17 +			awk -F$'\t' -vp="$1" '$1==p{exit 1}' $pi
    1.18  			if [ "$?" -eq 1 ]; then
    1.19  				[ -z "$quiet" ] && _ 'Package "%s" already in the cache' "$1" >&2
    1.20  				echo -n "$(pwd)/"
    1.21 -				awk -F$'\t' -vp="$1" '$1==p{printf "%s-%s.tazpkg\n", $1, $2; exit}' packages.info
    1.22 +				awk -F$'\t' -vp="$1" '$1==p{printf "%s-%s.tazpkg\n", $1, $2; exit}' $pi
    1.23  				exit 0
    1.24  			fi
    1.25  		fi
    1.26 @@ -347,10 +351,13 @@
    1.27  
    1.28  	IFS=$'\n'
    1.29  	for rep in $PRIORITY; do
    1.30 -		[ ! -f "$rep/packages.info" ] && continue
    1.31 +		pi="$rep/packages.info"
    1.32 +		[ ! -e "$pi" ] && pi="$rep/packages-$SLITAZ_ARCH.info"
    1.33 +		[ ! -e "$pi" ] && continue
    1.34 +
    1.35  		# If found, output string "<name>-<ver>"
    1.36  		namever=$(awk -F$'\t' -vpkg="$(virtual_pkg "$1" "$rep")" \
    1.37 -			'$1==pkg || $1"-"$2==pkg {printf "%s-%s", $1, $2; exit}' "$rep/packages.info")
    1.38 +			'$1==pkg || $1"-"$2==pkg {printf "%s-%s", $1, $2; exit}' "$pi")
    1.39  
    1.40  		case $SLITAZ_ARCH in
    1.41  			i?86) pkgfile="$namever.tazpkg";;
    1.42 @@ -434,15 +441,18 @@
    1.43  	[ -e "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
    1.44  
    1.45  	# Find local package
    1.46 +	pi="$PKGS/packages.info"
    1.47 +	[ -e "$pi" ] || pi="$PKGS/packages-$SLITAZ_ARCH.info"
    1.48 +
    1.49  	namever="$(awk -F$'\t' -vpkg="$1" '{
    1.50  		if ($1 == pkg) { printf("%s-%s", $1, $2); exit; }
    1.51 -	}' $PKGS/packages.info)"
    1.52 +	}' $pi)"
    1.53  
    1.54  	# Find local provided package
    1.55  	[ -n "$namever" ] ||
    1.56  	namever="$(awk -F$'\t' -vpkg="$1" '{
    1.57  		if (index(" " $10 " ", " " pkg " ")) { printf("%s-%s", $1, $2); exit; }
    1.58 -	}' $PKGS/packages.info)"
    1.59 +	}' $pi)"
    1.60  
    1.61  	[ -n "$namever" ] && pkgfile=$(find "$PKGS" -name "$namever*.tazpkg")
    1.62  
     2.1 --- a/modules/install	Tue May 08 08:23:30 2018 +0200
     2.2 +++ b/modules/install	Mon Nov 26 12:33:58 2018 +0200
     2.3 @@ -47,6 +47,7 @@
     2.4  		# Search for virtual packages
     2.5  		if [ -n "$cookmode" ]; then
     2.6  			pi='/home/slitaz/packages/packages.info'
     2.7 +			[ -e "$pi" ] || pi="/home/slitaz/packages/packages-$SLITAZ_ARCH.info"
     2.8  		else
     2.9  			pi="$(dirname "$2")/packages.info"
    2.10  		fi
    2.11 @@ -183,6 +184,7 @@
    2.12  				[ -z "$quiet" ] && _ 'Checking if package "%s" exists in local list...' "$pkg"
    2.13  				[ -n "$cookmode" ] && dir='/home/slitaz/packages'
    2.14  				pi="$dir/packages.info"
    2.15 +				[ -e "$pi" ] || pi="$dir/packages-$SLITAZ_ARCH.info"
    2.16  				# Find local package
    2.17  				if [ -f "$pi" ]; then
    2.18  					# Packages database exists (should be everfresh!)
    2.19 @@ -271,8 +273,14 @@
    2.20  	done
    2.21  
    2.22  	# Try to find short description for mirrored package
    2.23 -	[ -z "$short_desc" -a -s "$PKGS_DB/packages.info" ] &&
    2.24 -		short_desc=$(awk -F$'\t' -vp="$1" '$1==p{print $4; exit}' "$PKGS_DB/packages.info")
    2.25 +	if [ -z "$short_desc" ]; then
    2.26 +		if [ -e "$PKGS_DB/packages.info" ]; then
    2.27 +			pi="$PKGS_DB/packages.info"
    2.28 +		else
    2.29 +			"$PKGS_DB/packages-$SLITAZ_ARCH.info"
    2.30 +		fi
    2.31 +		short_desc=$(awk -F$'\t' -vp="$1" '$1==p{print $4; exit}' "$pi")
    2.32 +	fi
    2.33  
    2.34  	[ -z "$short_desc" ] && short_desc="$SHORT_DESC"
    2.35