wok-4.x rev 5822

tazpkg-web: check CATEGORY page
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 15 14:33:06 2010 +0200 (2010-07-15)
parents 10b6139512a5
children 93b7952261f9
files tazpkg-web/stuff/search.cgi
line diff
     1.1 --- a/tazpkg-web/stuff/search.cgi	Thu Jul 15 14:22:49 2010 +0200
     1.2 +++ b/tazpkg-web/stuff/search.cgi	Thu Jul 15 14:33:06 2010 +0200
     1.3 @@ -232,8 +232,8 @@
     1.4  	<meta name="modified" content="$DATE" />
     1.5  	<meta name="author" content="ash, awk, grep, sed and cat"/>
     1.6  	<meta name="publisher" content="www.slitaz.org" />
     1.7 -	<link rel="shortcut icon" href="http://pkgs.slitaz.org/favicon.ico" />
     1.8 -	<link rel="stylesheet"  type="text/css" href="http://pkgs.slitaz.org/slitaz.css" />
     1.9 +	<link rel="shortcut icon" href="/favicon.ico" />
    1.10 +	<link rel="stylesheet"  type="text/css" href="/slitaz.css" />
    1.11  </head>
    1.12  <body bgcolor="#ffffff">
    1.13  
    1.14 @@ -247,7 +247,7 @@
    1.15  	<a href="http://labs.slitaz.org/" title="SliTaz laboratories">Labs</a>
    1.16  </div>
    1.17  	<a href="http://pkgs.slitaz.org/"><img id="logo"
    1.18 -	src="http://pkgs.slitaz.org/pics/website/logo.png" title="pkgs.slitaz.org" alt="pkgs.slitaz.org"
    1.19 +	src="/pics/website/logo.png" title="pkgs.slitaz.org" alt="pkgs.slitaz.org"
    1.20  	style="border: 0px solid ; width: 200px; height: 74px;" /></a>
    1.21  	<p id="titre">#!/tazpkg/packages</p>
    1.22  </div>
    1.23 @@ -286,7 +286,7 @@
    1.24  <div id="bottom">
    1.25  <p>
    1.26  <a href="http://validator.w3.org/check?uri=referer"><img
    1.27 -	src="http://pkgs.slitaz.org/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
    1.28 +	src="/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
    1.29  	title="Code validé XHTML 1.0"
    1.30  	style="width: 80px; height: 15px;" /></a>
    1.31  </p>
    1.32 @@ -304,6 +304,19 @@
    1.33         grep installed | sed 's/.*(\(.*\) installed.*/(\1) /'
    1.34  }
    1.35  
    1.36 +package_entry()
    1.37 +{
    1.38 +if [ -s "$(dirname $0)/$SLITAZ_VERSION/$CATEGORY.html" ]; then
    1.39 +	cat << _EOT_
    1.40 +<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.41 +_EOT_
    1.42 +else
    1.43 +	cat << _EOT_
    1.44 +<a href="http://mirror.slitaz.org/packages/$SLITAZ_VERSION/$PACKAGE-$VERSION$EXTRA_VERSION.tazpkg">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.45 +_EOT_
    1.46 +fi
    1.47 +}
    1.48 +
    1.49  # recursive dependencies scan
    1.50  dep_scan()
    1.51  {
    1.52 @@ -316,9 +329,7 @@
    1.53  		echo -n "$2"
    1.54  		(
    1.55  		. $WOK/$i/receipt
    1.56 -		cat << _EOT_
    1.57 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.58 -_EOT_
    1.59 +		package_entry
    1.60  		)
    1.61  	fi
    1.62  	[ -f $WOK/$i/receipt ] || continue
    1.63 @@ -365,8 +376,9 @@
    1.64  }
    1.65  ' | while read pkg; do
    1.66  		. $WOK/${pkg##*/}/receipt
    1.67 +		package_entry
    1.68  		cat << _EOT_
    1.69 -$(echo ${pkg%/*} | sed 's|/| |g') <a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.70 +$(echo ${pkg%/*} | sed 's|/| |g') $(package_entry) 
    1.71  _EOT_
    1.72  done
    1.73  }
    1.74 @@ -396,10 +408,8 @@
    1.75  	pkg=${pkg%:}
    1.76  	if [ "$pkg" != "$last" ]; then
    1.77  		. $WOK/$pkg/receipt
    1.78 -		cat << _EOT_
    1.79 -
    1.80 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.81 -_EOT_
    1.82 +		
    1.83 +		package_entry
    1.84  		last=$pkg
    1.85  	fi
    1.86  	echo "    $file"
    1.87 @@ -494,9 +504,7 @@
    1.88  					continue
    1.89  				fi
    1.90  				. $WOK/$dep/receipt
    1.91 -				cat << _EOT_
    1.92 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
    1.93 -_EOT_
    1.94 +				package_entry
    1.95  			done
    1.96  			cat << _EOT_
    1.97  </pre>
    1.98 @@ -508,9 +516,7 @@
    1.99  				BUILD_DEPENDS=""
   1.100  				. $dep
   1.101  				echo " $BUILD_DEPENDS " | grep -q " $SEARCH " &&
   1.102 -				cat << _EOT_
   1.103 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
   1.104 -_EOT_
   1.105 +				package_entry
   1.106  			done
   1.107  			cat << _EOT_
   1.108  </pre>
   1.109 @@ -552,7 +558,7 @@
   1.110  				. $WOK/$last/receipt
   1.111  				cat << _EOT_
   1.112  
   1.113 -<i><b><a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a></b> $SHORT_DESC</i>
   1.114 +<i>$(package_entry)</i>
   1.115  _EOT_
   1.116  				)
   1.117  			fi
   1.118 @@ -587,9 +593,7 @@
   1.119  			grep -i $SEARCH $PACKAGES_REPOSITORY/packages.desc | \
   1.120  			sort | while read pkg extras ; do
   1.121  				. $WOK/$pkg/receipt
   1.122 -				cat << _EOT_
   1.123 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
   1.124 -_EOT_
   1.125 +				package_entry
   1.126  			done
   1.127  		fi
   1.128  	elif [ "$OBJECT" = "Tags" ]; then
   1.129 @@ -602,9 +606,7 @@
   1.130  		grep ^TAGS= $WOK/*/receipt |  grep -i $SEARCH | \
   1.131  		sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do
   1.132  				. $WOK/$pkg/receipt
   1.133 -				cat << _EOT_
   1.134 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
   1.135 -_EOT_
   1.136 +				package_entry
   1.137  			done
   1.138  	elif [ "$OBJECT" = "Receipt" ]; then
   1.139  		package_exist $SEARCH && cat << _EOT_
   1.140 @@ -631,7 +633,7 @@
   1.141  			DESC=" <a href=\"?desc=$pkg\">description</a>"
   1.142  			[ -f $WOK/$pkg/description.txt ] || DESC=""
   1.143  			cat << _EOT_
   1.144 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC$DESC
   1.145 +$(package_entry)$DESC
   1.146  _EOT_
   1.147  		done
   1.148  		equiv=$PACKAGES_REPOSITORY/packages.equiv
   1.149 @@ -645,9 +647,7 @@
   1.150  _EOT_
   1.151  			for pkg in $(grep $vpkg= $equiv | sed "s/$vpkg=//"); do
   1.152  				. $WOK/${pkg#*:}/receipt
   1.153 -				cat << _EOT_
   1.154 -<a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
   1.155 -_EOT_
   1.156 +				package_entry
   1.157  			done
   1.158  		done
   1.159  	fi