tazpkg rev 233
tazpkgbox: improved search tab and engine and add new tazpkg-installed icon
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 25 22:03:25 2009 +0100 (2009-02-25) |
parents | dd48da6e9023 |
children | e553dc92c647 |
files | lib/tazpkgbox/list lib/tazpkgbox/search pixmaps/tazpkg-installed.png tazpkgbox |
line diff
1.1 --- a/lib/tazpkgbox/list Sat Feb 21 22:16:34 2009 +0100 1.2 +++ b/lib/tazpkgbox/list Wed Feb 25 22:03:25 2009 +0100 1.3 @@ -39,7 +39,7 @@ 1.4 do 1.5 . $pkg/receipt 1.6 if [ "$CAT" == "all" -o "$CATEGORY" == "$CAT" ]; then 1.7 - echo "go-next|$PACKAGE|$VERSION|$SHORT_DESC" 1.8 + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" 1.9 fi 1.10 done 1.11 } 1.12 @@ -55,7 +55,7 @@ 1.13 if [ "$CAT" == "all" ] || [ "$CATEGORY" == " $CAT " ]; then 1.14 if [ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ]; then 1.15 . /var/lib/tazpkg/installed/${PACKAGE%% *}/receipt 1.16 - echo "go-next|$PACKAGE|$VERSION|$SHORT_DESC" 1.17 + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" 1.18 else 1.19 echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC" 1.20 fi
2.1 --- a/lib/tazpkgbox/search Sat Feb 21 22:16:34 2009 +0100 2.2 +++ b/lib/tazpkgbox/search Wed Feb 25 22:03:25 2009 +0100 2.3 @@ -4,8 +4,8 @@ 2.4 # 2.5 2.6 # Clean preview results. 2.7 -rm -f /tmp/tazpkgbox/search-installed 2.8 -touch /tmp/tazpkgbox/search-installed 2.9 +rm -f /tmp/tazpkgbox/search 2.10 +touch /tmp/tazpkgbox/search 2.11 2.12 list_files() 2.13 { 2.14 @@ -17,29 +17,50 @@ 2.15 [ "$pkg" = "0" ] && continue 2.16 version=$(grep -hs "^$pkg " /var/lib/tazpkg/packages.desc \ 2.17 /var/lib/tazpkg/undigest/*/packages.desc | awk '{ print $3 }') 2.18 - echo "$pkg|$version|$file" 2.19 + if [ -d /var/lib/tazpkg/installed/$pkg ]; then 2.20 + if [ -f $file ]; then 2.21 + echo "txt|$pkg|$version|$file" 2.22 + elif [ -d $file ] ; then 2.23 + echo "folder|$pkg|$version|$file" 2.24 + elif [ -x $file ]; then 2.25 + echo "exec|$pkg|$version|$file" 2.26 + else 2.27 + # Missing installed file. 2.28 + echo "dialog-warning|$pkg|$version|$file" 2.29 + fi 2.30 + else 2.31 + echo "tazpkg|$pkg|$version|$file" 2.32 + fi 2.33 done 2.34 } 2.35 2.36 -if [ "$1" = "--files" ]; then 2.37 - tazpkg search-file "$SEARCH" | list_files > \ 2.38 - /tmp/tazpkgbox/search-installed 2.39 - tazpkg search-file "$SEARCH" --mirror | list_files > \ 2.40 - /tmp/tazpkgbox/search-mirrored 2.41 - exit 0 2.42 -fi 2.43 +search_package() 2.44 +{ 2.45 + IFS="|" 2.46 + cat /var/lib/tazpkg/packages.desc \ 2.47 + /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \ 2.48 + while read PACKAGE VERSION SHORT_DESC; do 2.49 + if echo "$PACKAGE $SHORT_DESC" | grep -q "$SEARCH"; then 2.50 + if [ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ]; then 2.51 + . /var/lib/tazpkg/installed/${PACKAGE%% *}/receipt 2.52 + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" 2.53 + else 2.54 + echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC" 2.55 + fi 2.56 + fi 2.57 + done 2.58 + unset IFS 2.59 +} 2.60 2.61 -# Search installed. 2.62 -for i in `ls /var/lib/tazpkg/installed` 2.63 -do 2.64 - . /var/lib/tazpkg/installed/$i/receipt 2.65 - if echo "$PACKAGE $SHORT_DESC" | grep -q "$SEARCH"; then 2.66 - echo "$PACKAGE|$VERSION|$SHORT_DESC" >> /tmp/tazpkgbox/search-installed 2.67 - fi 2.68 -done 2.69 +case "$1" in 2.70 + files) 2.71 + tazpkg search-file "$SEARCH" --mirror | list_files > \ 2.72 + /tmp/tazpkgbox/search ;; 2.73 + packages) 2.74 + search_package > /tmp/tazpkgbox/search ;; 2.75 + *) 2.76 + echo "Usage: $0 [packages|files]" ;; 2.77 +esac 2.78 2.79 -# Search mirrored. 2.80 -grep -sh "$SEARCH" /var/lib/tazpkg/packages.desc \ 2.81 - /var/lib/tazpkg/undigest/*/packages.desc | sort > /tmp/tazpkgbox/search-mirrored 2.82 2.83 exit 0
3.1 Binary file pixmaps/tazpkg-installed.png has changed
4.1 --- a/tazpkgbox Sat Feb 21 22:16:34 2009 +0100 4.2 +++ b/tazpkgbox Wed Feb 25 22:03:25 2009 +0100 4.3 @@ -28,8 +28,7 @@ 4.4 echo "all" > /tmp/tazpkgbox/status 4.5 echo "all" > /tmp/tazpkgbox/category 4.6 echo "all" > /tmp/tazpkgbox/undigest-category 4.7 -echo "" > /tmp/tazpkgbox/search-installed 4.8 -echo "" > /tmp/tazpkgbox/search-mirrored 4.9 +echo "" > /tmp/tazpkgbox/search 4.10 4.11 # English/French help dialod. 4.12 export HELP=' 4.13 @@ -233,28 +232,15 @@ 4.14 </vbox> 4.15 4.16 <vbox> 4.17 - <tree icon="tazpkg"> 4.18 + <tree> 4.19 <width>620</width><height>120</height> 4.20 - <variable>RESULT_INSTALLED</variable> 4.21 + <variable>RESULT</variable> 4.22 <label>Installed packages|Version|Description / File</label> 4.23 - <input>cat /tmp/tazpkgbox/search-installed</input> 4.24 - <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action> 4.25 + <input icon_column="0">cat /tmp/tazpkgbox/search</input> 4.26 + <action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action> 4.27 <action>$LIB/package_infos</action> 4.28 <action>$LIB/search</action> 4.29 - <action>refresh:RESULT_INSTALLED</action> 4.30 - <action>refresh:PKG</action> 4.31 - <action>refresh:PKG_STATS</action> 4.32 - <action>refresh:CACHE_STATS</action> 4.33 - </tree> 4.34 - <tree icon="tazpkg"> 4.35 - <width>620</width><height>120</height> 4.36 - <variable>RESULT_MIRROR</variable> 4.37 - <label>Mirrored packages|Version|Description / File</label> 4.38 - <input>cat /tmp/tazpkgbox/search-mirrored</input> 4.39 - <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action> 4.40 - <action>$LIB/package_infos</action> 4.41 - <action>$LIB/search</action> 4.42 - <action>refresh:RESULT_INSTALLED</action> 4.43 + <action>refresh:RESULT</action> 4.44 <action>refresh:PKG</action> 4.45 <action>refresh:PKG_STATS</action> 4.46 <action>refresh:CACHE_STATS</action> 4.47 @@ -264,18 +250,16 @@ 4.48 <variable>SEARCH</variable> 4.49 </entry> 4.50 <button> 4.51 - <label>Search Packages</label> 4.52 + <label>Packages</label> 4.53 <input file icon="system-search"></input> 4.54 - <action>$LIB/search</action> 4.55 - <action>refresh:RESULT_INSTALLED</action> 4.56 - <action>refresh:RESULT_MIRROR</action> 4.57 + <action>$LIB/search packages</action> 4.58 + <action>refresh:RESULT</action> 4.59 </button> 4.60 <button> 4.61 - <label>Search Files</label> 4.62 + <label>Files</label> 4.63 <input file icon="system-search"></input> 4.64 - <action>$LIB/search --files</action> 4.65 - <action>refresh:RESULT_INSTALLED</action> 4.66 - <action>refresh:RESULT_MIRROR</action> 4.67 + <action>$LIB/search files</action> 4.68 + <action>refresh:RESULT</action> 4.69 </button> 4.70 </hbox> 4.71 </vbox>