slitaz-forge rev 638
search.sh: clouds cache
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Feb 10 13:13:33 2017 +0100 (2017-02-10) |
parents | 05b611ddb67c |
children | 0f1e69658f38 |
files | pkgs/search.sh |
line diff
1.1 --- a/pkgs/search.sh Thu Feb 09 19:08:30 2017 +0100 1.2 +++ b/pkgs/search.sh Fri Feb 10 13:13:33 2017 +0100 1.3 @@ -891,7 +891,9 @@ 1.4 1.5 display_cloud() { 1.6 arg=$1 1.7 - awk ' 1.8 + [ /tmp/cloud-$arg -nt $pkglist ] && cat /tmp/cloud-$arg || 1.9 + find $WOK/ -maxdepth 2 -name receipt -exec sed \ 1.10 + "/^$1=/!d;s/.*['\"<]\\(..*\\)[>\"'].*/\\1/" {} \; | awk ' 1.11 { 1.12 for (i = 1; $i != ""; i++) 1.13 count[$i]++ 1.14 @@ -923,21 +925,14 @@ 1.15 done 1.16 echo -n '<hr/><p class="lang">' 1.17 case $arg in 1.18 - arch) _p '%s architecture' '%s architectures' "$count" "$count";; 1.19 - maintainer) _p '%s maintainer' '%s maintainers' "$count" "$count";; 1.20 - license) _p '%s license' '%s licenses' "$count" "$count";; 1.21 - category) _p '%s category' '%s categories' "$count" "$count";; 1.22 - tags) _p '%s tag' '%s tags' "$count" "$count";; 1.23 + HOST_ARCH) _p '%s architecture' '%s architectures' "$count" "$count";; 1.24 + MAINTAINER) _p '%s maintainer' '%s maintainers' "$count" "$count";; 1.25 + LICENSE) _p '%s license' '%s licenses' "$count" "$count";; 1.26 + CATEGORY) _p '%s category' '%s categories' "$count" "$count";; 1.27 + TAGS) _p '%s tag' '%s tags' "$count" "$count";; 1.28 esac 1.29 echo '</p>' 1.30 - } 1.31 -} 1.32 - 1.33 - 1.34 -build_cloud() { 1.35 - find $WOK/ -maxdepth 2 -name receipt -exec sed \ 1.36 - "/^$1=/!d;s/.*['\"<]\\(..*\\)[>\"'].*/\\1/" {} \; | \ 1.37 - display_cloud $2 1.38 + } | tee /tmp/cloud-$arg 1.39 } 1.40 1.41 1.42 @@ -1525,7 +1520,7 @@ 1.43 EOT 1.44 else 1.45 # Display arch cloud 1.46 - build_cloud HOST_ARCH arch 1.47 + display_cloud HOST_ARCH 1.48 fi 1.49 ;; 1.50 1.51 @@ -1552,7 +1547,7 @@ 1.52 EOT 1.53 else 1.54 # Display maintainer cloud 1.55 - build_cloud MAINTAINER maintainer 1.56 + display_cloud MAINTAINER 1.57 fi 1.58 ;; 1.59 1.60 @@ -1576,7 +1571,7 @@ 1.61 echo '</table>' 1.62 else 1.63 # Display license cloud 1.64 - build_cloud LICENSE license 1.65 + display_cloud LICENSE 1.66 fi 1.67 ;; 1.68 1.69 @@ -1613,7 +1608,7 @@ 1.70 printf "href=\"?category=%s%s\">%s</a> ", $2, addver, $2; 1.71 }' 1.72 else 1.73 - build_cloud CATEGORY category 1.74 + display_cloud CATEGORY 1.75 fi 1.76 fi 1.77 ;; 1.78 @@ -1651,7 +1646,7 @@ 1.79 printf "href=\"?tags=%s%s\">%s</a> ", $2, v, $2; 1.80 }' 1.81 else 1.82 - build_cloud TAGS tags 1.83 + display_cloud TAGS 1.84 fi 1.85 fi 1.86 ;;