slitaz-forge rev 370

mirror-search.sh: add license cloud
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jun 04 17:02:27 2013 +0200 (2013-06-04)
parents 3fd9f645cdb0
children 730cd6374507
files pkgs/mirror-search.sh
line diff
     1.1 --- a/pkgs/mirror-search.sh	Mon Jun 03 12:25:12 2013 +0200
     1.2 +++ b/pkgs/mirror-search.sh	Tue Jun 04 17:02:27 2013 +0200
     1.3 @@ -137,6 +137,7 @@
     1.4  		fileoverlap=*)				SEARCH=${i#*=}; OBJECT=FileOverlap;;
     1.5  		category=*)				SEARCH=${i#*=}; OBJECT=Category;;
     1.6  		maintainer=*)				SEARCH=${i#*=}; OBJECT=Maintainer;;
     1.7 +		license=*)				SEARCH=${i#*=}; OBJECT=License;;
     1.8  		version=[1-9]*)			i=${i%%.*}; SLITAZ_VERSION=${i#*=}.0;;
     1.9  		version=s*|version=4*)	SLITAZ_VERSION=stable;;
    1.10  		version=u*)				SLITAZ_VERSION=undigest;;
    1.11 @@ -250,8 +251,14 @@
    1.12  # xHTML Footer.
    1.13  # TODO: caching the summary for 5 minutes
    1.14  xhtml_footer() {
    1.15 -	PKGS=$(ls $WOK/ | wc -l)
    1.16 -	FILES=$(cat_files_list $PACKAGES_REPOSITORY lines)
    1.17 +	file=/tmp/footer-$SLITAZ_VERSION
    1.18 +	[ ! -e $file -o  $PACKAGES_REPOSITORY/packages.txt -nt $file ] &&
    1.19 +		cat > $file.$$ <<EOT && mv -f $file.$$ $file
    1.20 +PKGS=$(ls $WOK/ | wc -l)
    1.21 +FILES=$(cat_files_list $PACKAGES_REPOSITORY lines)
    1.22 +EOT
    1.23 +	PKGS=$(sed '/PKGS=/!d;s/PKGS=//' $file)
    1.24 +	FILES=$(sed '/FILES=/!d;s/FILES=//' $file)
    1.25  	. lib/footer.sh
    1.26  }
    1.27  
    1.28 @@ -282,7 +289,7 @@
    1.29  	busybox wget -s $PACKAGE_URL 2> /dev/null &&
    1.30  	PACKAGE_HREF="<a href=\"$PACKAGE_URL\">$PACKAGE</a>"
    1.31  	COOKER=""
    1.32 -	[ "$SLITAZ_VERSION" == "cooking" ] &&
    1.33 +	[ "$SLITAZ_VERSION" == "cooking" ] && 
    1.34  	COOKER="<a href=\"http://cook.slitaz.org/cooker.cgi?pkg=$PACKAGE\">$(gettext "Cooker")</a>"
    1.35  	cat << _EOT_
    1.36  $PACKAGE_HREF $(installed_size $PACKAGE): $SHORT_DESC \
    1.37 @@ -850,11 +857,12 @@
    1.38  			[ ! -e $file -o  \
    1.39  			  $PACKAGES_REPOSITORY/packages.txt -nt $file ] &&
    1.40  				build_cloud_cache $var "$filter" > $file.$$ &&
    1.41 -				mv $file.$$ $file
    1.42 +				mv -f $file.$$ $file
    1.43  			display_cloud $arg "$fmt" < $file 2>&1
    1.44  		done << EOT
    1.45  TAGS		tags		Tag\ cloud		%d\ tags.
    1.46  CATEGORY	category	Category\ cloud		%d\ categories.
    1.47 +LICENSE		license		License\ cloud		%d\ licenses.
    1.48  MAINTAINER	maintainer	Maintainer\ cloud	%d\ maintainers.	s/.*<//;s/.*\ //;s/>//
    1.49  EOT
    1.50  	fi
    1.51 @@ -952,6 +960,25 @@
    1.52  _EOT_
    1.53  	done
    1.54  	;;
    1.55 +
    1.56 +### License
    1.57 +License)
    1.58 +	cat << _EOT_
    1.59 +
    1.60 +<h3>$(eval_gettext "Result for: \$SEARCH")</h3>
    1.61 +<pre>
    1.62 +_EOT_
    1.63 +	for pkg in `ls $WOK/`
    1.64 +	do
    1.65 +		LICENSE=
    1.66 +		. $WOK/$pkg/receipt
    1.67 +		DESC=" <a href=\"?object=Desc&query=$pkg&lang=$lang&version=$SLITAZ_VERSION&submit=go\">$(gettext description)</a>"
    1.68 +		[ -f $WOK/$pkg/description.txt ] || DESC=""
    1.69 +		[ "$LICENSE" == "$SEARCH" ] && cat << _EOT_
    1.70 +$(package_entry)$DESC
    1.71 +_EOT_
    1.72 +	done
    1.73 +	;;
    1.74  esac
    1.75  
    1.76  xhtml_footer