# HG changeset patch # User Pascal Bellard # Date 1392654084 0 # Node ID ea7fb53f95b92d30a0e25ef8d315dc3e44efca41 # Parent 5500764333d06a10174ab45a3aa7bf043579c982 pkgs: add license, category, maintainer diff -r 5500764333d0 -r ea7fb53f95b9 pkgs/search.sh --- a/pkgs/search.sh Mon Feb 17 14:55:17 2014 +0000 +++ b/pkgs/search.sh Mon Feb 17 16:21:24 2014 +0000 @@ -78,6 +78,9 @@ File) NICE="file=$SEARCH";; File_list) NICE="filelist=$SEARCH";; FileOverlap) NICE="fileoverlap=$SEARCH";; + Category) NICE="category=$SEARCH";; + Maintainer) NICE="maintainer=$SEARCH";; + License) NICE="license=$SEARCH";; esac # version, if needed version="$(GETPOST version)" @@ -145,6 +148,7 @@ fileoverlap=*) SEARCH=${i#*=}; OBJECT=FileOverlap;; category=*) SEARCH=${i#*=}; OBJECT=Category;; maintainer=*) SEARCH=${i#*=}; OBJECT=Maintainer;; + license=*) SEARCH=${i#*=}; OBJECT=License;; version=[1-9]*) i=${i%%.*}; SLITAZ_VERSION=${i#*=}.0;; version=s*|version=4*) SLITAZ_VERSION=stable;; version=u*) SLITAZ_VERSION=undigest;; @@ -173,6 +177,9 @@ Depends) selected_depends="selected";; BuildDepends) selected_build_depends="selected";; FileOverlap) selected_overlap="selected";; + Category) selected_category="selected";; + Maintainer) selected_maintainer="selected";; + License) selected_license="selected";; esac case "$SLITAZ_VERSION" in @@ -223,6 +230,9 @@ + + + @@ -321,7 +331,7 @@ $PACKAGE_HREF $(installed_size $PACKAGE) $SHORT_DESC - $(gettext "Receipt") $COOKER + $(gettext "Receipt") $COOKER _EOT_ fi cat << EOT @@ -345,7 +355,7 @@ esac cat << _EOT_ $PACKAGE_HREF $(installed_size $PACKAGE) : $SHORT_DESC \ -$(gettext "Receipt") $COOKER +$(gettext "Receipt") $COOKER _EOT_ fi } @@ -546,6 +556,34 @@ -e "s|~||g" < "$1" } +display_cloud() { + arg=$1 + awk ' +{ + for (i = 1; $i != ""; i++) + count[$i]++ +} +END { + min=10000 + max=0 + for (i in count) { + if (count[i] < min) min = count[i] + if (count[i] > max) max = count[i] + } + for (i in count) + print count[i] " " min " " max " " i +}' | while read cnt min max tag ; do + pct=$(((($cnt-$min)*100)/($max-$min))) + pct=$(((10000 - ((100 - $pct)**2))/100)) + pct=$(((10000 - ((100 - $pct)**2))/100)) + cat <\ +$cnt$tag +EOT + done +} # # page begins @@ -876,6 +914,87 @@ _EOT_ ;; +### Maintainer +Maintainer) + if [ -n "$SEARCH" ]; then + cat << _EOT_ + +

$(eval_gettext "Result for: \$SEARCH")

+ +_EOT_ + unset last + grep ^MAINTAINER= $WOK/*/receipt | grep -i "$SEARCH" | \ + sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do + . $WOK/$pkg/receipt + package_entry + done + cat << _EOT_ +
+_EOT_ + else + # Display maintainer cloud + grep -l ^MAINTAINER= $WOK/*/receipt | while read file; do + MAINTAINER= + . $file + echo $MAINTAINER + done | display_cloud maintainer + fi + ;; + +### License +License) + if [ -n "$SEARCH" ]; then + cat << _EOT_ + +

$(eval_gettext "Result for: \$SEARCH")

+ +_EOT_ + unset last + grep ^LICENSE= $WOK/*/receipt | grep -i "$SEARCH" | \ + sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do + . $WOK/$pkg/receipt + package_entry + done + cat << _EOT_ +
+_EOT_ + else + # Display license cloud + grep -l ^LICENSE= $WOK/*/receipt | while read file; do + LICENSE= + . $file + echo $LICENSE + done | display_cloud license + fi + ;; + +### Category +Category) + if [ -n "$SEARCH" ]; then + cat << _EOT_ + +

$(eval_gettext "Result for: \$SEARCH")

+ +_EOT_ + unset last + grep ^CATEGORY= $WOK/*/receipt | grep -i "$SEARCH" | \ + sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do + . $WOK/$pkg/receipt + package_entry + done + cat << _EOT_ +
+_EOT_ + else + # Display category cloud + grep -l ^CATEGORY= $WOK/*/receipt | while read file; do + CATEGORY= + . $file + echo $CATEGORY + done | display_cloud category + fi + ;; + ### Tags Tags) if [ -n "$SEARCH" ]; then @@ -899,28 +1018,7 @@ TAGS= . $file echo $TAGS - done | awk ' -{ - for (i = 1; $i != ""; i++) - count[$i]++ -} -END { - min=10000 - max=0 - for (i in count) { - if (count[i] < min) min = count[i] - if (count[i] > max) max = count[i] - } - for (i in count) - print count[i] " " min " " max " " i -}' | while read cnt min max tag ; do - cat <\ -$cnt$tag -EOT - done + done | display_cloud args fi ;;