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

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