wok-6.x annotate tazpkg-web/stuff/search.cgi @ 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 ce3fc5cd3c68
children f7b4acf937ec
rev   line source
pankso@3521 1 #!/bin/sh
pankso@3521 2 # Tiny CGI search engine for SliTaz packages on http://pkgs.slitaz.org/
pankso@3521 3 # Christophe Lincoln <pankso@slitaz.org>
pankso@3521 4 #
pankso@3521 5
pankso@3521 6 read QUERY_STRING
pankso@3521 7 for i in $(echo $QUERY_STRING | sed 's/&/ /g'); do
pankso@3521 8 eval $i
pankso@3521 9 done
pankso@3521 10 LANG=$lang
pankso@3521 11 SEARCH=$query
pankso@3521 12 SLITAZ_VERSION=$version
pankso@3521 13 OBJECT=$object
pankso@3521 14 DATE=`date +%Y-%m-%d\ \%H:%M:%S`
pankso@3521 15 VERSION=cooking
pankso@3521 16 if [ "$REQUEST_METHOD" = "GET" ]; then
pankso@3521 17 SEARCH=""
pascal@4840 18 VERBOSE=0
pankso@3521 19 for i in $(echo $REQUEST_URI | sed 's/[?&]/ /g'); do
pankso@3521 20 SLITAZ_VERSION=cooking
pankso@3521 21 case "$i" in
pascal@4840 22 verbose=*)
pascal@4840 23 VERBOSE=${i#*=};;
pankso@3521 24 lang=*)
pankso@3521 25 LANG=${i#*=};;
pankso@3521 26 file=*)
pankso@3521 27 SEARCH=${i#*=}
pankso@3521 28 OBJECT=File;;
pankso@3521 29 desc=*)
pankso@3521 30 SEARCH=${i#*=}
pankso@3521 31 OBJECT=Desc;;
pankso@3521 32 tags=*)
pankso@3521 33 SEARCH=${i#*=}
pankso@3521 34 OBJECT=Tags;;
pankso@3521 35 receipt=*)
pankso@3521 36 SEARCH=${i#*=}
pankso@3521 37 OBJECT=Receipt;;
pankso@3521 38 filelist=*)
pankso@3521 39 SEARCH=${i#*=}
pankso@3521 40 OBJECT=File_list;;
pankso@3521 41 package=*)
pankso@3521 42 SEARCH=${i#*=}
pankso@3521 43 OBJECT=Package;;
pankso@3521 44 depends=*)
pankso@3521 45 SEARCH=${i#*=}
pankso@3521 46 OBJECT=Depends;;
pascal@4840 47 BuildDepends=*)
pascal@4840 48 SEARCH=${i#*=}
pascal@4840 49 OBJECT=BuildDepends;;
pascal@4840 50 FileOverlap=*)
pascal@4840 51 SEARCH=${i#*=}
pascal@4840 52 OBJECT=FileOverlap;;
pascal@5820 53 version=s*|version=3*)
pankso@3521 54 SLITAZ_VERSION=stable;;
pascal@5820 55 version=2*)
pascal@5820 56 SLITAZ_VERSION=2.0;;
pankso@3521 57 version=1*)
pankso@3521 58 SLITAZ_VERSION=1.0;;
pankso@3521 59 esac
pankso@3521 60 done
pankso@3521 61 [ -n "$SEARCH" ] && REQUEST_METHOD="POST"
pankso@3521 62 fi
pankso@3521 63
pankso@3521 64 case "$OBJECT" in
pankso@3521 65 File) selected_file="selected";;
pankso@3521 66 Desc) selected_desc="selected";;
pankso@3521 67 Tags) selected_tags="selected";;
pankso@3521 68 Receipt) selected_receipt="selected";;
pankso@3521 69 File_list) selected_file_list="selected";;
pankso@3521 70 Depends) selected_depends="selected";;
pascal@4840 71 BuildDepends) selected_build_depends="selected";;
pascal@4840 72 FileOverlap) selected_overlap="selected";;
pankso@3521 73 esac
pankso@3521 74
pankso@3521 75 case "$SLITAZ_VERSION" in
pankso@3521 76 1.0) selected_1="selected";;
pascal@5820 77 2.0) selected_2="selected";;
pankso@3521 78 stable) selected_stable="selected";;
pankso@3521 79 esac
pankso@3521 80
pankso@3521 81 # unescape query
pankso@3521 82 SEARCH="$(echo $SEARCH | sed 's/%2B/+/g' | sed 's/%3A/:/g' | sed 's|%2F|/|g')"
pankso@3521 83
pankso@3521 84 if [ -z "$LANG" ]; then
pankso@3521 85 for i in $(echo $HTTP_ACCEPT_LANGUAGE | sed 's/[,;]/ /g'); do
pankso@3521 86 case "$i" in
pankso@3521 87 fr|de|pt|cn)
pankso@3521 88 LANG=$i
pankso@3521 89 break;;
pankso@3521 90 esac
pankso@3521 91 done
pankso@3521 92 fi
pankso@3521 93
pankso@3521 94 package="Package"
pankso@3521 95 file="File"
pankso@3521 96 desc="Description"
pankso@3521 97 tags="Tags"
pankso@3521 98 receipt="Receipt"
pankso@3521 99 file_list="File list"
pankso@3521 100 depends="Depends"
pascal@4840 101 bdepends="Build depends"
pankso@3521 102 search="Search"
pankso@3521 103 cooking="cooking"
pankso@3521 104 stable="stable"
pankso@3521 105 result="Result for : $SEARCH"
pankso@3521 106 noresult="No package $SEARCH"
pankso@3521 107 deptree="Dependency tree for : $SEARCH"
pankso@3521 108 rdeptree="Reverse dependency tree for : $SEARCH"
pascal@4840 109 bdeplist="$SEARCH needs these packages to be built"
pascal@4840 110 rbdeplist="Packages who need $SEARCH to be built"
pascal@4840 111 overloading="Theses packages may overload files of "
pascal@4840 112 overlap="common files"
pankso@3521 113 charset="ISO-8859-1"
pankso@3521 114
pankso@3521 115 case "$LANG" in
pankso@3521 116
pankso@3521 117 fr) package="Paquet"
pankso@3521 118 receipt="Recette"
pankso@3521 119 depends="Dépendances"
pascal@4840 120 bdepends="Fabrication"
pankso@3521 121 search="Recherche"
pankso@3521 122 result="Recherche de : $SEARCH"
pankso@3521 123 noresult="Paquet $SEARCH introuvable"
pankso@3521 124 deptree="Arbre des dépendances de $SEARCH"
pankso@3521 125 rdeptree="Arbre inversé des dépendances de $SEARCH"
pascal@4840 126 bdeplist="$SEARCH a besion de ces paquets pour être fabriqué"
pascal@4840 127 rbdeplist="Paquets ayant besion de $SEARCH pour être fabriqués"
pascal@4840 128 overloading="Paquets pouvant écraser des fichiers de "
pascal@4840 129 overlap="Fichiers communs"
pankso@3521 130 file_list="Liste des fichiers"
pankso@3521 131 file="Fichier";;
pankso@3521 132
pankso@3521 133 de) package="Paket"
pankso@3521 134 depends="Abhängigkeiten"
pankso@3521 135 desc="Beschreibung"
pankso@3521 136 search="Suche"
pankso@3521 137 cooking="Cooking"
pankso@3521 138 stable="Stable"
pankso@3521 139 result="Resultate für : $SEARCH"
pankso@3521 140 noresult="Kein Paket für $SEARCH"
pankso@3521 141 deptree="Abhängigkeiten von: $SEARCH"
pankso@3521 142 rdeptree="Abhängigkeit für: $SEARCH"
pankso@3521 143 file_list="Datei liste"
pankso@3521 144 file="Datei";;
pankso@3521 145
pankso@3521 146 pt) package="Pacote"
pankso@3521 147 search="Buscar"
pankso@3521 148 cooking="cooking"
pankso@3521 149 stable="stable"
pankso@3521 150 result="Resultado para : $SEARCH"
pankso@3521 151 noresult="Sem resultado: $SEARCH"
pankso@3521 152 deptree="Árvore de dependências para: $SEARCH"
pankso@3521 153 rdeptree="Árvore de dependências reversa para: $SEARCH"
pankso@3521 154 depends="Dependências"
pankso@3521 155 desc="Descrição"
pankso@3521 156 file_list="Arquivo lista"
pankso@3521 157 file="Arquivo";;
pankso@3521 158
pankso@3521 159 cn) package="软件包:"
pankso@3521 160 cooking="å¼€å‘版"
pankso@3521 161 stable="稳定版"
pankso@3521 162 desc="æè¿°"
pankso@3521 163 tags="标签"
pankso@3521 164 depends="ä¾èµ–"
pankso@3521 165 file="文件"
pankso@3521 166 file_list="文件列表"
pankso@3521 167 search="Search"
pankso@3521 168 result="Result for : $SEARCH"
pankso@3521 169 noresult="No package $SEARCH"
pankso@3521 170 deptree="Dependency tree for : $SEARCH"
pankso@3521 171 rdeptree="Reverse dependency tree for : $SEARCH"
pankso@3521 172 charset="UTF-8";;
pankso@3521 173
pankso@3521 174 *) LANG="en";;
pankso@3521 175
pankso@3521 176 esac
pankso@3521 177
pankso@3521 178 WOK=/home/slitaz/$SLITAZ_VERSION/wok
pascal@3551 179 PACKAGES_REPOSITORY=/home/slitaz/$SLITAZ_VERSION/packages
pankso@3521 180
pankso@3521 181 echo Content-type: text/html
pankso@3521 182 echo
pankso@3521 183
pankso@3521 184 # Search form
pankso@3521 185 search_form()
pankso@3521 186 {
pankso@3521 187 cat << _EOT_
pankso@3521 188
pankso@3521 189 <div style="text-align: center; padding: 20px;">
pankso@3521 190 <form method="post" action="search.cgi">
pankso@3521 191 <input type="hidden" name="lang" value="$LANG" />
pankso@3521 192 <select name="object">
pankso@3521 193 <option value="Package">$package</option>
pankso@3521 194 <option $selected_desc value="Desc">$desc</option>
pankso@3521 195 <option $selected_tags value="Tags">$tags</option>
pankso@3521 196 <option $selected_receipt value="Receipt">$receipt</option>
pankso@3521 197 <option $selected_depends value="Depends">$depends</option>
pascal@4840 198 <option $selected_build_depends value="BuildDepends">$bdepends</option>
pankso@3521 199 <option $selected_file value="File">$file</option>
pankso@3521 200 <option $selected_file_list value="File_list">$file_list</option>
pascal@4840 201 <option $selected_overlap value="FileOverlap">$overlap</option>
pankso@3521 202 </select>
pankso@3521 203 <strong>:</strong>
pascal@4840 204 <input type="text" name="query" size="20" value="$SEARCH" />
pankso@3521 205 <select name="version">
pankso@3521 206 <option value="cooking">$cooking</option>
pankso@3521 207 <option $selected_stable value="stable">$stable</option>
pankso@3521 208 <option $selected_1 value="1.0">1.0</option>
pascal@5820 209 <option $selected_2 value="2.0">2.0</option>
pankso@3521 210 </select>
pankso@3521 211 <input type="submit" name="search" value="$search" />
pankso@3521 212 </form>
pankso@3521 213 </div>
pankso@3521 214 _EOT_
pankso@3521 215 }
pankso@3521 216
pankso@3521 217 # xHTML Header.
pankso@3521 218 xhtml_header()
pankso@3521 219 {
pankso@3521 220 cat << _EOF_
pankso@3521 221 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
pankso@3521 222 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
pankso@3521 223 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$LANG" lang="$LANG">
pankso@3521 224 <head>
pankso@3521 225 <title>SliTaz Packages - Search $SEARCH</title>
pankso@3521 226 <meta http-equiv="content-type" content="text/html; charset=$charset" />
pankso@3521 227 <meta name="description" content="Au sujet de SliTaz GNU/Linux mini système d'exploitation" />
pankso@3521 228 <meta name="keywords" lang="fr" content="Système, libre, gnu, linux, opensource, livecd" />
pankso@3521 229 <meta name="robots" content="index, follow, all" />
pankso@3521 230 <meta name="revisit-after" content="7 days" />
pankso@3521 231 <meta name="expires" content="never" />
pankso@3521 232 <meta name="modified" content="$DATE" />
pankso@3521 233 <meta name="author" content="ash, awk, grep, sed and cat"/>
pankso@3521 234 <meta name="publisher" content="www.slitaz.org" />
pascal@5822 235 <link rel="shortcut icon" href="/favicon.ico" />
pascal@5822 236 <link rel="stylesheet" type="text/css" href="/slitaz.css" />
pankso@3521 237 </head>
pankso@3521 238 <body bgcolor="#ffffff">
pankso@3521 239
pankso@3521 240 <!-- Header -->
pankso@3521 241 <div id="header">
pankso@3521 242 <a name="top"></a>
pankso@3521 243 <!-- Access -->
pankso@3521 244 <div id="access">
pankso@3521 245 <a href="http://www.slitaz.org/" title="SliTaz Web site">Website</a> |
pankso@3521 246 <a href="http://wiki.slitaz.org/" title="SliTaz Community Wiki">Wiki</a> |
pankso@3521 247 <a href="http://labs.slitaz.org/" title="SliTaz laboratories">Labs</a>
pankso@3521 248 </div>
pankso@3521 249 <a href="http://pkgs.slitaz.org/"><img id="logo"
pascal@5822 250 src="/pics/website/logo.png" title="pkgs.slitaz.org" alt="pkgs.slitaz.org"
pankso@3521 251 style="border: 0px solid ; width: 200px; height: 74px;" /></a>
pankso@3521 252 <p id="titre">#!/tazpkg/packages</p>
pankso@3521 253 </div>
pankso@3521 254 _EOF_
pankso@3521 255 }
pankso@3521 256
pankso@3521 257 # xHTML Footer.
pankso@3521 258 xhtml_footer()
pankso@3521 259 {
pankso@3521 260 cat << _EOT_
pankso@3521 261 <center>
pascal@3551 262 <i>$(ls $WOK/ | wc -l) packages and $(unlzma -c $PACKAGES_REPOSITORY/files.list.lzma | wc -l) files in $SLITAZ_VERSION database</i>
pankso@3521 263 </center>
pankso@3521 264
pankso@3521 265 <!-- End of content with round corner -->
pankso@3521 266 </div>
pankso@3521 267 <div id="content_bottom">
pankso@3521 268 <div class="bottom_left"></div>
pankso@3521 269 <div class="bottom_right"></div>
pankso@3521 270 </div>
pankso@3521 271
pankso@3521 272 <!-- Start of footer and copy notice -->
pankso@3521 273 <div id="copy">
pankso@3521 274 <p>
pankso@3521 275 Dernière modification : $DATE -
pankso@3521 276 <a href="#top">Top of the page</a>
pankso@3521 277 </p>
pankso@3521 278 <p>
pascal@5820 279 Copyright &copy; $(date +%Y) <a href="http://www.slitaz.org/">SliTaz</a> -
pankso@3521 280 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
pankso@3521 281 </p>
pankso@3521 282 <!-- End of copy -->
pankso@3521 283 </div>
pankso@3521 284
pankso@3521 285 <!-- Bottom and logo's -->
pankso@3521 286 <div id="bottom">
pankso@3521 287 <p>
pankso@3521 288 <a href="http://validator.w3.org/check?uri=referer"><img
pascal@5822 289 src="/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
pankso@3521 290 title="Code validé XHTML 1.0"
pankso@3521 291 style="width: 80px; height: 15px;" /></a>
pankso@3521 292 </p>
pankso@3521 293 </div>
pankso@3521 294
pankso@3521 295 </body>
pankso@3521 296 </html>
pankso@3521 297 _EOT_
pankso@3521 298 }
pankso@3521 299
pascal@4840 300 installed_size()
pascal@4840 301 {
pascal@4840 302 [ $VERBOSE -gt 0 ] &&
pascal@4840 303 grep -A 3 "^$1\$" /home/slitaz/$SLITAZ_VERSION/packages/packages.txt | \
pascal@4840 304 grep installed | sed 's/.*(\(.*\) installed.*/(\1) /'
pascal@4840 305 }
pascal@4840 306
pascal@5822 307 package_entry()
pascal@5822 308 {
pascal@5822 309 if [ -s "$(dirname $0)/$SLITAZ_VERSION/$CATEGORY.html" ]; then
pascal@5822 310 cat << _EOT_
pascal@5822 311 <a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
pascal@5822 312 _EOT_
pascal@5822 313 else
pascal@5822 314 cat << _EOT_
pascal@5822 315 <a href="http://mirror.slitaz.org/packages/$SLITAZ_VERSION/$PACKAGE-$VERSION$EXTRA_VERSION.tazpkg">$PACKAGE</a> $(installed_size $PACKAGE): $SHORT_DESC
pascal@5822 316 _EOT_
pascal@5822 317 fi
pascal@5822 318 }
pascal@5822 319
pascal@3780 320 # recursive dependencies scan
pascal@3780 321 dep_scan()
pascal@3780 322 {
pankso@3521 323 for i in $1; do
pankso@3521 324 case " $ALL_DEPS " in
pankso@3521 325 *\ $i\ *) continue;;
pankso@3521 326 esac
pankso@3521 327 ALL_DEPS="$ALL_DEPS $i"
pankso@3521 328 if [ -n "$2" ]; then
pankso@3521 329 echo -n "$2"
pankso@3521 330 (
pankso@3521 331 . $WOK/$i/receipt
pascal@5822 332 package_entry
pankso@3521 333 )
pankso@3521 334 fi
pankso@3521 335 [ -f $WOK/$i/receipt ] || continue
pankso@3521 336 DEPENDS=""
pankso@3521 337 . $WOK/$i/receipt
pankso@3521 338 [ -n "$DEPENDS" ] && dep_scan "$DEPENDS" "$2 "
pankso@3521 339 done
pankso@3521 340 }
pankso@3521 341
pascal@3780 342 # recursive reverse dependencies scan
pascal@3780 343 rdep_scan()
pascal@3780 344 {
pankso@3521 345 SEARCH=$1
pankso@3521 346 case "$SEARCH" in
pankso@3521 347 glibc-base|gcc-lib-base) cat <<EOT
paul@3528 348 glibc-base and gcc-lib-base are implicit dependencies,
paul@3528 349 <b>every</b> package is supposed to depend on them.
pankso@3521 350 EOT
pankso@3521 351 return;;
pankso@3521 352 esac
pankso@3521 353 for i in $WOK/* ; do
pankso@3521 354 DEPENDS=""
pankso@3521 355 . $i/receipt
pankso@3521 356 echo "$(basename $i) $(echo $DEPENDS)"
pankso@3521 357 done | awk -v search=$SEARCH '
pankso@3521 358 function show_deps(deps, all_deps, pkg, space)
pankso@3521 359 {
pankso@3521 360 if (all_deps[pkg] == 1) return
pankso@3521 361 all_deps[pkg] = 1
pankso@3521 362 if (space != "") printf "%s%s\n",space,pkg
pankso@3521 363 for (i = 1; i <= split(deps[pkg], mydeps, " "); i++) {
pankso@3521 364 show_deps(deps, all_deps, mydeps[i],"////" space)
pankso@3521 365 }
pankso@3521 366 }
pankso@3521 367
pankso@3521 368 {
pankso@3521 369 all_deps[$1] = 0
pankso@3521 370 for (i = 2; i <= NF; i++)
pankso@3521 371 deps[$i] = deps[$i] " " $1
pankso@3521 372 }
pankso@3521 373
pankso@3521 374 END {
pankso@3521 375 show_deps(deps, all_deps, search, "")
pankso@3521 376 }
pankso@3521 377 ' | while read pkg; do
pankso@3521 378 . $WOK/${pkg##*/}/receipt
pascal@5822 379 package_entry
pankso@3521 380 cat << _EOT_
pascal@5822 381 $(echo ${pkg%/*} | sed 's|/| |g') $(package_entry)
pankso@3521 382 _EOT_
pankso@3521 383 done
pankso@3521 384 }
pankso@3521 385
pankso@3521 386 # Check package exists
pankso@3521 387 package_exist()
pankso@3521 388 {
pankso@3521 389 [ -f $WOK/$1/receipt ] && return 0
pankso@3521 390 cat << _EOT_
pankso@3521 391
pankso@3521 392 <h3>$noresult</h3>
pankso@3521 393 <pre class="package">
pankso@3521 394 _EOT_
pankso@3521 395 return 1
pankso@3521 396 }
pankso@3521 397
pascal@3780 398 # Display < > &
pascal@3780 399 htmlize()
pascal@3780 400 {
pascal@3780 401 sed -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
pascal@3780 402 }
pascal@3780 403
pascal@4840 404 display_packages_and_files()
pascal@4840 405 {
pascal@4840 406 last=""
pascal@4840 407 while read pkg file; do
pascal@4840 408 pkg=${pkg%:}
pascal@4840 409 if [ "$pkg" != "$last" ]; then
pascal@4840 410 . $WOK/$pkg/receipt
pascal@5822 411
pascal@5822 412 package_entry
pascal@4840 413 last=$pkg
pascal@4840 414 fi
pascal@4840 415 echo " $file"
pascal@4840 416 done
pascal@4840 417 }
pascal@4840 418
pankso@3521 419 # Display search form and result if requested.
pankso@3521 420 if [ "$REQUEST_METHOD" != "POST" ]; then
pankso@3521 421 xhtml_header
pankso@3521 422 cat << _EOT_
pankso@3521 423
pankso@3521 424 <!-- Content top. -->
pankso@3521 425 <div id="content_top">
pankso@3521 426 <div class="top_left"></div>
pankso@3521 427 <div class="top_right"></div>
pankso@3521 428 </div>
pankso@3521 429
pankso@3521 430 <!-- Content -->
pankso@3521 431 <div id="content">
pankso@3521 432 <a name="content"></a>
pankso@3521 433
pankso@3521 434 <h1><font color="#3E1220">$package</font></h1>
pankso@3521 435 <h2><font color="#DF8F06">$search</font></h2>
pankso@3521 436 _EOT_
pankso@3521 437 search_form
pankso@3521 438 xhtml_footer
pankso@3521 439 else
pankso@3521 440 xhtml_header
pankso@3521 441 cat << _EOT_
pankso@3521 442
pankso@3521 443 <!-- Content top. -->
pankso@3521 444 <div id="content_top">
pankso@3521 445 <div class="top_left"></div>
pankso@3521 446 <div class="top_right"></div>
pankso@3521 447 </div>
pankso@3521 448
pankso@3521 449 <!-- Content -->
pankso@3521 450 <div id="content">
pankso@3521 451 <a name="content"></a>
pankso@3521 452
pankso@3521 453 <h1><font color="#3E1220">$package</font></h1>
pankso@3521 454 <h2><font color="#DF8F06">$search</font></h2>
pankso@3521 455 _EOT_
pankso@3521 456 search_form
pankso@3521 457 if [ "$OBJECT" = "Depends" ]; then
pankso@3521 458 if package_exist $SEARCH ; then
pankso@3521 459 cat << _EOT_
pankso@3521 460
pankso@3521 461 <h3>$deptree</h3>
pankso@3521 462 <pre class="package">
pankso@3521 463 _EOT_
pankso@3521 464 ALL_DEPS=""
pankso@3521 465 dep_scan $SEARCH ""
pankso@3521 466 SUGGESTED=""
pankso@3521 467 . $WOK/$SEARCH/receipt
pankso@3521 468 if [ -n "$SUGGESTED" ]; then
pankso@3521 469 cat << _EOT_
pankso@3521 470 </pre>
pankso@3521 471
pankso@3521 472 <h3>$deptree (SUGGESTED)</h3>
pankso@3521 473 <pre class="package">
pankso@3521 474 _EOT_
pankso@3521 475 ALL_DEPS=""
pankso@3521 476 dep_scan "$SUGGESTED" " "
pankso@3521 477 fi
pankso@3521 478 cat << _EOT_
pankso@3521 479 </pre>
pankso@3521 480
pankso@3521 481 <h3>$rdeptree</h3>
pankso@3521 482 <pre class="package">
pankso@3521 483 _EOT_
pankso@3521 484 ALL_DEPS=""
pankso@3521 485 rdep_scan $SEARCH
pascal@4840 486 cat << _EOT_
pascal@4840 487 </pre>
pascal@4840 488 _EOT_
pascal@4840 489 fi
pascal@4840 490 elif [ "$OBJECT" = "BuildDepends" ]; then
pascal@4840 491 if package_exist $SEARCH ; then
pascal@4840 492 cat << _EOT_
pascal@4840 493
pascal@4840 494 <h3>$bdeplist</h3>
pascal@4840 495 <pre class="package">
pascal@4840 496 _EOT_
pascal@4840 497 BUILD_DEPENDS=""
pascal@4840 498 . $WOK/$SEARCH/receipt
pascal@4840 499 [ -n "$BUILD_DEPENDS" ] && for dep in $BUILD_DEPENDS ; do
pascal@4840 500 if [ ! -s $WOK/$dep/receipt ]; then
pascal@4840 501 cat << _EOT_
pascal@4840 502 $dep: not found !
pascal@4840 503 _EOT_
pascal@4840 504 continue
pascal@4840 505 fi
pascal@4840 506 . $WOK/$dep/receipt
pascal@5822 507 package_entry
pascal@4840 508 done
pascal@4840 509 cat << _EOT_
pascal@4840 510 </pre>
pascal@4840 511
pascal@4840 512 <h3>$rbdeplist</h3>
pascal@4840 513 <pre class="package">
pascal@4840 514 _EOT_
pascal@4840 515 for dep in $(grep -l $SEARCH $WOK/*/receipt); do
pascal@4840 516 BUILD_DEPENDS=""
pascal@4840 517 . $dep
pascal@4840 518 echo " $BUILD_DEPENDS " | grep -q " $SEARCH " &&
pascal@5822 519 package_entry
pascal@4840 520 done
pascal@4840 521 cat << _EOT_
pascal@4840 522 </pre>
pascal@4840 523 _EOT_
pascal@4840 524 fi
pascal@4840 525 elif [ "$OBJECT" = "FileOverlap" ]; then
pascal@4840 526 if package_exist $SEARCH ; then
pascal@4840 527 cat << _EOT_
pascal@4840 528
pascal@4840 529 <h3>$overloading $SEARCH</h3>
pascal@4840 530 <pre class="package">
pascal@4840 531 _EOT_
pascal@4840 532 ( unlzma -c $PACKAGES_REPOSITORY/files.list.lzma | grep ^$SEARCH: ;
pascal@4840 533 unlzma -c $PACKAGES_REPOSITORY/files.list.lzma | grep -v ^$SEARCH: ) | awk '
pascal@4840 534 BEGIN { pkg="" }
pascal@4840 535 {
pascal@4840 536 if (pkg == "") pkg=$1
pascal@4840 537 if ($1 == pkg) file[$2]=$1
pascal@4840 538 else if (file[$2] == pkg) print
pascal@4840 539 }
pascal@4840 540 ' | display_packages_and_files
pascal@4840 541 cat << _EOT_
pascal@4840 542 </pre>
pascal@4840 543 _EOT_
pankso@3521 544 fi
pankso@3521 545 elif [ "$OBJECT" = "File" ]; then
pankso@3521 546 cat << _EOT_
pankso@3521 547
pankso@3521 548 <h3>$result</h3>
pankso@3521 549 <pre class="package">
pankso@3521 550 _EOT_
pankso@3521 551 last=""
pascal@3551 552 unlzma -c $PACKAGES_REPOSITORY/files.list.lzma \
pankso@3521 553 | grep $SEARCH | while read pkg file; do
pankso@3521 554 echo "$file" | grep -q $SEARCH || continue
pankso@3521 555 if [ "$last" != "${pkg%:}" ]; then
pankso@3521 556 last=${pkg%:}
pankso@3521 557 (
pankso@3521 558 . $WOK/$last/receipt
pankso@3521 559 cat << _EOT_
pankso@3521 560
pascal@5822 561 <i>$(package_entry)</i>
pankso@3521 562 _EOT_
pankso@3521 563 )
pankso@3521 564 fi
pankso@3521 565 echo " $file"
pankso@3521 566 done
pankso@3521 567 elif [ "$OBJECT" = "File_list" ]; then
pankso@3521 568 package_exist $SEARCH && cat << _EOT_
pankso@3521 569
pankso@3521 570 <h3>$result</h3>
pankso@3521 571 <pre class="package">
pankso@3521 572 _EOT_
pankso@3521 573 last=""
pascal@3551 574 unlzma -c $PACKAGES_REPOSITORY/files.list.lzma \
pankso@3521 575 | grep ^$SEARCH: | sed 's/.*: / /' | sort
pankso@3521 576 elif [ "$OBJECT" = "Desc" ]; then
pascal@3780 577 if [ -f $WOK/$SEARCH/description.txt ]; then
pascal@3780 578 cat << _EOT_
pascal@3780 579
pascal@3780 580 <h3>$result</h3>
pascal@3780 581 <pre class="package">
pascal@3780 582 <pre>
pascal@3780 583 $(htmlize < $WOK/$SEARCH/description.txt)
pascal@3780 584 </pre>
pascal@3780 585 _EOT_
pascal@3780 586 else
pascal@3780 587 cat << _EOT_
pankso@3521 588
pankso@3521 589 <h3>$result</h3>
pankso@3521 590 <pre class="package">
pankso@3521 591 _EOT_
pascal@3780 592 last=""
pascal@3780 593 grep -i $SEARCH $PACKAGES_REPOSITORY/packages.desc | \
pascal@3780 594 sort | while read pkg extras ; do
pankso@3521 595 . $WOK/$pkg/receipt
pascal@5822 596 package_entry
pankso@3521 597 done
pascal@3780 598 fi
pankso@3521 599 elif [ "$OBJECT" = "Tags" ]; then
pankso@3521 600 cat << _EOT_
pankso@3521 601
pankso@3521 602 <h3>$result</h3>
pankso@3521 603 <pre class="package">
pankso@3521 604 _EOT_
pankso@3521 605 last=""
pankso@3521 606 grep ^TAGS= $WOK/*/receipt | grep -i $SEARCH | \
pankso@3521 607 sed "s|$WOK/\(.*\)/receipt:.*|\1|" | sort | while read pkg ; do
pankso@3521 608 . $WOK/$pkg/receipt
pascal@5822 609 package_entry
pankso@3521 610 done
pankso@3521 611 elif [ "$OBJECT" = "Receipt" ]; then
pankso@3521 612 package_exist $SEARCH && cat << _EOT_
pankso@3521 613
pankso@3521 614 <h3>$result</h3>
pankso@3521 615 <pre class="package">
pankso@3521 616 <pre>
pankso@3521 617 $(if [ -f $WOK/$SEARCH/taz/*/receipt ]; then
pankso@3521 618 cat $WOK/$SEARCH/taz/*/receipt
pankso@3521 619 else
pascal@3780 620 cat $WOK/$SEARCH/receipt
pascal@3780 621 fi | htmlize)
pankso@3521 622 </pre>
pankso@3521 623 _EOT_
pankso@3521 624 else
pankso@3521 625 cat << _EOT_
pankso@3521 626
pankso@3521 627 <h3>$result</h3>
pankso@3521 628 <pre class="package">
pankso@3521 629 _EOT_
pascal@4840 630 for pkg in `ls $WOK/ | grep $SEARCH`
pankso@3521 631 do
pankso@3521 632 . $WOK/$pkg/receipt
pascal@3780 633 DESC=" <a href=\"?desc=$pkg\">description</a>"
pascal@3780 634 [ -f $WOK/$pkg/description.txt ] || DESC=""
pankso@3521 635 cat << _EOT_
pascal@5822 636 $(package_entry)$DESC
pankso@3521 637 _EOT_
pankso@3521 638 done
pascal@3551 639 equiv=$PACKAGES_REPOSITORY/packages.equiv
pankso@3521 640 vpkgs="$(cat $equiv | cut -d= -f1 | grep $SEARCH)"
pankso@3521 641 for vpkg in $vpkgs ; do
pankso@3521 642 cat << _EOT_
pankso@3521 643 </pre>
pankso@3521 644
pankso@3521 645 <h3>$result (package providing $vpkg)</h3>
pankso@3521 646 <pre class="package">
pankso@3521 647 _EOT_
pankso@3521 648 for pkg in $(grep $vpkg= $equiv | sed "s/$vpkg=//"); do
pankso@3521 649 . $WOK/${pkg#*:}/receipt
pascal@5822 650 package_entry
pankso@3521 651 done
pankso@3521 652 done
pankso@3521 653 fi
pankso@3521 654 cat << _EOT_
pankso@3521 655 </pre>
pankso@3521 656 _EOT_
pankso@3521 657 xhtml_footer
pankso@3521 658 fi
pankso@3521 659
pankso@3521 660 exit 0