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