slitaz-forge annotate pkgs/mirror-search.sh @ rev 370

mirror-search.sh: add license cloud
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jun 04 17:02:27 2013 +0200 (2013-06-04)
parents b4c0f3e369f9
children eb03961adce3
rev   line source
pascal@316 1 #!/bin/sh
pascal@321 2
pascal@316 3 # Tiny CGI search engine for SliTaz packages on http://pkgs.slitaz.org/
pascal@316 4 # Christophe Lincoln <pankso@slitaz.org>
pascal@321 5 # Pascal Bellard <pascal.bellard@slitaz.org>
pascal@316 6 # Aleksej Bobylev <al.bobylev@gmail.com>
pascal@316 7 #
pascal@316 8
pascal@321 9 renice -n 19 $$
pascal@321 10
pascal@316 11 # Parse query string
pascal@316 12 . /usr/lib/slitaz/httphelper.sh
pascal@316 13
pascal@360 14 case "$HTTP_USER_AGENT" in
pascal@360 15 */[Bb]ot*|*[Bb]ot/*|*spider/*) exec $PWD/Travaux.sh ;;
pascal@360 16 esac
pascal@316 17
pascal@316 18 # User preferred language
pascal@316 19 # parameter $1 have priority; without parameter $1 - browser language only
pascal@316 20 # if we don't support any of user languages (or only en), then return C locale
pascal@316 21 user_lang() {
pascal@316 22 LANG="C"
pascal@316 23 IFS=","
pascal@316 24 for lang in $1 $HTTP_ACCEPT_LANGUAGE
pascal@316 25 do
pascal@316 26 lang=${lang%;*} lang=${lang# } lang=${lang%-*} lang=${lang%_*}
pascal@316 27 case "$lang" in
pascal@316 28 de) LANG="de_DE" ;;
pascal@316 29 es) LANG="es_ES" ;;
pascal@316 30 fr) LANG="fr_FR" ;;
pascal@316 31 it) LANG="it_IT" ;;
pascal@316 32 pt) LANG="pt_BR" ;;
pascal@316 33 ru) LANG="ru_RU" ;;
pascal@316 34 zh) LANG="zh_TW" ;;
pascal@316 35 esac
pascal@316 36 if echo "de en fr pt ru zh" | fgrep -q "$lang"; then
pascal@316 37 break
pascal@316 38 fi
pascal@316 39 done
pascal@316 40 unset IFS
pascal@316 41 echo "$LANG"
pascal@316 42 }
pascal@316 43
pascal@316 44 # Short 2-letter lang code from ll_CC
pascal@316 45 ll_lang() {
pascal@316 46 ll_CC="$1"
pascal@316 47 echo ${ll_CC%_*}
pascal@316 48 }
pascal@316 49
pascal@316 50 # Nice URL replacer - to copy url from address bar
pascal@316 51 # TODO: deal with POST method of form submitting
pascal@316 52 nice_url() {
pascal@316 53 # if user submitted a form
pascal@316 54 if [ ! -z $(GET submit) ]; then
pascal@316 55 OBJECT="$(GET object)"
pascal@316 56 SEARCH="$(GET query)"
pascal@316 57 case $OBJECT in
pascal@316 58 Package) NICE="package=$SEARCH";;
pascal@316 59 Desc) NICE="desc=$SEARCH";;
pascal@316 60 Tags) NICE="tags=$SEARCH";;
pascal@331 61 Arch) NICE="arch=$SEARCH";;
pascal@333 62 Bugs) NICE="bugs=$SEARCH";;
pascal@316 63 Receipt) NICE="receipt=$SEARCH";;
pascal@316 64 Depends) NICE="depends=$SEARCH";;
pascal@316 65 BuildDepends) NICE="builddepends=$SEARCH";;
pascal@316 66 File) NICE="file=$SEARCH";;
pascal@316 67 File_list) NICE="filelist=$SEARCH";;
pascal@316 68 FileOverlap) NICE="fileoverlap=$SEARCH";;
pascal@316 69 esac
pascal@316 70 # version, if needed
pascal@316 71 version="$(GET version)"
pascal@316 72 if [ ! -z "$version" -a "$version" != "cooking" ]; then
pascal@316 73 NICE="${NICE}&version=${version:0:1}"
pascal@316 74 fi
pascal@316 75 # lang, if needed
pascal@316 76 query_lang="$(GET lang)"
pascal@316 77 pref_lang="$(user_lang)"
pascal@316 78 browser_lang="$(ll_lang $pref_lang)"
pascal@316 79 if [ ! -z "$query_lang" -a "$query_lang" != "$browser_lang" ]; then
pascal@316 80 NICE="${NICE}&lang=$query_lang"
pascal@316 81 fi
pascal@316 82 # verbose, if needed
pascal@316 83 verboseq="$(GET verbose)"
pascal@316 84 if [ ! -z "$verboseq" -a "$verboseq" != "0" ]; then
pascal@316 85 NICE="${NICE}&verbose=1"
pascal@316 86 fi
pascal@316 87 # redirect
pascal@316 88 # TODO: implement HTTP 301 Redirect
pascal@316 89 cat << EOT
pascal@316 90 Content-type: text/html
pascal@316 91
pascal@316 92 <!DOCTYPE html>
pascal@316 93 <html><head><meta http-equiv="refresh" content="0;url=$SCRIPT_NAME?$NICE" />
pascal@316 94 <title>Redirect</title></head></html>
pascal@316 95 EOT
pascal@316 96 # echo "Location: $SCRIPT_NAME?$NICE"
pascal@316 97 # echo
pascal@316 98 exit 0
pascal@316 99 fi
pascal@316 100 }
pascal@316 101
pascal@316 102 nice_url
pascal@316 103
pascal@316 104
pascal@316 105
pascal@316 106 OBJECT="$(GET object)"
pascal@316 107 SEARCH="$(GET query)"
pascal@316 108 SLITAZ_VERSION="$(GET version)"
pascal@316 109 VERBOSE="$(GET verbose)"
pascal@316 110
pascal@316 111 # Internal variables
pascal@316 112 #DATE=$(date +%Y-%m-%d\ %H:%M:%S)
pascal@316 113
pascal@316 114 # Internationalization
pascal@316 115 . /usr/bin/gettext.sh
pascal@316 116 export TEXTDOMAIN='tazpkg-web'
pascal@316 117
pascal@316 118 SEARCH=""
pascal@316 119 VERBOSE=0
pascal@316 120 for i in $(echo $QUERY_STRING | sed 's/[?&]/ /g'); do
pascal@316 121 # SLITAZ_VERSION=cooking
pascal@316 122 case "$(echo $i | tr [A-Z] [a-z])" in
pascal@316 123 query=*|search=*) [ ${i#*=} == Search ] || SEARCH=${i#*=};;
pascal@316 124 object=*) OBJECT=${i#*=};;
pascal@316 125 verbose=*) VERBOSE=${i#*=};;
pascal@316 126 lang=*) LANG=${i#*=};;
pascal@316 127 file=*) SEARCH=${i#*=}; OBJECT=File;;
pascal@316 128 desc=*) SEARCH=${i#*=}; OBJECT=Desc;;
pascal@316 129 tags=*) SEARCH=${i#*=}; OBJECT=Tags;;
pascal@331 130 arch=*) SEARCH=${i#*=}; OBJECT=Arch;;
pascal@333 131 bugs=*) SEARCH=${i#*=}; OBJECT=Bugs;;
pascal@316 132 receipt=*) SEARCH=${i#*=}; OBJECT=Receipt;;
pascal@316 133 filelist=*) SEARCH=${i#*=}; OBJECT=File_list;;
pascal@316 134 package=*) SEARCH=${i#*=}; OBJECT=Package;;
pascal@316 135 depends=*) SEARCH=${i#*=}; OBJECT=Depends;;
pascal@316 136 builddepends=*) SEARCH=${i#*=}; OBJECT=BuildDepends;;
pascal@316 137 fileoverlap=*) SEARCH=${i#*=}; OBJECT=FileOverlap;;
pascal@316 138 category=*) SEARCH=${i#*=}; OBJECT=Category;;
pascal@316 139 maintainer=*) SEARCH=${i#*=}; OBJECT=Maintainer;;
pascal@370 140 license=*) SEARCH=${i#*=}; OBJECT=License;;
pascal@316 141 version=[1-9]*) i=${i%%.*}; SLITAZ_VERSION=${i#*=}.0;;
pascal@316 142 version=s*|version=4*) SLITAZ_VERSION=stable;;
pascal@316 143 version=u*) SLITAZ_VERSION=undigest;;
pascal@316 144 version=t*) SLITAZ_VERSION=tiny;;
pascal@316 145 esac
pascal@316 146 done
pascal@316 147 [ -z "$SLITAZ_VERSION" ] && SLITAZ_VERSION=cooking
pascal@316 148 #[ -n "$SEARCH" ] && REQUEST_METHOD="POST"
pascal@316 149 #[ "$SEARCH" == "." ] && SEARCH=
pascal@316 150
pascal@316 151
pascal@316 152 # Content negotiation for Gettext
pascal@316 153 LANG=$(user_lang $(GET lang))
pascal@316 154 lang="$(ll_lang $LANG)"
pascal@316 155 export LANG LC_ALL=$LANG
pascal@316 156
pascal@316 157
pascal@316 158 case "$OBJECT" in
pascal@316 159 File) selected_file="selected";;
pascal@316 160 Desc) selected_desc="selected";;
pascal@316 161 Tags) selected_tags="selected";;
pascal@331 162 Arch) selected_arch="selected";;
pascal@333 163 Bugs) selected_bugs="selected";;
pascal@316 164 Receipt) selected_receipt="selected";;
pascal@316 165 File_list) selected_file_list="selected";;
pascal@316 166 Depends) selected_depends="selected";;
pascal@316 167 BuildDepends) selected_build_depends="selected";;
pascal@316 168 FileOverlap) selected_overlap="selected";;
pascal@316 169 esac
pascal@316 170
pascal@316 171 case "$SLITAZ_VERSION" in
pascal@316 172 tiny) selected_tiny="selected";;
pascal@316 173 1.0) selected_1="selected";;
pascal@316 174 2.0) selected_2="selected";;
pascal@316 175 3.0) selected_3="selected";;
pascal@316 176 stable) selected_stable="selected";;
pascal@316 177 undigest) selected_undigest="selected";;
pascal@316 178 esac
pascal@316 179
pascal@316 180 # unescape query
pascal@316 181 SEARCH="$(echo $SEARCH | sed 's/%2B/+/g; s/%3A/:/g; s|%2F|/|g')"
pascal@316 182
pascal@316 183 WOK=/home/slitaz/$SLITAZ_VERSION/wok
pascal@316 184 PACKAGES_REPOSITORY=/home/slitaz/$SLITAZ_VERSION/packages
pascal@316 185
pascal@316 186
pascal@316 187 # TODO: header function from httphelper
pascal@316 188 echo "Content-type: text/html"
pascal@316 189 echo
pascal@316 190
pascal@316 191 # Search form
pascal@316 192 # TODO: implement POST method
pascal@316 193 # ... method="post" enctype="multipart/form-data" ...
pascal@316 194 # TODO: add hint 'You are can search for depends loop, if textfield is empty'...
pascal@316 195 # add progress ticker while page is not complete
pascal@316 196 search_form()
pascal@316 197 {
pascal@316 198 cat << _EOT_
pascal@316 199
pascal@316 200 <form id="s_form" method="get" action="$SCRIPT_NAME">
pascal@316 201 <input type="hidden" name="lang" value="$lang" />
pascal@316 202 <select name="object">
pascal@316 203 <option value="Package">$(gettext "Package")</option>
pascal@316 204 <option $selected_desc value="Desc">$(gettext "Description")</option>
pascal@316 205 <option $selected_tags value="Tags">$(gettext "Tags")</option>
pascal@331 206 <!-- option $selected_arch value="Tags">$(gettext "Arch")</option -->
pascal@333 207 <!-- option $selected_bugs value="Bugs">$(gettext "Bugs")</option -->
pascal@316 208 <option $selected_receipt value="Receipt">$(gettext "Receipt")</option>
pascal@316 209 <option $selected_depends value="Depends">$(gettext "Depends")</option>
pascal@316 210 <option $selected_build_depends value="BuildDepends">$(gettext "Build depends")</option>
pascal@316 211 <option $selected_file value="File">$(gettext "File")</option>
pascal@316 212 <option $selected_file_list value="File_list">$(gettext "File list")</option>
pascal@316 213 <option $selected_overlap value="FileOverlap">$(gettext "common files")</option>
pascal@316 214 </select>
pascal@316 215 <input type="text" name="query" id="query" size="20" value="$SEARCH" />
pascal@316 216 <select name="version">
pascal@316 217 <option value="cooking">$(gettext "cooking")</option>
pascal@316 218 <option $selected_stable value="stable">4.0</option>
pascal@316 219 <option $selected_3 value="3.0">3.0</option>
pascal@316 220 <option $selected_2 value="2.0">2.0</option>
pascal@316 221 <option $selected_1 value="1.0">1.0</option>
pascal@316 222 <option $selected_tiny value="tiny">$(gettext "tiny")</option>
pascal@316 223 <option $selected_undigest value="undigest">$(gettext "undigest")</option>
pascal@316 224 </select>
pascal@316 225 <input type="submit" name="submit" value="$(gettext 'Search')" />
pascal@316 226 </form>
pascal@316 227 _EOT_
pascal@316 228 }
pascal@316 229
pascal@316 230 # xHTML5 Header.
pascal@316 231 xhtml_header() {
pascal@316 232 . lib/header.sh
pascal@316 233 }
pascal@316 234
pascal@321 235 cat_files_list()
pascal@321 236 {
pascal@321 237 local tmp=/tmp/files.list.$(basename ${1%/packages})
pascal@321 238 if [ ! -s $tmp -o $1/files.list.lzma -nt $tmp ]; then
pascal@321 239 unlzma -c $1/files.list.lzma > $tmp.$$ && mv $tmp.$$ $tmp
pascal@321 240 fi
pascal@321 241 case "$2" in
pascal@321 242 lines) if [ ! -s $tmp.lines -o $tmp -nt $tmp.lines ]; then
pascal@321 243 cat $tmp | wc -l > $tmp.lines.$$ &&
pascal@321 244 mv $tmp.lines.$$ $tmp.lines
pascal@321 245 fi
pascal@321 246 cat $tmp.lines ;;
pascal@321 247 *) cat $tmp ;;
pascal@321 248 esac
pascal@321 249 }
pascal@321 250
pascal@316 251 # xHTML Footer.
pascal@316 252 # TODO: caching the summary for 5 minutes
pascal@316 253 xhtml_footer() {
pascal@370 254 file=/tmp/footer-$SLITAZ_VERSION
pascal@370 255 [ ! -e $file -o $PACKAGES_REPOSITORY/packages.txt -nt $file ] &&
pascal@370 256 cat > $file.$$ <<EOT && mv -f $file.$$ $file
pascal@370 257 PKGS=$(ls $WOK/ | wc -l)
pascal@370 258 FILES=$(cat_files_list $PACKAGES_REPOSITORY lines)
pascal@370 259 EOT
pascal@370 260 PKGS=$(sed '/PKGS=/!d;s/PKGS=//' $file)
pascal@370 261 FILES=$(sed '/FILES=/!d;s/FILES=//' $file)
pascal@316 262 . lib/footer.sh
pascal@316 263 }
pascal@316 264
pascal@316 265 installed_size()
pascal@316 266 {
pascal@316 267 if [ $VERBOSE -gt 0 ]; then
pascal@316 268 inst=$(grep -A 3 "^$1\$" $PACKAGES_REPOSITORY/packages.txt | grep installed)
pascal@316 269 # size=$(echo $inst | cut -d'(' -f2 | cut -d' ' -f1)
pascal@316 270 echo $inst | sed 's/.*(\(.*\).*/(\1)/'
pascal@316 271 # echo $size
pascal@316 272 # | sed 's/.*(\(.*\) installed.*/(\1) /'
pascal@316 273 fi
pascal@316 274 }
pascal@316 275
pascal@316 276 package_entry()
pascal@316 277 {
pascal@316 278 if [ -s "$(dirname $0)/$SLITAZ_VERSION/$CATEGORY.html" ]; then
pascal@316 279 cat << _EOT_
pascal@316 280 <a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
pascal@316 281 _EOT_
pascal@316 282 else
pascal@316 283 PACKAGE_HREF="<u>$PACKAGE</u>"
pascal@316 284 PACKAGE_URL="http://mirror.slitaz.org/packages/$SLITAZ_VERSION/$PACKAGE-$VERSION$EXTRA_VERSION.tazpkg"
pascal@316 285 nslookup mirror.slitaz.org | grep -q 127.0.0.1 &&
pascal@316 286 [ -d /var/www/slitaz/mirror/packages/$SLITAZ_VERSION/$PACKAGE-$VERSION ] &&
pascal@316 287 PACKAGE_URL="http://mirror.slitaz.org/packages/$SLITAZ_VERSION/$PACKAGE-$VERSION" ||
pascal@316 288 PACKAGE_URL="http://mirror.slitaz.org/packages/$SLITAZ_VERSION/$(cd /var/www/slitaz/mirror/packages/$SLITAZ_VERSION ; ls $PACKAGE-$VERSION*.tazpkg)"
pascal@316 289 busybox wget -s $PACKAGE_URL 2> /dev/null &&
pascal@316 290 PACKAGE_HREF="<a href=\"$PACKAGE_URL\">$PACKAGE</a>"
pascal@360 291 COOKER=""
pascal@370 292 [ "$SLITAZ_VERSION" == "cooking" ] &&
pascal@360 293 COOKER="<a href=\"http://cook.slitaz.org/cooker.cgi?pkg=$PACKAGE\">$(gettext "Cooker")</a>"
pascal@316 294 cat << _EOT_
pascal@331 295 $PACKAGE_HREF $(installed_size $PACKAGE): $SHORT_DESC \
pascal@360 296 <a href="?receipt=$PACKAGE&amp;version=$SLITAZ_VERSION">$(gettext "Receipt")</a> $COOKER
pascal@316 297 _EOT_
pascal@316 298 fi
pascal@316 299 [ -n "$(GET debug)" ] && cat << _EOT_
pascal@316 300 <pre>
pascal@316 301 PACKAGE=$PACKAGE
pascal@316 302 VERSION=$VERSION
pascal@316 303 EXTRAVERSION=$EXTRAVERSION
pascal@316 304 SLITAZ_VERSION=$SLITAZ_VERSION
pascal@316 305 PACKAGE_URL=$PACKAGE_URL
pascal@316 306 $(cd /var/www/slitaz/mirror/packages/$SLITAZ_VERSION ; ls -l $PACKAGE*)
pascal@316 307 </pre>
pascal@316 308 _EOT_
pascal@316 309 }
pascal@316 310
pascal@316 311 # Show loop in depends/build_depends chains
pascal@316 312 show_loops()
pascal@316 313 {
pascal@316 314 awk '
pascal@316 315 function chkloop(pkg, i, n)
pascal@316 316 {
pascal@316 317 if (n < 8)
pascal@316 318 for (i = 1; i <= split(deps[pkg],curdep," "); i++) {
pascal@316 319 if (curdep[i] == base || chkloop(curdep[i], 0, n+1)) {
pascal@316 320 split(deps[pkg],curdep," ")
pascal@316 321 p = curdep[i] " " p
pascal@316 322 return 1
pascal@316 323 }
pascal@316 324 }
pascal@316 325 return 0
pascal@316 326 }
pascal@316 327 {
pascal@316 328 for (i = 2; i <= NF; i++)
pascal@316 329 deps[$1] = deps[$1] " " $i
pascal@316 330 }
pascal@316 331 END {
pascal@316 332 for (pkg in deps) {
pascal@316 333 base = pkg
pascal@316 334 p = ""
pascal@316 335 if (chkloop(pkg, 0, 0))
pascal@316 336 print pkg " " p
pascal@316 337 #print pkg " : " p "..."
pascal@316 338 }
pascal@316 339 }' | while read line; do
pascal@316 340 set -- $line
pascal@316 341 case " $last " in
pascal@316 342 *\ $1\ *) continue
pascal@316 343 esac
pascal@316 344 last="$line"
pascal@316 345 pkg=$1
pascal@316 346 shift
pascal@316 347 echo "<strong>$pkg </strong>: $@ ..."
pascal@316 348 done
pascal@316 349 }
pascal@316 350
pascal@316 351 # recursive dependencies scan
pascal@316 352 dep_scan()
pascal@316 353 {
pascal@316 354 for i in $1; do
pascal@316 355 case " $ALL_DEPS " in
pascal@316 356 *\ $i\ *) continue;;
pascal@316 357 esac
pascal@316 358 ALL_DEPS="$ALL_DEPS $i"
pascal@316 359 if [ -n "$2" ]; then
pascal@316 360 echo -n "$2"
pascal@316 361 (
pascal@316 362 . $WOK/$i/receipt
pascal@316 363 package_entry
pascal@316 364 )
pascal@316 365 fi
pascal@316 366 [ -f $WOK/$i/receipt ] || continue
pascal@316 367 DEPENDS=""
pascal@316 368 BUILD_DEPENDS=""
pascal@316 369 WANTED=""
pascal@316 370 . $WOK/$i/receipt
pascal@316 371 if [ -n "$3" ]; then
pascal@316 372 [ -n "$BUILD_DEPENDS$WANTED" ] &&
pascal@316 373 dep_scan "$WANTED $BUILD_DEPENDS" "$2 " $3
pascal@316 374 else
pascal@316 375 [ -n "$DEPENDS" ] && dep_scan "$DEPENDS" "$2 "
pascal@316 376 fi
pascal@316 377 done
pascal@316 378 }
pascal@316 379
pascal@316 380 # recursive reverse dependencies scan
pascal@316 381 rdep_scan()
pascal@316 382 {
pascal@316 383 SEARCH=$1
pascal@316 384 case "$SEARCH" in
pascal@316 385 glibc-base|gcc-lib-base)
pascal@316 386 $(gettext " glibc-base and gcc-lib-base are implicit dependencies,
pascal@316 387 <b>every</b> package is supposed to depend on them."); echo
pascal@316 388 return;;
pascal@316 389 esac
pascal@316 390 for i in $WOK/* ; do
pascal@316 391 DEPENDS=""
pascal@316 392 BUILD_DEPENDS=""
pascal@316 393 WANTED=""
pascal@316 394 . $i/receipt
pascal@316 395 if [ -n "$2" ]; then
pascal@316 396 echo "$(basename $i) $(echo $WANTED $BUILD_DEPENDS)"
pascal@316 397 else
pascal@316 398 echo "$(basename $i) $(echo $DEPENDS)"
pascal@316 399 fi
pascal@316 400 done | awk -v search=$SEARCH '
pascal@316 401 function show_deps(deps, all_deps, pkg, space)
pascal@316 402 {
pascal@316 403 if (all_deps[pkg] == 1) return
pascal@316 404 all_deps[pkg] = 1
pascal@316 405 if (space != "") printf "%s%s\n",space,pkg
pascal@316 406 for (i = 1; i <= split(deps[pkg], mydeps, " "); i++) {
pascal@316 407 show_deps(deps, all_deps, mydeps[i],"////" space)
pascal@316 408 }
pascal@316 409 }
pascal@316 410
pascal@316 411 {
pascal@316 412 all_deps[$1] = 0
pascal@316 413 for (i = 2; i <= NF; i++)
pascal@316 414 deps[$i] = deps[$i] " " $1
pascal@316 415 }
pascal@316 416
pascal@316 417 END {
pascal@316 418 show_deps(deps, all_deps, search, "")
pascal@316 419 }
pascal@316 420 ' | while read pkg; do
pascal@316 421 . $WOK/${pkg##*/}/receipt
pascal@316 422 cat << _EOT_
pascal@316 423 $(echo ${pkg%/*} | sed 's|/| |g') $(package_entry)
pascal@316 424 _EOT_
pascal@316 425 done
pascal@316 426 }
pascal@316 427
pascal@316 428 # Check package exists
pascal@316 429 package_exist()
pascal@316 430 {
pascal@316 431 [ -f $WOK/$1/receipt ] && return 0
pascal@316 432 cat << _EOT_
pascal@316 433
pascal@316 434 <h3>$(eval_gettext "No package \$SEARCH")</h3>
pascal@316 435 _EOT_
pascal@316 436 return 1
pascal@316 437 }
pascal@316 438
pascal@316 439 # Display < > &
pascal@316 440 htmlize()
pascal@316 441 {
pascal@316 442 sed -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
pascal@316 443 }
pascal@316 444
pascal@331 445 # Create some clickable links
pascal@331 446 urllink()
pascal@331 447 {
pascal@335 448 local tarball_url
pascal@331 449 sedit=""
pascal@331 450 [ -n "$WEB_SITE" ] && sedit="$sedit -e 's|^WEB_SITE=\"\\(.*\\)\"|WEB_SITE=\"<a href=\"$WEB_SITE\">\\1</a>\"|'"
pascal@338 451 [ -n "$WGET_URL" ] && sedit="$sedit -e 's#^WGET_URL=\"\\(.*\\)\"#WGET_URL=\"<a href=\"${WGET_URL##*|}\">\\1</a>\"#'"
pascal@335 452 [ -n "$CATEGORY" ] && sedit="$sedit -e 's|^CATEGORY=\"\\(.*\\)\"|CATEGORY=\"<a href=\"?category=$CATEGORY\\&amp;version=$SLITAZ_VERSION\">\\1</a>\"|'"
pascal@335 453 [ -n "$WANTED" ] && sedit="$sedit -e 's|^WANTED=\"\\(.*\\)\"|WANTED=\"<a href=\"?receipt=$WANTED\\&amp;version=$SLITAZ_VERSION\">\\1</a>\"|'"
pascal@335 454 [ -n "$BUGS" ] && sedit="$sedit -e 's|^BUGS=\"\\(.*\\)\"|BUGS=\"<a href=\"?bugs=$PACKAGE\\&amp;version=$SLITAZ_VERSION\">\\1</a>\"|'"
pascal@335 455 [ -f $WOK/$PACKAGE/description.txt ] && sedit="$sedit -e 's|^SHORT_DESC=\"\\(.*\\)\"|SHORT_DESC=\"<a href=\"?desc=$PACKAGE\\&amp;version=$SLITAZ_VERSION\">\\1</a>\"|'"
pascal@335 456 tarball_url=sources/packages-$SLITAZ_VERSION/${TARBALL:0:1}/$TARBALL
pascal@335 457 [ -f /var/www/slitaz/mirror/$tarball_url ] || case "$tarball_url" in
pascal@335 458 *.gz) tarball_url=${tarball_url%gz}lzma ;;
pascal@335 459 *.tgz) tarball_url=${tarball_url%tgz}tar.lzma ;;
pascal@335 460 *.bz2) tarball_url=${tarball_url%bz2}lzma ;;
pascal@335 461 esac
pascal@335 462 [ -f /var/www/slitaz/mirror/$tarball_url ] && sedit="$sedit -e 's|^TARBALL=\"\\(.*\\)\"|TARBALL=\"<a href=\"http://mirror.slitaz.org/$tarball_url\">\\1</a>\"|'"
pascal@331 463 if [ -n "$HOST_ARCH" ]; then
pascal@331 464 tmp=""
pascal@331 465 for i in $HOST_ARCH ; do
pascal@335 466 tmp="$tmp <a href=\\\"?arch=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>"
pascal@331 467 done
pascal@331 468 sedit="$sedit -e 's|^HOST_ARCH=\".*\"|HOST_ARCH=\"${tmp# }\"|'"
pascal@331 469 fi
pascal@331 470 if [ -n "$TAGS" ]; then
pascal@331 471 tmp=""
pascal@331 472 for i in $TAGS ; do
pascal@335 473 tmp="$tmp <a href=\\\"?tags=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>"
pascal@331 474 done
pascal@331 475 sedit="$sedit -e 's|^TAGS=\".*\"|TAGS=\"${tmp# }\"|'"
pascal@331 476 fi
pascal@332 477 if [ -n "$DEPENDS$BUILD_DEPENDS$SUGGESTED" ]; then
pascal@332 478 for i in $(echo $DEPENDS $BUILD_DEPENDS $SUGGESTED) ; do
pascal@335 479 sedit="$sedit -e 's|\\([\" ]\\)$i\\([\" \\]\\)|\\1<a href=\\\"?package=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>\\2|'"
pascal@335 480 sedit="$sedit -e 's|\\([\" ]\\)$i\$|\\1<a href=\\\"?package=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>|'"
pascal@335 481 sedit="$sedit -e 's|^$i\\([\" \\]\\)|<a href=\\\"?package=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>\\1|'"
pascal@335 482 sedit="$sedit -e 's|^$i\$|<a href=\\\"?package=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>|'"
pascal@331 483 done
pascal@331 484 fi
pascal@331 485 if [ -n "$CONFIG_FILES" ]; then
pascal@331 486 tmp=""
pascal@331 487 for i in $(echo $CONFIG_FILES) ; do
pascal@335 488 tmp="$tmp <a href=\\\"?file=$i\\&amp;version=$SLITAZ_VERSION\\\">$i</a>"
pascal@331 489 done
pascal@331 490 sedit="$sedit -e 's|^CONFIG_FILES=\".*\"|CONFIG_FILES=\"${tmp# }\"|'"
pascal@331 491 fi
pascal@331 492 if [ -n "$PROVIDE" ]; then
pascal@331 493 tmp=""
pascal@331 494 for i in $(echo $PROVIDE) ; do
pascal@335 495 tmp="$tmp <a href=\\\"?package=${i%:*}\\&amp;version=$SLITAZ_VERSION\\\">$i</a>"
pascal@331 496 done
pascal@331 497 sedit="$sedit -e 's|^PROVIDE=\".*\"|PROVIDE=\"${tmp# }\"|'"
pascal@331 498 fi
pascal@331 499 eval sed $sedit \
pascal@331 500 -e "'s|^MAINTAINER=\".*\"|MAINTAINER=\"<a href=\"?maintainer=$MAINTAINER\">$MAINTAINER</a>\"|'" \
pascal@335 501 -e "'s|^genpkg_rules|<a href=\"?filelist=$PACKAGE\\&amp;version=$SLITAZ_VERSION\">&</a>|'"
pascal@331 502 }
pascal@331 503
pascal@316 504 display_packages_and_files()
pascal@316 505 {
pascal@316 506 last=""
pascal@316 507 while read pkg file; do
pascal@316 508 pkg=${pkg%:}
pascal@316 509 if [ "$pkg" != "$last" ]; then
pascal@316 510 . $WOK/$pkg/receipt
pascal@316 511 package_entry
pascal@316 512 last=$pkg
pascal@316 513 fi
pascal@316 514 echo " $file"
pascal@316 515 done
pascal@316 516 }
pascal@316 517
pascal@316 518 build_cloud_cache()
pascal@316 519 {
pascal@316 520 grep -l ^$1= $WOK/*/receipt | while read file; do
pascal@316 521 eval $1=
pascal@316 522 . $file
pascal@316 523 eval echo \$$1
pascal@316 524 done | sed "$2" | awk '
pascal@316 525 {
pascal@316 526 for (i = 1; $i != ""; i++) {
pascal@316 527 count[$i]++
pascal@316 528 }
pascal@316 529 }
pascal@316 530 END {
pascal@316 531 min=10000
pascal@316 532 max=0
pascal@316 533 for (i in count) {
pascal@316 534 if (count[i] < min) min = count[i]
pascal@316 535 if (count[i] > max) max = count[i]
pascal@316 536 }
pascal@316 537 for (i in count)
pascal@316 538 print count[i] " " int((count[i] - min)*100/(max - min)) " " i
pascal@316 539 }' | sort -k 3
pascal@316 540 }
pascal@316 541
pascal@316 542 display_cloud()
pascal@316 543 {
pascal@316 544 echo "<p>"
pascal@316 545 while read cnt pct item ; do
pascal@360 546 pct=$(((10000 - ((100 - $pct)**2))/100))
pascal@360 547 pct=$(((10000 - ((100 - $pct)**2))/100))
pascal@316 548 cat <<EOT
pascal@316 549 <span style="color:#99f; font-size:9pt; padding-left:5px; padding-right:2px;">\
pascal@316 550 $cnt</span><a href="?$1=$item&amp;version=$SLITAZ_VERSION" style="\
pascal@316 551 font-size:$((8+($pct/10)))pt; font-weight:bold; \
pascal@316 552 color:black; text-decoration:none">$(echo $item | sed 's/-/\&minus;/g')</a>
pascal@316 553 EOT
pascal@327 554 done | tee /dev/stderr | printf "</p><p align=right>$2" $(wc -l)
pascal@316 555 echo "</p>"
pascal@316 556 }
pascal@316 557
pascal@316 558 xhtml_header
pascal@316 559
pascal@316 560 #
pascal@316 561 # Handle GET requests
pascal@316 562 #
pascal@316 563 case " $(GET) " in
pascal@316 564 *\ debug\ *|*\ debug*)
pascal@316 565 cat << EOT
pascal@316 566 <h2>Debug info</h2>
pascal@316 567 <pre>$(httpinfo)</pre>
pascal@316 568 <pre>LANG=$LANG;
pascal@316 569 OBJECT=$OBJECT;
pascal@316 570 SEARCH=$SEARCH;
pascal@316 571 SLITAZ_VERSION=$SLITAZ_VERSION;
pascal@316 572 WOK=$WOK;
pascal@316 573 </pre>
pascal@316 574 EOT
pascal@316 575 #$(xhtml_footer)
pascal@316 576 #EOT
pascal@316 577 # exit 0
pascal@316 578 ;;
pascal@316 579 esac
pascal@316 580
pascal@316 581 # Display search form and result if requested.
pascal@316 582 #xhtml_header
pascal@316 583 echo "<h2>$(gettext 'Search for packages')</h2>"
pascal@316 584 search_form
pascal@316 585
pascal@316 586 case "$OBJECT" in
pascal@316 587
pascal@316 588
pascal@316 589 ### Depends loops; [Reverse] Dependency tree [(SUGGESTED)]
pascal@316 590 Depends)
pascal@316 591 if [ -z "$SEARCH" ]; then
pascal@316 592 cat << _EOT_
pascal@316 593
pascal@316 594 <h3>$(gettext "Depends loops")</h3>
pascal@316 595 <pre>
pascal@316 596 _EOT_
pascal@316 597 for i in $WOK/*/receipt; do
pascal@316 598 PACKAGE=
pascal@316 599 DEPENDS=
pascal@316 600 . $i
pascal@316 601 echo "$PACKAGE $(echo $DEPENDS)"
pascal@316 602 done | show_loops
pascal@316 603 cat << _EOT_
pascal@316 604 </pre>
pascal@316 605 _EOT_
pascal@316 606 elif package_exist $SEARCH ; then
pascal@316 607 cat << _EOT_
pascal@316 608
pascal@316 609 <h3>$(eval_gettext "Dependency tree for: \$SEARCH")</h3>
pascal@316 610 <pre>
pascal@316 611 _EOT_
pascal@316 612 ALL_DEPS=""
pascal@316 613 dep_scan $SEARCH ""
pascal@316 614 SUGGESTED=""
pascal@316 615 . $WOK/$SEARCH/receipt
pascal@316 616 if [ -n "$SUGGESTED" ]; then
pascal@316 617 cat << _EOT_
pascal@316 618 </pre>
pascal@316 619
pascal@316 620 <h3>$(eval_gettext "Dependency tree for: \$SEARCH (SUGGESTED)")</h3>
pascal@316 621 <pre>
pascal@316 622 _EOT_
pascal@316 623 ALL_DEPS=""
pascal@316 624 dep_scan "$SUGGESTED" " "
pascal@316 625 fi
pascal@316 626 cat << _EOT_
pascal@316 627 </pre>
pascal@316 628
pascal@316 629 <h3>$(eval_gettext "Reverse dependency tree for: \$SEARCH")</h3>
pascal@316 630 <pre>
pascal@316 631 _EOT_
pascal@316 632 ALL_DEPS=""
pascal@316 633 rdep_scan $SEARCH
pascal@316 634 cat << _EOT_
pascal@316 635 </pre>
pascal@316 636 _EOT_
pascal@316 637 fi
pascal@316 638 ;;
pascal@316 639
pascal@316 640
pascal@316 641 ### Build depends loops; [Reverse] Build dependency tree
pascal@316 642 BuildDepends)
pascal@316 643 if [ -z "$SEARCH" ]; then
pascal@316 644 cat << _EOT_
pascal@316 645
pascal@316 646 <h3>$(gettext "Build depends loops")</h3>
pascal@316 647 <pre>
pascal@316 648 _EOT_
pascal@316 649 for i in $WOK/*/receipt; do
pascal@316 650 PACKAGE=
pascal@316 651 WANTED=
pascal@316 652 BUILD_DEPENDS=
pascal@316 653 . $i
pascal@316 654 echo "$PACKAGE $WANTED $(echo $BUILD_DEPENDS)"
pascal@316 655 done | show_loops
pascal@316 656 cat << _EOT_
pascal@316 657 </pre>
pascal@316 658 _EOT_
pascal@316 659 elif package_exist $SEARCH ; then
pascal@316 660 cat << _EOT_
pascal@316 661
pascal@316 662 <h3>$(eval_gettext "\$SEARCH needs these packages to be built")</h3>
pascal@316 663 <pre>
pascal@316 664 _EOT_
pascal@316 665 ALL_DEPS=""
pascal@316 666 dep_scan $SEARCH "" build
pascal@316 667 cat << _EOT_
pascal@316 668 </pre>
pascal@316 669
pascal@316 670 <h3>$(eval_gettext "Packages who need \$SEARCH to be built")</h3>
pascal@316 671 <pre>
pascal@316 672 _EOT_
pascal@316 673 ALL_DEPS=""
pascal@316 674 rdep_scan $SEARCH build
pascal@316 675 cat << _EOT_
pascal@316 676 </pre>
pascal@316 677 _EOT_
pascal@316 678 fi
pascal@316 679 ;;
pascal@316 680
pascal@316 681
pascal@316 682 ### Common files
pascal@316 683 FileOverlap)
pascal@317 684 if package_exist $SEARCH; then
pascal@316 685 cat << _EOT_
pascal@316 686
pascal@316 687 <h3>$(eval_gettext "These packages may overload files of \$SEARCH")</h3>
pascal@316 688 <pre>
pascal@316 689 _EOT_
pascal@321 690 ( cat_files_list $PACKAGES_REPOSITORY | grep ^$SEARCH: ;
pascal@321 691 cat_files_list $PACKAGES_REPOSITORY | grep -v ^$SEARCH: ) | awk '
pascal@316 692 BEGIN { pkg=""; last="x" }
pascal@316 693 {
pascal@316 694 if ($2 == "") next
pascal@316 695 if (index($2,last) == 1 && substr($2,1+length(last),1) == "/")
pascal@316 696 delete file[last]
pascal@316 697 last=$2
pascal@316 698 if (pkg == "") pkg=$1
pascal@316 699 if ($1 == pkg) file[$2]=$1
pascal@316 700 else if (file[$2] == pkg) print
pascal@316 701 }
pascal@316 702 ' | display_packages_and_files
pascal@316 703 cat << _EOT_
pascal@316 704 </pre>
pascal@316 705 _EOT_
pascal@316 706 fi
pascal@316 707 ;;
pascal@316 708
pascal@316 709
pascal@316 710 ### File search
pascal@316 711 File)
pascal@316 712 if [ -n "$SEARCH" ]; then
pascal@316 713 cat << _EOT_
pascal@316 714
pascal@316 715 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 716 <pre>
pascal@316 717 _EOT_
pascal@316 718 last=""
pascal@321 719 cat_files_list $PACKAGES_REPOSITORY \
pascal@316 720 | grep "$SEARCH" | while read pkg file; do
pascal@316 721 echo "$file" | grep -q "$SEARCH" || continue
pascal@316 722 if [ "$last" != "${pkg%:}" ]; then
pascal@316 723 last=${pkg%:}
pascal@316 724 (
pascal@316 725 . $WOK/$last/receipt
pascal@316 726 cat << _EOT_
pascal@316 727
pascal@316 728 <i>$(package_entry)</i>
pascal@316 729 _EOT_
pascal@316 730 )
pascal@316 731 fi
pascal@316 732 echo " $file"
pascal@316 733 done
pascal@316 734 cat << _EOT_
pascal@316 735 </pre>
pascal@316 736 _EOT_
pascal@316 737 fi
pascal@316 738 ;;
pascal@316 739
pascal@316 740
pascal@316 741 ### List of files
pascal@316 742 File_list)
pascal@316 743 if package_exist $SEARCH; then
pascal@316 744 cat << _EOT_
pascal@316 745
pascal@316 746 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 747 <pre>
pascal@316 748 _EOT_
pascal@316 749 last=""
pascal@321 750 cat_files_list $PACKAGES_REPOSITORY \
pascal@316 751 | grep ^$SEARCH: | sed 's/.*: / /' | sort
pascal@316 752 cat << _EOT_
pascal@316 753 </pre>
pascal@316 754 <pre>
pascal@316 755 _EOT_
pascal@321 756 filenb=$(cat_files_list $PACKAGES_REPOSITORY | grep ^$SEARCH: | wc -l)
pascal@316 757 eval_ngettext "\$filenb file" "\$filenb files" $filenb
pascal@316 758 cat << _EOT_
pascal@316 759 \
pascal@316 760 $(busybox sed -n "/^$SEARCH$/{nnnpq}" $PACKAGES_REPOSITORY/packages.txt)
pascal@316 761 </pre>
pascal@316 762 _EOT_
pascal@316 763 fi
pascal@316 764 ;;
pascal@316 765
pascal@316 766
pascal@316 767 ### Package description
pascal@316 768 Desc)
pascal@331 769 cat << _EOT_
pascal@316 770
pascal@316 771 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 772 <pre>
pascal@316 773 _EOT_
pascal@331 774 if [ -f $WOK/$SEARCH/description.txt ]; then
pascal@331 775 htmlize < $WOK/$SEARCH/description.txt
pascal@331 776 else
pascal@316 777 last=""
pascal@316 778 grep -i "$SEARCH" $PACKAGES_REPOSITORY/packages.desc | \
pascal@316 779 sort | while read pkg extras ; do
pascal@316 780 . $WOK/$pkg/receipt
pascal@316 781 package_entry
pascal@316 782 done
pascal@331 783 fi
pascal@331 784 cat << _EOT_
pascal@316 785 </pre>
pascal@316 786 _EOT_
pascal@331 787 ;;
pascal@331 788
pascal@331 789
pascal@333 790 ### Bugs
pascal@333 791 Bugs)
pascal@333 792 cat << _EOT_
pascal@333 793
pascal@333 794 <h3>$(eval_gettext "Result for known bugs")</h3>
pascal@333 795 <pre>
pascal@333 796 _EOT_
pascal@333 797 last=""
pascal@333 798 grep ^BUGS= $WOK/*/receipt | \
pascal@333 799 sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do
pascal@333 800 BUGS=
pascal@333 801 . $WOK/$pkg/receipt
pascal@333 802 package_entry
pascal@333 803 echo " $BUGS "
pascal@333 804 done
pascal@333 805 cat << _EOT_
pascal@333 806 </pre>
pascal@333 807 _EOT_
pascal@333 808 ;;
pascal@333 809
pascal@333 810
pascal@331 811 ### Arch
pascal@331 812 Arch)
pascal@331 813 cat << _EOT_
pascal@331 814
pascal@331 815 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@331 816 <pre>
pascal@331 817 _EOT_
pascal@331 818 last=""
pascal@331 819 grep ^HOST_ARCH= $WOK/*/receipt | grep -i "$SEARCH" | \
pascal@331 820 sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do
pascal@331 821 HOST_ARCH=
pascal@331 822 . $WOK/$pkg/receipt
pascal@331 823 echo " $HOST_ARCH " | grep -iq " $SEARCH " &&
pascal@331 824 package_entry
pascal@331 825 done
pascal@331 826 cat << _EOT_
pascal@331 827 </pre>
pascal@331 828 _EOT_
pascal@316 829 ;;
pascal@316 830
pascal@316 831
pascal@316 832 ### Tags
pascal@316 833 Tags)
pascal@316 834 if [ -n "$SEARCH" ]; then
pascal@316 835 cat << _EOT_
pascal@316 836
pascal@316 837 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 838 <pre>
pascal@316 839 _EOT_
pascal@316 840 last=""
pascal@316 841 grep ^TAGS= $WOK/*/receipt | grep -i "$SEARCH" | \
pascal@316 842 sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do
pascal@316 843 TAGS=
pascal@316 844 . $WOK/$pkg/receipt
pascal@316 845 echo " $TAGS " | grep -iq " $SEARCH " &&
pascal@316 846 package_entry
pascal@316 847 done
pascal@316 848 cat << _EOT_
pascal@316 849 </pre>
pascal@316 850 _EOT_
pascal@316 851 else
pascal@316 852 # Display clouds
pascal@327 853 while read var arg title fmt filter; do
pascal@316 854 file=/tmp/$arg-$SLITAZ_VERSION
pascal@316 855 echo "<a name=\"$arg\"></a>"
pascal@316 856 echo "<h3>$title</h3>"
pascal@316 857 [ ! -e $file -o \
pascal@316 858 $PACKAGES_REPOSITORY/packages.txt -nt $file ] &&
pascal@316 859 build_cloud_cache $var "$filter" > $file.$$ &&
pascal@370 860 mv -f $file.$$ $file
pascal@327 861 display_cloud $arg "$fmt" < $file 2>&1
pascal@316 862 done << EOT
pascal@327 863 TAGS tags Tag\ cloud %d\ tags.
pascal@327 864 CATEGORY category Category\ cloud %d\ categories.
pascal@370 865 LICENSE license License\ cloud %d\ licenses.
pascal@327 866 MAINTAINER maintainer Maintainer\ cloud %d\ maintainers. s/.*<//;s/.*\ //;s/>//
pascal@316 867 EOT
pascal@316 868 fi
pascal@316 869 ;;
pascal@316 870
pascal@316 871
pascal@316 872 ### Package receipt
pascal@316 873 # TODO: add style highlighting
pascal@316 874 Receipt)
pascal@316 875 package_exist $SEARCH && cat << _EOT_
pascal@316 876
pascal@316 877 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 878 <pre>
pascal@331 879 $(receipt=$WOK/$SEARCH/taz/*/receipt
pascal@331 880 [ -f $receipt ] || receipt=$WOK/$SEARCH/receipt
pascal@332 881 . /home/slitaz/repos/cookutils/cook.conf
pascal@331 882 . $receipt
pascal@331 883 cat $receipt | htmlize | urllink)
pascal@316 884 </pre>
pascal@316 885 _EOT_
pascal@316 886 ;;
pascal@316 887
pascal@316 888
pascal@316 889 ### Package
pascal@316 890 Package)
pascal@316 891 #WHY# if package_exist $SEARCH; then
pascal@316 892 cat << _EOT_
pascal@316 893
pascal@316 894 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 895 <pre>
pascal@316 896 _EOT_
pascal@316 897 for pkg in `ls $WOK/ | grep "$SEARCH"`
pascal@316 898 do
pascal@316 899 . $WOK/$pkg/receipt
pascal@316 900 DESC=" <a href=\"?object=Desc&query=$pkg&lang=$lang&version=$SLITAZ_VERSION&submit=go\">$(gettext description)</a>"
pascal@316 901 [ -f $WOK/$pkg/description.txt ] || DESC=""
pascal@316 902 cat << _EOT_
pascal@316 903 $(package_entry)$DESC
pascal@316 904 _EOT_
pascal@316 905 done
pascal@316 906 equiv=$PACKAGES_REPOSITORY/packages.equiv
pascal@316 907 vpkgs="$(cat $equiv | cut -d= -f1 | grep $SEARCH)"
pascal@316 908 for vpkg in $vpkgs ; do
pascal@316 909 cat << _EOT_
pascal@316 910 </pre>
pascal@316 911
pascal@316 912 <h3>$(eval_gettext "Result for: \$SEARCH (package providing \$vpkg)")</h3>
pascal@316 913 <pre>
pascal@316 914 _EOT_
pascal@316 915 for pkg in $(grep $vpkg= $equiv | sed "s/$vpkg=//"); do
pascal@316 916 . $WOK/${pkg#*:}/receipt
pascal@316 917 package_entry
pascal@316 918 done
pascal@316 919 done
pascal@316 920 cat << _EOT_
pascal@316 921 </pre>
pascal@316 922 _EOT_
pascal@316 923 #WHY# fi
pascal@316 924 ;;
pascal@316 925
pascal@316 926 ### Category
pascal@316 927 Category)
pascal@316 928 cat << _EOT_
pascal@316 929
pascal@316 930 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 931 <pre>
pascal@316 932 _EOT_
pascal@316 933 for pkg in `ls $WOK/`
pascal@316 934 do
pascal@316 935 CATEGORY=
pascal@316 936 . $WOK/$pkg/receipt
pascal@316 937 DESC=" <a href=\"?object=Desc&query=$pkg&lang=$lang&version=$SLITAZ_VERSION&submit=go\">$(gettext description)</a>"
pascal@316 938 [ -f $WOK/$pkg/description.txt ] || DESC=""
pascal@316 939 [ "$CATEGORY" == "$SEARCH" ] && cat << _EOT_
pascal@316 940 $(package_entry)$DESC
pascal@316 941 _EOT_
pascal@316 942 done
pascal@316 943 ;;
pascal@316 944
pascal@316 945 ### Maintainer
pascal@316 946 Maintainer)
pascal@316 947 cat << _EOT_
pascal@316 948
pascal@316 949 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@316 950 <pre>
pascal@316 951 _EOT_
pascal@316 952 for pkg in `ls $WOK/`
pascal@316 953 do
pascal@316 954 MAINTAINER=
pascal@316 955 . $WOK/$pkg/receipt
pascal@316 956 DESC=" <a href=\"?object=Desc&query=$pkg&lang=$lang&version=$SLITAZ_VERSION&submit=go\">$(gettext description)</a>"
pascal@316 957 [ -f $WOK/$pkg/description.txt ] || DESC=""
pascal@316 958 [ "$MAINTAINER" == "$SEARCH" ] && cat << _EOT_
pascal@316 959 $(package_entry)$DESC
pascal@316 960 _EOT_
pascal@316 961 done
pascal@316 962 ;;
pascal@370 963
pascal@370 964 ### License
pascal@370 965 License)
pascal@370 966 cat << _EOT_
pascal@370 967
pascal@370 968 <h3>$(eval_gettext "Result for: \$SEARCH")</h3>
pascal@370 969 <pre>
pascal@370 970 _EOT_
pascal@370 971 for pkg in `ls $WOK/`
pascal@370 972 do
pascal@370 973 LICENSE=
pascal@370 974 . $WOK/$pkg/receipt
pascal@370 975 DESC=" <a href=\"?object=Desc&query=$pkg&lang=$lang&version=$SLITAZ_VERSION&submit=go\">$(gettext description)</a>"
pascal@370 976 [ -f $WOK/$pkg/description.txt ] || DESC=""
pascal@370 977 [ "$LICENSE" == "$SEARCH" ] && cat << _EOT_
pascal@370 978 $(package_entry)$DESC
pascal@370 979 _EOT_
pascal@370 980 done
pascal@370 981 ;;
pascal@316 982 esac
pascal@316 983
pascal@316 984 xhtml_footer
pascal@316 985
pascal@316 986 exit 0