tazpkg rev 922

get: fix virtual_pkg
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 18 12:12:29 2016 +0200 (2016-09-18)
parents ee45db385304
children ab2442591abf
files modules/get
line diff
     1.1 --- a/modules/get	Tue Sep 06 17:09:49 2016 +0100
     1.2 +++ b/modules/get	Sun Sep 18 12:12:29 2016 +0200
     1.3 @@ -288,24 +288,9 @@
     1.4  
     1.5  # return possible name for a virtual package name
     1.6  
     1.7 -virtual_pkg() {
     1.8 +virtual_name() {
     1.9  	# input:  $1 virtual package name
    1.10  	#         $2 repository db directory
    1.11 -	# output: display possible package name
    1.12 -
    1.13 -	debug "\nvirtual_pkg('$1', '$2')"
    1.14 -
    1.15 -	if [ "$tazpkg_command" != 'get-install' ]; then
    1.16 -		# 'get' command: download any package
    1.17 -		if [ -z "$(awk -F$'\t' -vp="$1" '{if ($1 == p) print p}' "$2/packages.info")" ]; then
    1.18 -			# This package not exists in the list, it may be virtual package
    1.19 -			grep -hs "^$1=" "$2/packages.equiv" | sed "s/^$1=//"
    1.20 -		else
    1.21 -			echo $1
    1.22 -		fi
    1.23 -		return
    1.24 -	fi
    1.25 -
    1.26  	local i
    1.27  	unset IFS
    1.28  	for i in $(grep -hs "^$1=" "$2/packages.equiv" | sed "s/^$1=//"); do
    1.29 @@ -327,6 +312,27 @@
    1.30  	echo $1
    1.31  }
    1.32  
    1.33 +virtual_pkg() {
    1.34 +	# input:  $1 virtual package name
    1.35 +	#         $2 repository db directory
    1.36 +	# output: display possible package name
    1.37 +
    1.38 +	debug "\nvirtual_pkg('$1', '$2')"
    1.39 +
    1.40 +	if [ "$tazpkg_command" != 'get-install' ]; then
    1.41 +		# 'get' command: download any package
    1.42 +		if [ -z "$(awk -F$'\t' -vp="$1" '{if ($1 == p) print p}' "$2/packages.info")" ]; then
    1.43 +			# This package not exists in the list, it may be virtual package
    1.44 +			virtual_name "$1" "$2"
    1.45 +		else
    1.46 +			echo $1
    1.47 +		fi
    1.48 +		return
    1.49 +	fi
    1.50 +
    1.51 +	virtual_name "$1" "$2"
    1.52 +}
    1.53 +
    1.54  
    1.55  # Download package file to the cache
    1.56