slitaz-forge rev 637

search.sh: fix clouds (too many arguments)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 09 19:08:30 2017 +0100 (2017-02-09)
parents d65a5b0bb724
children 8ad41e93bda4
files pkgs/search.sh
line diff
     1.1 --- a/pkgs/search.sh	Tue Feb 07 10:45:13 2017 +0100
     1.2 +++ b/pkgs/search.sh	Thu Feb 09 19:08:30 2017 +0100
     1.3 @@ -934,6 +934,13 @@
     1.4  }
     1.5  
     1.6  
     1.7 +build_cloud() {
     1.8 +	find $WOK/ -maxdepth 2 -name receipt -exec sed \
     1.9 +	 "/^$1=/!d;s/.*['\"<]\\(..*\\)[>\"'].*/\\1/" {} \; | \
    1.10 +		display_cloud $2
    1.11 +}
    1.12 +
    1.13 +
    1.14  #
    1.15  # page begins
    1.16  #
    1.17 @@ -1518,11 +1525,7 @@
    1.18  EOT
    1.19  	else
    1.20  		# Display arch cloud
    1.21 -		grep -l ^HOST_ARCH= $WOK/*/receipt | while read file; do
    1.22 -			HOST_ARCH=
    1.23 -			. $file
    1.24 -			echo $HOST_ARCH
    1.25 -			done | display_cloud arch
    1.26 +		build_cloud HOST_ARCH arch
    1.27  	fi
    1.28  	;;
    1.29  
    1.30 @@ -1549,15 +1552,7 @@
    1.31  EOT
    1.32  	else
    1.33  		# Display maintainer cloud
    1.34 -		grep -l ^MAINTAINER= $WOK/*/receipt | while read file; do
    1.35 -			MAINTAINER=
    1.36 -			. $file
    1.37 -			case $MAINTAINER in
    1.38 -				# For form "John Doe <jdoe@example.org>
    1.39 -				*\<*) MAINTAINER="${MAINTAINER#*<}"; echo "${MAINTAINER%>}";;
    1.40 -				*) echo $MAINTAINER;;
    1.41 -			esac
    1.42 -			done | display_cloud maintainer
    1.43 +		build_cloud MAINTAINER maintainer
    1.44  	fi
    1.45  	;;
    1.46  
    1.47 @@ -1581,11 +1576,7 @@
    1.48  		echo '</table>'
    1.49  	else
    1.50  		# Display license cloud
    1.51 -		grep -l ^LICENSE= $WOK/*/receipt | while read file; do
    1.52 -			LICENSE=
    1.53 -			. $file
    1.54 -			echo $LICENSE
    1.55 -			done | display_cloud license
    1.56 +		build_cloud LICENSE license
    1.57  	fi
    1.58  	;;
    1.59  
    1.60 @@ -1622,12 +1613,7 @@
    1.61  				printf "href=\"?category=%s%s\">%s</a> ", $2, addver, $2;
    1.62  			}'
    1.63  		else
    1.64 -			grep -l ^CATEGORY= $WOK/*/receipt | \
    1.65 -			while read file; do
    1.66 -				CATEGORY=
    1.67 -				. $file
    1.68 -				echo $CATEGORY
    1.69 -			done | display_cloud category
    1.70 +			build_cloud CATEGORY category
    1.71  		fi
    1.72  	fi
    1.73  	;;
    1.74 @@ -1665,12 +1651,7 @@
    1.75  				printf "href=\"?tags=%s%s\">%s</a> ", $2, v, $2;
    1.76  			}'
    1.77  		else
    1.78 -			grep -l ^TAGS= $WOK/*/receipt | \
    1.79 -			while read file; do
    1.80 -				TAGS=
    1.81 -				. $file
    1.82 -				echo $TAGS
    1.83 -			done | display_cloud tags
    1.84 +			build_cloud TAGS tags
    1.85  		fi
    1.86  	fi
    1.87  	;;