tazpkg rev 100

tazpkgbox: add search files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 22 20:20:24 2008 +0000 (2008-05-22)
parents 404417fa9f93
children 37357de247a3
files lib/tazpkgbox/search tazpkgbox
line diff
     1.1 --- a/lib/tazpkgbox/search	Thu May 22 19:08:09 2008 +0000
     1.2 +++ b/lib/tazpkgbox/search	Thu May 22 20:20:24 2008 +0000
     1.3 @@ -7,6 +7,23 @@
     1.4  rm -f /tmp/tazpkgbox/search-installed
     1.5  touch /tmp/tazpkgbox/search-installed
     1.6  
     1.7 +list_files()
     1.8 +{
     1.9 +	sed 's/.\[[01]m//g' | awk 'BEGIN { show=0 } {
    1.10 +		if (/^===/) show=1-show;
    1.11 +		else if (/^Package/) pkg=$2;
    1.12 +		else if ($0 != "" && show != 0) printf("%s||%s\n",pkg,$0);
    1.13 +	}'
    1.14 +}
    1.15 +
    1.16 +if [ "$1" = "--files" ]; then
    1.17 +	tazpkg search-file "$SEARCH" | list_files > \
    1.18 +		/tmp/tazpkgbox/search-installed
    1.19 +	tazpkg search-file "$SEARCH" --files | list_files > \
    1.20 +		/tmp/tazpkgbox/search-mirrored
    1.21 +	exit 0
    1.22 +fi
    1.23 +
    1.24  # Search installed.
    1.25  for i in `ls /var/lib/tazpkg/installed`
    1.26  do
     2.1 --- a/tazpkgbox	Thu May 22 19:08:09 2008 +0000
     2.2 +++ b/tazpkgbox	Thu May 22 20:20:24 2008 +0000
     2.3 @@ -187,7 +187,7 @@
     2.4  		<tree icon="tazpkg">
     2.5  			<width>580</width><height>120</height>
     2.6  			<variable>RESULT_INSTALLED</variable>
     2.7 -			<label>Installed packages|Version|Description</label>
     2.8 +			<label>Installed packages|Version|Description / File</label>
     2.9  			<input>cat /tmp/tazpkgbox/search-installed</input>
    2.10  			<action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
    2.11  			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
    2.12 @@ -200,7 +200,7 @@
    2.13  		<tree icon="tazpkg">
    2.14  			<width>580</width><height>120</height>
    2.15  			<variable>RESULT_MIRROR</variable>
    2.16 -			<label>Mirrored packages|Version|Description</label>
    2.17 +			<label>Mirrored packages|Version|Description / File</label>
    2.18  			<input>cat /tmp/tazpkgbox/search-mirrored</input>
    2.19  			<action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
    2.20  			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
    2.21 @@ -215,12 +215,19 @@
    2.22  				<variable>SEARCH</variable>
    2.23  			</entry>
    2.24  			<button>
    2.25 -				<label>Search</label>
    2.26 +				<label>Search Packages</label>
    2.27  				<input file icon="system-search"></input>
    2.28  				<action>/usr/lib/slitaz/tazpkgbox/search</action>
    2.29  				<action>refresh:RESULT_INSTALLED</action>
    2.30  				<action>refresh:RESULT_MIRROR</action>
    2.31  			</button>
    2.32 +			<button>
    2.33 +				<label>Search Files</label>
    2.34 +				<input file icon="system-search"></input>
    2.35 +				<action>/usr/lib/slitaz/tazpkgbox/search --files</action>
    2.36 +				<action>refresh:RESULT_INSTALLED</action>
    2.37 +				<action>refresh:RESULT_MIRROR</action>
    2.38 +			</button>
    2.39  		</hbox>
    2.40  	</vbox>
    2.41