# HG changeset patch # User Christophe Lincoln # Date 1235595805 -3600 # Node ID d689a99ecd2d868dfd966f1f2b4f083b88d12273 # Parent dd48da6e9023bbad32f1ff5c12daeeea112c0753 tazpkgbox: improved search tab and engine and add new tazpkg-installed icon diff -r dd48da6e9023 -r d689a99ecd2d lib/tazpkgbox/list --- a/lib/tazpkgbox/list Sat Feb 21 22:16:34 2009 +0100 +++ b/lib/tazpkgbox/list Wed Feb 25 22:03:25 2009 +0100 @@ -39,7 +39,7 @@ do . $pkg/receipt if [ "$CAT" == "all" -o "$CATEGORY" == "$CAT" ]; then - echo "go-next|$PACKAGE|$VERSION|$SHORT_DESC" + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" fi done } @@ -55,7 +55,7 @@ if [ "$CAT" == "all" ] || [ "$CATEGORY" == " $CAT " ]; then if [ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ]; then . /var/lib/tazpkg/installed/${PACKAGE%% *}/receipt - echo "go-next|$PACKAGE|$VERSION|$SHORT_DESC" + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" else echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC" fi diff -r dd48da6e9023 -r d689a99ecd2d lib/tazpkgbox/search --- a/lib/tazpkgbox/search Sat Feb 21 22:16:34 2009 +0100 +++ b/lib/tazpkgbox/search Wed Feb 25 22:03:25 2009 +0100 @@ -4,8 +4,8 @@ # # Clean preview results. -rm -f /tmp/tazpkgbox/search-installed -touch /tmp/tazpkgbox/search-installed +rm -f /tmp/tazpkgbox/search +touch /tmp/tazpkgbox/search list_files() { @@ -17,29 +17,50 @@ [ "$pkg" = "0" ] && continue version=$(grep -hs "^$pkg " /var/lib/tazpkg/packages.desc \ /var/lib/tazpkg/undigest/*/packages.desc | awk '{ print $3 }') - echo "$pkg|$version|$file" + if [ -d /var/lib/tazpkg/installed/$pkg ]; then + if [ -f $file ]; then + echo "txt|$pkg|$version|$file" + elif [ -d $file ] ; then + echo "folder|$pkg|$version|$file" + elif [ -x $file ]; then + echo "exec|$pkg|$version|$file" + else + # Missing installed file. + echo "dialog-warning|$pkg|$version|$file" + fi + else + echo "tazpkg|$pkg|$version|$file" + fi done } -if [ "$1" = "--files" ]; then - tazpkg search-file "$SEARCH" | list_files > \ - /tmp/tazpkgbox/search-installed - tazpkg search-file "$SEARCH" --mirror | list_files > \ - /tmp/tazpkgbox/search-mirrored - exit 0 -fi +search_package() +{ + IFS="|" + cat /var/lib/tazpkg/packages.desc \ + /var/lib/tazpkg/undigest/*/packages.desc 2> /dev/null | sort | \ + while read PACKAGE VERSION SHORT_DESC; do + if echo "$PACKAGE $SHORT_DESC" | grep -q "$SEARCH"; then + if [ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ]; then + . /var/lib/tazpkg/installed/${PACKAGE%% *}/receipt + echo "tazpkg-installed|$PACKAGE|$VERSION|$SHORT_DESC" + else + echo "tazpkg|$PACKAGE|$VERSION|$SHORT_DESC" + fi + fi + done + unset IFS +} -# Search installed. -for i in `ls /var/lib/tazpkg/installed` -do - . /var/lib/tazpkg/installed/$i/receipt - if echo "$PACKAGE $SHORT_DESC" | grep -q "$SEARCH"; then - echo "$PACKAGE|$VERSION|$SHORT_DESC" >> /tmp/tazpkgbox/search-installed - fi -done +case "$1" in + files) + tazpkg search-file "$SEARCH" --mirror | list_files > \ + /tmp/tazpkgbox/search ;; + packages) + search_package > /tmp/tazpkgbox/search ;; + *) + echo "Usage: $0 [packages|files]" ;; +esac -# Search mirrored. -grep -sh "$SEARCH" /var/lib/tazpkg/packages.desc \ - /var/lib/tazpkg/undigest/*/packages.desc | sort > /tmp/tazpkgbox/search-mirrored exit 0 diff -r dd48da6e9023 -r d689a99ecd2d pixmaps/tazpkg-installed.png Binary file pixmaps/tazpkg-installed.png has changed diff -r dd48da6e9023 -r d689a99ecd2d tazpkgbox --- a/tazpkgbox Sat Feb 21 22:16:34 2009 +0100 +++ b/tazpkgbox Wed Feb 25 22:03:25 2009 +0100 @@ -28,8 +28,7 @@ echo "all" > /tmp/tazpkgbox/status echo "all" > /tmp/tazpkgbox/category echo "all" > /tmp/tazpkgbox/undigest-category -echo "" > /tmp/tazpkgbox/search-installed -echo "" > /tmp/tazpkgbox/search-mirrored +echo "" > /tmp/tazpkgbox/search # English/French help dialod. export HELP=' @@ -233,28 +232,15 @@ - + 620120 - RESULT_INSTALLED + RESULT - cat /tmp/tazpkgbox/search-installed - echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg + cat /tmp/tazpkgbox/search + echo "$RESULT" > /tmp/tazpkgbox/pkg $LIB/package_infos $LIB/search - refresh:RESULT_INSTALLED - refresh:PKG - refresh:PKG_STATS - refresh:CACHE_STATS - - - 620120 - RESULT_MIRROR - - cat /tmp/tazpkgbox/search-mirrored - echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg - $LIB/package_infos - $LIB/search - refresh:RESULT_INSTALLED + refresh:RESULT refresh:PKG refresh:PKG_STATS refresh:CACHE_STATS @@ -264,18 +250,16 @@ SEARCH