]> git.pld-linux.org Git - packages/rpm-build-tools.git/blob - builder.sh
819826aabb8123c31e09a48464ee5aae02e0515c
[packages/rpm-build-tools.git] / builder.sh
1 #!/bin/sh
2 # -----------
3 # $Id$
4 # Exit codes:
5 #       0 - succesful
6 #       1 - help displayed
7 #       2 - no spec file name in cmdl parameters
8 #       3 - spec file not stored in repo
9 #       4 - some source, patch or icon files not stored in repo
10 #       5 - package build failed
11 #       6 - spec file with errors
12 #       7 - wrong source in /etc/poldek.conf
13
14 # Notes (todo):
15 #       - builder -u fetches current version first
16 #       - tries to get new version from distfiles without new md5
17 #       - after fetching new version doesn't update md5
18 #       - doesn't get sources for specs with %include /usr/lib/rpm/macros.python
19 #         when there's no rpm-pythonprov (rpm's fault, but it's ugly anyway)
20 #       - as above with %include /usr/lib/rpm/macros.perl and no rpm-perlprov
21 #       - when Icon: field is present, -5 and -a5 doesn't work
22
23 VERSION="\
24 Build package utility from PLD CVS repository
25 V 0.11 (C) 1999-2003 Free Penguins".
26 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
27
28 COMMAND="build"
29
30 SPECFILE=""
31 BE_VERBOSE=""
32 QUIET=""
33 CLEAN=""
34 DEBUG=""
35 NOURLS=""
36 NOCVS=""
37 NOCVSSPEC=""
38 NODIST=""
39 UPDATE=""
40 UPDATE5=""
41 ADD5=""
42 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
43 if [ -s CVS/Root ]; then
44     CVSROOT=$(cat CVS/Root)
45 else
46     CVSROOT=${CVSROOT:-""}
47 fi
48 # Example: LOGFILE='../log.$PACKAGE_NAME'
49 # Yes, you can use variable name! Note _single_ quotes!
50 LOGFILE=''
51
52 LOGDIR=""
53 LOGDIROK=""
54 LOGDIRFAIL=""
55 LASTLOG_FILE=""
56 CHMOD="no"
57 CHMOD_MODE="0444"
58 RPMOPTS=""
59 BCOND=""
60 GROUP_BCONDS="no"
61
62 PATCHES=""
63 SOURCES=""
64 ICONS=""
65 PACKAGE_RELEASE=""
66 PACKAGE_VERSION=""
67 PACKAGE_NAME=""
68 PROTOCOL="ftp"
69 WGET_RETRIES=${MAX_WGET_RETRIES:-0}
70 CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
71
72 CVSTAG=""
73 RES_FILE=""
74
75 CVS_SERVER="cvs.pld-linux.org"
76 DISTFILES_SERVER="://distfiles.pld-linux.org"
77
78 DEF_NICE_LEVEL=0
79
80 FAIL_IF_NO_SOURCES="yes"
81
82 wget --help 2>&1 | grep -q ' \-\-inet ' && WGET_OPTS="$WGET_OPTS --inet"
83 wget --help 2>&1 | grep -q ' \-\-retry\-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
84
85 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
86 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
87 GETLOCAL="cp -a"
88
89 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
90     RPM="rpm"
91     RPMBUILD="rpm"
92 else
93     RPM="rpm"
94     RPMBUILD="rpmbuild"
95 fi
96
97 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
98 POLDEK_SOURCE="cvs"
99
100 # Example grep cvs /etc/poldek.conf:
101 # source = cvs /home/users/yoshi/rpm/RPMS/
102 if [ "$UPDATE_POLDEK_INDEXES" == "yes" ]; then
103         POLDEK_SOURCE_VALIDITY="`grep ${POLDEK_SOURCE} /etc/poldek.conf|grep -v ^#`"
104         if [ "${POLDEK_SOURCE_VALIDITY}" == "" ]; then 
105                 echo "Using improper source '${POLDEK_SOURCE}' in /etc/poldek.conf"
106                 echo "Fix it and try to contiune"
107                 exit 7
108         fi
109 fi
110
111 if [ -f ~/etc/builderrc ]; then
112     . ~/etc/builderrc
113 elif [ -f ~/.builderrc ]; then
114     . ~/.builderrc
115 fi
116
117 #---------------------------------------------
118 # functions
119
120 usage()
121 {
122     if [ -n "$DEBUG" ]; then set -xv; fi
123     echo "\
124 Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build]
125
126         [-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade]
127         [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get]
128         [-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
129         [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>]
130         [-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest]
131         [-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version] 
132         [{-Tp|--tag-prefix} <prefix>]
133         [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>]
134         [--with/--without <feature>] [--define <macro> <value>] <package>[.spec]
135
136         -5, --update-md5
137                         - update md5 comments in spec, implies -nd -ncs
138         -a5, --add-md5  - add md5 comments to URL sources, implies -nc -nd -ncs
139         -D, --debug     - enable script debugging mode,
140         -V, --version   - output builder version
141         -a, --as_anon   - get files via pserver as cvs@$CVS_SERVER,
142         -b, -ba,
143         --build         - get all files from CVS repo or HTTP/FTP and build
144                           package from <package>.spec,
145         -bb, --build-binary
146                         - get all files from CVS repo or HTTP/FTP and build
147                           binary only package from <package>.spec,
148         -bs,
149         --build-source  - get all files from CVS repo or HTTP/FTP and only
150                           pack them into src.rpm,
151         -B, --branch    - add branch
152         -c, --clean     - clean all temporarily created files (in BUILD,
153                           SOURCES, SPECS and \$RPM_BUILD_ROOT),
154         -d <cvsroot>, --cvsroot <cvsroot>
155                         - setup \$CVSROOT,
156         --define <macro> <value>
157                         - define a macro <macro> with value <value>,
158         --nodeps        - rpm won't check any dependences
159         -g, --get       - get <package>.spec and all related files from
160                           CVS repo or HTTP/FTP,
161         -h, --help      - this message,
162         --http          - use http instead of ftp,
163         -l <logfile>, --logtofile <logfile>
164                         - log all to file,
165         -m, --mr-proper - only remove all files related to spec file and
166                           all work resources,
167         -nc, --no-cvs   - don't download sources from CVS, if source URL is
168                           given,
169         -ncs, --no-cvs-specs
170                         - don't check specs in CVS
171         -nd, --no-distfiles
172                         - don't download from distfiles
173         -nm, --no-mirrors - don't download from mirror, if source URL is given,
174         -nu, --no-urls  - don't try to download from FTP/HTTP location,
175         -ns, --no-srcs  - don't download Sources
176         -ns0, --no-source0
177                         - don't download Source0
178         --opts <rpm opts>
179                         - additional options for rpm
180         -q, --quiet     - be quiet,
181         --date yyyy-mm-dd
182                         - build package using resources from specified CVS
183                           date,
184         -r <cvstag>, --cvstag <cvstag>
185                         - build package using resources from specified CVS
186                           tag,
187         -R, --fetch-build-requires
188                         - fetch what is BuildRequired,
189         -RB, --remove-build-requires
190                         - remove all you fetched with -R or --fetch-build-requires
191                           remember, this option requires confirmation,
192         -FRB, --force-remove-build-requires
193                         - remove all you fetched with -R or --fetch-build-requires
194                           remember, this option works without confirmation,
195         -T <cvstag> , --tag <cvstag>
196                         - add cvs tag <cvstag> for files,
197         -Tvs, --tag-version-stable
198                         - add cvs tags STABLE and NAME-VERSION-RELESE for files,
199         -Tvn, --tag-version-nest
200                         - add cvs tags NEST and NAME-VERSION-RELESE for files,
201         -Ts, --tag-stable
202                         - add cvs tag STABLE for files,
203         -Tn, --tag-nest
204                         - add cvs tag NEST for files,
205         -Tv, --tag-version
206                         - add cvs tag NAME-VERSION-RELESE for files,
207         -Tp, --tag-prefix <prefix>
208                         - add <prefix> to NAME-VERSION-RELEASE tags,
209         -v, --verbose   - be verbose,
210         -u, --try-upgrade
211                         - check version, and try to upgrade package
212         -un, --try-upgrade-with-float-version
213                         - as above, but allow float version
214         -U, --update
215                         - refetch sources, don't use distfiles, and update md5 
216                           comments
217         -Upi, --update-poldek-indexes 
218                         - refresh or make poldek package index files.
219         --with/--without <feature>
220                         - conditional build package depending on
221                           %_with_<feature>/%_without_<feature> macro
222                           switch. 
223                           You may now use --with feat1 feat2 feat3 --without feat4
224                           feat5 --with feat6 constructions.
225 "
226 }
227
228 cache_rpm_dump () {
229    rpm_dump_cache=`
230         case "$RPMBUILD" in
231         rpm )
232                 rpm -bp --nodeps --define 'prep %dump' $BCOND $SPECFILE 2>&1 
233                 ;;
234         rpmbuild )
235                 rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $SPECFILE 2>&1 
236                 ;;
237         esac`
238 }
239
240 rpm_dump () {
241     if [ -z "$rpm_dump_cache" ] ; then
242         echo "internal error: cache_rpm_dump not called!" 1>&2
243     fi
244     echo "$rpm_dump_cache"
245 }
246
247 parse_spec()
248 {
249     if [ -n "$DEBUG" ]; then
250         set -x;
251         set -v;
252     fi
253
254     cd $SPECS_DIR
255
256     cache_rpm_dump
257
258     if [ "$NOSRCS" != "yes" ]; then
259         SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
260     fi
261     if (rpm_dump | grep -qEi ":.*nosource.*1"); then
262         FAIL_IF_NO_SOURCES="no"
263     fi
264
265     PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
266     ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
267     PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`"
268     PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -1`"
269     PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`"
270
271     if [ -n "$BE_VERBOSE" ]; then
272         echo "- Sources :  `nourl $SOURCES`"
273         if [ -n "$PATCHES" ]; then
274             echo "- Patches :  `nourl $PATCHES`"
275         else
276             echo "- Patches :  *no patches needed*"
277         fi
278         if [ -n "$ICONS" ]; then
279             echo "- Icon    :  `nourl $ICONS`"
280         else
281             echo "- Icon    :  *no package icon*"
282         fi
283         echo "- Name    : $PACKAGE_NAME"
284         echo "- Version : $PACKAGE_VERSION"
285         echo "- Release : $PACKAGE_RELEASE"
286     fi
287 }
288
289 Exit_error()
290 {
291     if [ -n "$DEBUG" ]; then
292         set -x;
293         set -v;
294     fi
295
296     cd $__PWD
297
298     case "$1" in
299     "err_no_spec_in_cmdl" )
300         remove_build_requires
301         echo "ERROR: spec file name not specified.";
302         exit 2 ;;
303     "err_no_spec_in_repo" )
304         remove_build_requires
305         echo "Error: spec file not stored in CVS repo.";
306         exit 3 ;;
307     "err_no_source_in_repo" )
308         remove_build_requires
309         echo "Error: some source, patch or icon files not stored in CVS repo. ($2)";
310         exit 4 ;;
311     "err_build_fail" )
312         remove_build_requires
313         echo "Error: package build failed. (${2:-no more info})";
314         exit 5 ;;
315     esac
316 }
317
318 init_builder()
319 {
320     if [ -n "$DEBUG" ]; then
321         set -x;
322         set -v;
323     fi
324
325     SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`"
326     SPECS_DIR="`$RPM --eval '%{_specdir}'`"
327
328     __PWD=`pwd`
329 }
330
331 get_spec()
332 {
333     if [ -n "$DEBUG" ]; then
334         set -x;
335         set -v;
336     fi
337
338     if [ "$NOCVSSPEC" != "yes" ]; then
339         cd $SPECS_DIR
340
341         OPTIONS="up "
342
343         if [ -n "$CVSROOT" ]; then
344             OPTIONS="-d $CVSROOT $OPTIONS"
345         else
346             if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
347                 echo "warning: No cvs access defined - using local .spec file"
348                 NOCVSSPEC="yes"
349             fi
350         fi
351
352         if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
353             OPTIONS="$OPTIONS -A"
354         else
355             if [ -n "$CVSDATE" ]; then
356                 OPTIONS="$OPTIONS -D $CVSDATE"
357             fi
358             if [ -n "$CVSTAG" ]; then
359                 OPTIONS="$OPTIONS -r $CVSTAG"
360             fi
361         fi
362
363         result=1
364         retries_counter=0
365         while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
366             retries_counter=$(( $retries_counter + 1 ))
367             output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1)
368             result=$?
369             [ -n "$output" ] && echo "$output"
370             if [ "$result" -ne "0" ]; then
371                 if (echo "$output" | grep -qE "(Cannot connect to|connect to .* failed|Connection reset by peer|Connection timed out|Unknown host)") && [ "$retries_counter" -le "$CVS_RETRIES" ]; then
372                     echo "Trying again [$SPECFILE]... ($retries_counter)"
373                     sleep 2
374                     continue
375                 fi
376                 Exit_error err_no_spec_in_repo;
377             fi
378         done
379     fi
380     if [ ! -f "$SPECFILE" ]; then
381         Exit_error err_no_spec_in_repo;
382     fi
383
384     if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
385         chmod $CHMOD_MODE $SPECFILE
386     fi
387     unset OPTIONS
388     grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
389 }
390
391 find_mirror(){
392
393     cd "$SPECS_DIR"
394     url="$1"
395     if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
396         cvs update mirrors >&2
397     fi
398
399     IFS="|"
400     while read origin mirror name rest; do
401         ol=`echo -n "$origin"|wc -c`
402         prefix="`echo -n "$url" | head -c $ol`"
403         if [ "$prefix" = "$origin" ] ; then
404             suffix="`echo "$url"|cut -b $ol-`"
405             echo -n "$mirror$suffix"
406             return 0
407         fi
408     done < mirrors
409     echo "$url"
410 }
411
412 src_no ()
413 {
414     cd $SPECS_DIR
415     rpm_dump | \
416         grep "SOURCEURL[0-9]*[  ]*$1""[         ]*$" | \
417         sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
418         head -1 | xargs
419 }
420
421 src_md5 ()
422 {
423     no=$(src_no "$1")
424     [ -z "$no" ] && return
425     cd $SPECS_DIR
426     spec_rev=$(grep $SPECFILE CVS/Entries | sed -e s:/$SPECFILE/:: -e s:/.*::)
427     if [ -z "$spec_rev" ]; then
428         spec_rev="$(head -1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
429     fi
430     spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
431     md5=$(grep -s -v '^#' additional-md5sums | \
432         grep -E "[      ]$(basename "$1")[      ]+${spec}([     ,]|\$)" | \
433         sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
434         grep -E '^[0-9a-f]{32}$')
435     if [ X"$md5" = X"" ] ; then
436         grep -i "#[     ]*Source$no-md5[        ]*:" $SPECFILE | sed -e 's/.*://' | xargs
437     else
438         if [ $(echo "$md5" | wc -l) != 1 ] ; then
439             echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
440         fi
441         echo "$md5" | tail -1
442     fi
443 }
444
445 distfiles_url ()
446 {
447     echo "$PROTOCOL$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
448 }
449
450 good_md5 ()
451 {
452     md5=$(src_md5 "$1")
453     [ "$md5" = "" ] || \
454     [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
455 }
456
457 get_files()
458 {
459     GET_FILES="$@"
460
461     if [ -n "$DEBUG" ]; then
462         set -x;
463         set -v;
464     fi
465
466     if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
467         cd $SOURCE_DIR
468
469         OPTIONS="up "
470         if [ -n "$CVSROOT" ]; then
471             OPTIONS="-d $CVSROOT $OPTIONS"
472         else
473             if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
474                 echo "warning: No cvs access defined for SOURCES"
475                 NOCVS="yes"
476             fi
477         fi
478         if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
479             OPTIONS="$OPTIONS -A"
480         else
481             if [ -n "$CVSDATE" ]; then
482                 OPTIONS="$OPTIONS -D $CVSDATE"
483             fi
484             if [ -n "$CVSTAG" ]; then
485                 OPTIONS="$OPTIONS -r $CVSTAG"
486             fi
487         fi
488         for i in $GET_FILES; do
489             if [ -n "$UPDATE5" ]; then
490                 if [ -n "$ADD5" ]; then
491                     [ `nourl $i` = "$i" ] && continue
492                     grep -qiE '^#[      ]*Source'$(src_no $i)'-md5[     ]*:' $SPECS_DIR/$SPECFILE && continue
493                 else
494                     grep -qiE '^#[      ]*Source'$(src_no $i)'-md5[     ]*:' $SPECS_DIR/$SPECFILE || continue
495                 fi
496             fi
497             FROM_DISTFILES=0
498             if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
499                 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
500                     echo "Warning: no URL given for $i"
501                 fi
502
503                 if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then
504                     if good_md5 "$i"; then
505                         echo "$(nourl "$i") having proper md5sum already exists"
506                         continue
507                     fi
508                     target=$(nourl "$i")
509                     url=$(distfiles_url "$i")
510                     if [ `echo $url | grep -E '^(\.|/)'` ]; then
511                         ${GETLOCAL} $url $target
512                     else
513                         FROM_DISTFILES=1
514                         if [ -z "$NOMIRRORS" ]; then
515                             url="`find_mirror "$url"`"
516                         fi
517                         ${GETURI} -O "$target" "$url" || \
518                             if [ `echo $url | grep -E 'ftp://'` ]; then
519                                 ${GETURI2} -O "$target" "$url"
520                             fi
521                         if ! test -s "$target"; then
522                             rm -f "$target"
523                             FROM_DISTFILES=0
524                         fi
525                     fi
526                 elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then
527                     # ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred
528                     result=1
529                     retries_counter=0
530                     while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
531                         retries_counter=$(( $retries_counter + 1 ))
532                         output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1)
533                         result=$?
534                         [ -n "$output" ] && echo "$output"
535                         if (echo "$output" | grep -qE "(Cannot connect to|connect to .* failed|Connection reset by peer|Connection timed out|Unknown host)") && [ "$result" -ne "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; then
536                                 echo "Trying again [`nourl $i`]... ($retries_counter)"
537                                 sleep 2
538                                 continue
539                         else
540                                 break
541                         fi
542                     done
543                 fi
544
545                 if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then
546                     if [ -z "$NOMIRRORS" ]; then
547                         im="`find_mirror "$i"`"
548                     else
549                         im="$i"
550                     fi
551                     ${GETURI} "$im" || \
552                         if [ `echo $im | grep -E 'ftp://'` ]; then ${GETURI2} "$im" ; fi
553                 fi
554
555
556             fi
557             srcno=$(src_no $i)
558             if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
559                 Exit_error err_no_source_in_repo $i;
560             elif [ -n "$UPDATE5" ] && \
561                 ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \
562                     [ -z "$(grep -E -i '^NoSource[      ]*:[    ]*'$i'([        ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \
563                 grep -q -i -E '^#[      ]*source'$(src_no $i)'-md5[     ]*:' $SPECS_DIR/$SPECFILE )
564             then
565                 echo "Updating source-$srcno md5."
566                 md5=$(md5sum `nourl $i` | cut -f1 -d' ')
567                 perl -i -ne '
568                                 print unless /^\s*#\s*Source'$srcno'-md5\s*:/i;
569                                 print "# Source'$srcno'-md5:\t'$md5'\n" 
570                                         if /^Source'$srcno'\s*:\s+/;
571                                 ' \
572                                 $SPECS_DIR/$SPECFILE
573             fi
574
575             if good_md5 "$i"; then
576                 :
577             elif [ "$FROM_DISTFILES" = 1 ]; then
578                 # wrong md5 from distfiles: remove the file and try again
579                 # but only once ...
580                 echo "MD5 sum mismatch. Trying full fetch."
581                 FROM_DISTFILES=2
582                 rm -f $target
583                 ${GETURI} -O "$target" "$url" || \
584                     if [ `echo $url | grep -E 'ftp://'` ]; then
585                         ${GETURI2} -O "$target" "$url"
586                     fi
587                 test -s "$target" || rm -f "$target"
588             fi
589
590             if good_md5 "$i"; then
591                 :
592             else
593                 echo "MD5 sum mismatch.  Use -U to refetch sources,"
594                 echo "or -5 to update md5 sums, if you're sure files are correct."
595                 Exit_error err_no_source_in_repo $i
596             fi
597         done
598
599         if [ "$CHMOD" = "yes" ]; then
600             CHMOD_FILES="`nourl $GET_FILES`"
601             if [ -n "$CHMOD_FILES" ]; then
602                 chmod $CHMOD_MODE $CHMOD_FILES
603             fi
604         fi
605         unset OPTIONS
606     fi
607 }
608
609 tag_files()
610 {
611     TAG_FILES="$@"
612
613     if [ -n "$DEBUG" ]; then
614         set -x;
615         set -v;
616     fi
617
618     if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
619         echo "Version: $PACKAGE_VERSION"
620         echo "Release: $PACKAGE_RELEASE"
621         # Check whether first character of PACKAGE_NAME is legal for tag name
622         if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
623             TAG_PREFIX=tag_
624         fi
625         TAGVER=$TAG_PREFIX$PACKAGE_NAME-`echo $PACKAGE_VERSION | sed -e "s/\./\_/g" -e "s/@/#/g"`-`echo $PACKAGE_RELEASE | sed -e "s/\./\_/g" -e "s/@/#/g"`
626         # Remove #kernel.version_release from TAGVER because tagging sources
627         # could occur with different kernel-headers than kernel-headers used at build time.
628         TAGVER=$(echo "$TAGVER" | sed -e 's/#.*//g')
629         if [ "$TAG_VERSION" = "yes" ]; then
630             echo "CVS tag: $TAGVER"
631         fi
632         if [ -n "$TAG" ]; then
633             echo "CVS tag: $TAG"
634         fi
635
636         OPTIONS="tag -F"
637         if [ -n "$CVSROOT" ]; then
638             OPTIONS="-d $CVSROOT $OPTIONS"
639         fi
640
641         cd $SOURCE_DIR
642         for i in $TAG_FILES; do
643             # don't tag non cvs files (ie. stored on distfiles)
644             [ "`nourl $i`" != "$i" ] && continue
645             if [ -f "`nourl $i`" ]; then
646                 if [ "$TAG_VERSION" = "yes" ]; then
647                     cvs $OPTIONS $TAGVER `nourl $i`
648                 fi
649                 if [ -n "$TAG" ]; then
650                     cvs $OPTIONS $TAG `nourl $i`
651                 fi
652             else
653                 Exit_error err_no_source_in_repo $i
654             fi
655         done
656
657         cd $SPECS_DIR
658         if [ "$TAG_VERSION" = "yes" ]; then
659             cvs $OPTIONS $TAGVER $SPECFILE
660         fi
661         if [ -n "$TAG" ]; then
662             cvs $OPTIONS $TAG $SPECFILE
663         fi
664
665         unset OPTIONS
666     fi
667 }
668
669 branch_files()
670 {
671     TAG=$1
672     echo "CVS branch tag: $TAG"
673     shift;
674
675     TAG_FILES="$@"
676
677     if [ -n "$DEBUG" ]; then
678         set -x;
679         set -v;
680     fi
681
682     if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
683
684         OPTIONS="tag -b"
685         if [ -n "$CVSROOT" ]; then
686             OPTIONS="-d $CVSROOT $OPTIONS"
687         fi
688         cd $SOURCE_DIR
689         for i in $TAG_FILES; do
690             if [ -f `nourl $i` ]; then
691                 cvs $OPTIONS $TAG `nourl $i`
692             else
693                 Exit_error err_no_source_in_repo $i
694             fi
695         done
696         cd $SPECS_DIR
697         cvs $OPTIONS $TAG $SPECFILE
698
699         unset OPTIONS
700     fi
701 }
702
703
704
705 build_package()
706 {
707     if [ -n "$DEBUG" ]; then
708         set -x;
709         set -v;
710     fi
711
712     cd $SPECS_DIR
713
714     if [ -n "$TRY_UPGRADE" ]; then
715
716         if [ -n "$FLOAT_VERSION" ]; then
717             TNOTIFY=`./pldnotify.awk $SPECFILE -n`
718         else
719             TNOTIFY=`./pldnotify.awk $SPECFILE`
720         fi
721
722         TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
723
724         if [ -n "$TNEWVER" ]; then
725
726             TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
727
728             echo "New version found, updating spec file to version " $TNEWVER
729
730             cp -f $SPECFILE $SPECFILE.bak
731
732             chmod +w $SPECFILE
733
734             eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
735             eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t1/' $SPECFILE"
736
737             parse_spec;
738
739             get_files "$SOURCES $PATCHES";
740
741             unset TOLDVER TNEWVER TNOTIFY
742         fi
743
744     fi
745
746
747     cd $SPECS_DIR
748
749     case "$COMMAND" in
750         build )
751             BUILD_SWITCH="-ba" ;;
752         build-binary )
753             BUILD_SWITCH="-bb" ;;
754         build-source )
755             BUILD_SWITCH="-bs --nodeps" ;;
756     esac
757     if [ -n "$LOGFILE" ]; then
758         LOG=`eval echo $LOGFILE`
759         if [ -n "$LASTLOG_FILE" ]; then
760             echo "LASTLOG=$LOG" > $LASTLOG_FILE
761         fi
762         RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
763         (time nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
764         RETVAL=`cat $RES_FILE`
765         rm $RES_FILE
766         if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
767             if [ "$RETVAL" -eq "0" ]; then
768                 mv $LOG $LOGDIROK
769             else
770                 mv $LOG $LOGDIRFAIL
771             fi
772         fi
773     else
774         eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE
775         RETVAL=$?
776     fi
777
778     if [ "$RETVAL" -ne "0" ]; then
779
780         if [ -n "$TRY_UPGRADE" ]; then
781             echo "\n!!! Package with new version cannot be build automagically\n"
782             mv -f $SPECFILE.bak $SPECFILE
783         fi
784
785         Exit_error err_build_fail;
786     fi
787
788     unset BUILD_SWITCH
789 }
790
791 nourl()
792 {
793     echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
794 }
795
796 set_bconds_values()
797 {
798 AVAIL_BCONDS_WITHOUT=""
799 AVAIL_BCONDS_WITH=""
800 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_without_`
801 do
802         AVAIL_BCOND_WITHOUT=`echo $opt|sed -e "s/^_without_//g"`
803         if [ "`echo $BCOND|grep -- "--without $AVAIL_BCOND_WITHOUT"`" != "" ];then
804                 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
805         else
806                 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
807         fi
808 done
809
810 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_with_`
811 do
812         AVAIL_BCOND_WITH=`echo $opt|sed -e "s/^_with_//g"`
813         if [ "`echo $BCOND|grep -- "--with $AVAIL_BCOND_WITH"`" != "" ];then
814                 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
815         else
816                 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
817         fi
818 done
819 }
820
821 remove_build_requires()
822 {
823     if [ "$INSTALLED_PACKAGES" != "" ]; then
824             case "$REMOVE_BUILD_REQUIRES" in
825                     "force")
826                         poldek --noask -e $INSTALLED_PACKAGES
827                     ;;
828                     "nice")
829                         poldek --ask -e $INSTALLED_PACKAGES
830                     ;;
831                     *)
832                             echo You may want to manually remove following BuildRequires fetched:
833                             echo $INSTALLED_PACKAGES
834                     ;;
835             esac
836     fi
837 }
838
839 display_bconds()
840 {
841 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
842         echo -ne "We are going to build $SPECFILE with the following conditional flags:\n"
843         if [ "$BCOND" != "" ]; then
844                 echo -ne "$BCOND"
845         else
846                 echo -ne "No --with || --without conditions passed to $0!"
847         fi
848         echo -ne "\n\nfrom available:\n\n"
849         echo -ne "--with   :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
850 fi
851 }
852
853 fetch_build_requires()
854 {
855 if [ "$FETCH_BUILD_REQUIRES" == "yes" ]; then
856             for package_item in `cat $SPECFILE|grep -B100000 ^%changelog|grep -v ^#|grep BuildRequires|grep -v ^-|sed -e "s/^.*BuildRequires://g"|awk '{print $1}'|sed -e s,\(.*\),,g -e s,%{,,g`
857             do
858                 package_item=`echo $package_item|sed -e s,rpmbuild,rpm-build,g`
859                 GO="yes"
860                 package=`basename "$package_item"|sed -e "s/}$//g"`
861                 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
862                 mach=`uname -m`
863                 
864                 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
865                 if [ "`echo $COND_TST|grep '^BuildRequires:'`" != "" ]; then
866                         if [ "$COND_ARCH_TST" != "" ] && [ "`echo $COND_ARCH_TST|sed -e "s/i.86/ix86/g"`" != "`echo $mach|sed -e "s/i.86/ix86/g"`" ]; then
867                                 GO="yes"
868                         fi
869                 # bcond:
870                 else
871                         COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
872                         GO=""
873                         # %{without}
874                         if [ "`echo $COND_TST|grep 'without_'`" != "" ]; then
875                                 COND_NAME=`echo $COND_NAME|sed -e s,^.*_without_,,g`
876                                 if [ "`echo $COND_TST|grep !`" != "" ]; then
877                                         COND_STATE="with"
878                                 else
879                                         COND_STATE="wout"
880                                 fi
881                                 if [ "`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`" != "" ]; then
882                                         COND_ARGV="wout"
883                                 else
884                                         COND_ARGV="with"
885                                 fi
886                         # %{with}
887                         elif [ "`echo $COND_TST|grep 'with_'`" != "" ]; then
888                                 COND_NAME=`echo $COND_NAME|sed -e s,^.*_with_,,g`
889                                 if [ "`echo $COND_TST|grep !`" != "" ]; then
890                                         COND_STATE="wout"
891                                 else
892                                         COND_STATE="with"
893                                 fi                                      
894                                 if [ "`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`" != "" ]; then
895                                         COND_ARGV="with"
896                                 else
897                                         COND_ARGV="wout"
898                                 fi      
899                         fi
900                         RESULT="${COND_STATE}-${COND_ARGV}"
901                         case "$RESULT" in 
902                                 "with-wout" | "wout-with" )
903                                         GO=""
904                                         ;;
905                                 "wout-wout" | "with-with" )
906                                         GO="yes"
907                                         ;;
908                                 * )
909                                         echo "Action '$RESULT' was not defined for package '$package_item'"
910                                         ;;
911                         esac
912
913                 fi
914                
915                 if [ "$GO" == "yes" ]; then
916                         if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
917                                 echo "$package [package not installed. installing]"
918                                 poldek -t -i $package --dumpn="$package-req.txt"
919                                 for package_name in `cat "$package-req.txt"|grep -v ^#`
920                                 do 
921                                         if [ "$package_name" == "$package" ]; then
922                                                 echo -ne "$package [installing BuildRequired package]:\t$package_name\n"
923                                                 poldek -i $package_name
924                                         else
925                                                 echo -ne "$package [installing Required package]:\t$package_name\n"
926                                                 poldek -i $package_name
927                                         fi
928                                         case $? in
929                                         1)
930                                                 echo -ne "$package [package installation failed]:\t$package_name\n"
931                                                 #
932                                                 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
933                                                 # pakieta zbudowaæ. 
934                                                 #
935                                                 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
936                                                 ;;
937                                         0)
938                                                 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
939                                                 ;;
940                                         esac
941                                 done
942                                 rm "$package-req.txt"
943                         else
944                                 echo "Package $package is already installed. BuildRequirement satisfied."
945                         fi
946                 fi
947             done
948             if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
949                     echo "Nie uda³o siê zainstalowaæ nastêpuj±cych pakietów i ich zale¿no¶ci:"
950                     for pkg in "$NOT_INSTALLED_PACKAGES"
951                     do
952                             echo $pkg
953                     done
954                     remove_build_requires
955                     exit 1
956             fi
957 fi
958 }
959
960 #---------------------------------------------
961 # main()
962
963 if [ "$#" = 0 ]; then
964     usage;
965     exit 1
966 fi
967
968 while test $# -gt 0 ; do
969     case "${1}" in
970         -5 | --update-md5 )
971             COMMAND="get";
972             NODIST="yes"
973             NOCVSSPEC="yes"
974             UPDATE5="yes"
975             shift ;;
976         -a5 | --add-md5 )
977             COMMAND="get";
978             NODIST="yes"
979             NOCVS="yes"
980             NOCVSSPEC="yes"
981             UPDATE5="yes"
982             ADD5="yes"
983             shift ;;
984         -D | --debug )
985             DEBUG="yes"; shift ;;
986         -V | --version )
987             COMMAND="version"; shift ;;
988         -a | --as_anon )
989             CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
990         -b | -ba | --build )
991             COMMAND="build"; shift ;;
992         -bb | --build-binary )
993             COMMAND="build-binary"; shift ;;
994         -bs | --build-source )
995             COMMAND="build-source"; shift ;;
996         -B | --branch )
997             COMMAND="branch"; shift; TAG="${1}"; shift;;
998         -c | --clean )
999             CLEAN="--clean --rmspec --rmsource"; shift ;;
1000         -d | --cvsroot )
1001             shift; CVSROOT="${1}"; shift ;;
1002         -g | --get )
1003             COMMAND="get"; shift ;;
1004         -h | --help )
1005             COMMAND="usage"; shift ;;
1006         --http )
1007             PROTOCOL="http"; shift ;;
1008         -l | --logtofile )
1009             shift; LOGFILE="${1}"; shift ;;
1010         -ni| --nice )
1011             shift; DEF_NICE_LEVEL=${1}; shift ;;
1012         -m | --mr-proper )
1013             COMMAND="mr-proper"; shift ;;
1014         -nc | --no-cvs )
1015             NOCVS="yes"; shift ;;
1016         -ncs | --no-cvs-specs )
1017             NOCVSSPEC="yes"; shift ;;
1018         -nd | --no-distfiles )
1019             NODIST="yes"; shift ;;
1020         -nm | --no-mirrors )
1021             NOMIRRORS="yes"; shift ;;
1022         -nu | --no-urls )
1023             NOURLS="yes"; shift ;;
1024         -ns | --no-srcs )
1025             NOSRCS="yes"; shift ;;
1026         -ns0 | --no-source0 )
1027             NOSOURCE0="yes"; shift ;;
1028         --opts )
1029             shift; RPMOPTS="${1}"; shift ;;
1030         --with | --without )
1031             case $GROUP_BCONDS in
1032                 "yes")
1033                         COND=${1}
1034                         shift
1035                         while [ "`echo ${1}|grep ^-`" == "" ] && [ "`echo ${1}|grep spec`" == "" ]
1036                         do
1037                                 BCOND="$BCOND $COND $1"
1038                                 shift
1039                         done;;
1040                 "no")
1041                         BCOND="$BCOND $1 $2" ; shift 2 ;;
1042             esac
1043             ;;
1044         -q | --quiet )
1045             QUIET="--quiet"; shift ;;
1046         --date )
1047             CVSDATE="${2}"; shift 2 ;;
1048         -r | --cvstag )
1049             shift; CVSTAG="${1}"; shift ;;
1050         -R | --fetch-build-requires)
1051             FETCH_BUILD_REQUIRES="yes"
1052             #UPDATE_POLDEK_INDEXES="yes"
1053             NOT_INSTALLED_PACKAGES=
1054             shift ;;
1055         -RB | --remove-build-requires)
1056             REMOVE_BUILD_REQUIRES="nice"
1057             shift ;;
1058         -FRB | --force-remove-build-requires)
1059             REMOVE_BUILD_REQUIRES="force"
1060             shift ;;
1061         -Tvs | --tag-version-stable )
1062             COMMAND="tag";
1063             TAG="STABLE"
1064             TAG_VERSION="yes"
1065             shift;;
1066         -Tvn | --tag-version-nest )
1067             COMMAND="tag";
1068             TAG="NEST"
1069             TAG_VERSION="yes"
1070             shift;;
1071         -Ts | --tag-stable )
1072             COMMAND="tag";
1073             TAG="STABLE"
1074             TAG_VERSION="no"
1075             shift;;
1076         -Tn | --tag-nest )
1077             COMMAND="tag";
1078             TAG="NEST"
1079             TAG_VERSION="no"
1080             shift;;
1081         -Tv | --tag-version )
1082             COMMAND="tag";
1083             TAG=""
1084             TAG_VERSION="yes"
1085             shift;;
1086         -Tp | --tag-prefix )
1087             TAG_PREFIX="$2"
1088             shift 2;;
1089         -T | --tag )
1090             COMMAND="tag";
1091             shift
1092             TAG="$1"
1093             TAG_VERSION="no"
1094             shift;;
1095         -U | --update )
1096             COMMAND="get"
1097             UPDATE="yes"
1098             NOCVSSPEC="yes"
1099             NODIST="yes"
1100             UPDATE5="yes"
1101             shift ;;
1102         -Upi | --update-poldek-indexes )
1103             UPDATE_POLDEK_INDEXES="yes"
1104             shift ;;
1105         -u | --try-upgrade )
1106             TRY_UPGRADE="1"; shift ;;
1107         -un | --try-upgrade-with-float-version )
1108             TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
1109         -v | --verbose )
1110             BE_VERBOSE="1"; shift ;;
1111         --define)
1112             shift
1113             MACRO="${1}"
1114             VALUE="${2}"
1115             shift 2
1116             RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
1117             ;;
1118         --nodeps)
1119             shift
1120             RPMOPTS="${RPMOPTS} --nodeps"
1121             ;;
1122         * )
1123             SPECFILE="`basename ${1} .spec`.spec"; shift ;;
1124     esac
1125 done
1126
1127 if [ -n "$DEBUG" ]; then
1128     set -x;
1129     set -v;
1130 fi
1131
1132 case "$COMMAND" in
1133     "build" | "build-binary" | "build-source" )
1134         init_builder;
1135         if [ -n "$SPECFILE" ]; then
1136             get_spec;
1137             set_bconds_values;
1138             display_bconds;
1139             fetch_build_requires;
1140             parse_spec;
1141
1142             if [ -n "$FAIL_IF_CHANGED_BUT_NOT_BUMPED" ]; then
1143                 TAGVER=$PACKAGE_NAME-`echo $PACKAGE_VERSION | sed -e "s/\./\_/g" -e "s/@/#/g"`-`echo $PACKAGE_RELEASE | sed -e "s/\./\_/g" -e "s/@/#/g"`
1144                 CURTAGREL=$(cvs status $SPECFILE | grep "Working revision:" | awk '{ print $3 }')
1145                 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
1146
1147                 if [ -n "$TAGREL" -a "$TAGREL" != "$CURTAGREL" ]; then
1148                     Exit_error err_build_fail "not bumped ver-rel - was already used in rev $TAGREL"
1149                 fi
1150             fi
1151
1152             if [ -n "$ICONS" ]; then
1153                 get_files $ICONS;
1154                 parse_spec;
1155             fi
1156             if [ -n "$NOSOURCE0" ] ; then
1157                 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
1158             fi
1159             get_files "$SOURCES $PATCHES";
1160             build_package;
1161             if [ $? -eq 0 ] && [ "$UPDATE_POLDEK_INDEXES" == "yes" ]; then
1162                     poldek --sn ${POLDEK_SOURCE} --mkidx="${POLDEK_INDEX_DIR}/packages.dir.gz"
1163                     poldek --sn ${POLDEK_SOURCE} --up
1164             fi
1165             remove_build_requires;
1166         else
1167             Exit_error err_no_spec_in_cmdl;
1168         fi
1169         ;;
1170     "branch" )
1171         init_builder;
1172         if [ -n "$SPECFILE" ]; then
1173                 get_spec;
1174                 parse_spec;
1175                 if [ -n "$ICONS" ]; then
1176                         get_files $ICONS
1177                         parse_spec;
1178                 fi
1179                 get_files $SOURCES $PATCHES;
1180                 branch_files $TAG "$SOURCES $PATCHES $ICONS";
1181         else
1182                 Exit_error err_no_spec_in_cmdl;
1183         fi
1184         ;;
1185     "get" )
1186         init_builder;
1187         if [ -n "$SPECFILE" ]; then
1188             get_spec;
1189             parse_spec;
1190             if [ -n "$ICONS" ]; then
1191                 get_files $ICONS
1192                 parse_spec;
1193             fi
1194             if [ -n "$NOSOURCE0" ] ; then
1195                 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
1196             fi
1197             get_files $SOURCES $PATCHES
1198         else
1199             Exit_error err_no_spec_in_cmdl;
1200         fi
1201         ;;
1202     "tag" )
1203         init_builder;
1204         if [ -n "$SPECFILE" ]; then
1205             get_spec;
1206             parse_spec;
1207             if [ -n "$ICONS" ]; then
1208                 get_files $ICONS
1209                 parse_spec;
1210             fi
1211             # don't fetch sources from remote locations
1212             new_SOURCES=""
1213             for file in $SOURCES; do
1214                 [ "`nourl $file`" != "$file" ] && continue
1215                 new_SOURCES="$new_SOURCES $file"
1216             done
1217             SOURCES="$new_SOURCES"
1218             get_files $SOURCES $PATCHES;
1219             tag_files "$SOURCES $PATCHES $ICONS";
1220         else
1221             Exit_error err_no_spec_in_cmdl;
1222         fi
1223         ;;
1224     "mr-proper" )
1225         $RPM --clean --rmsource --rmspec --force --nodeps $SPECFILE
1226         ;;
1227     "usage" )
1228         usage;;
1229     "version" )
1230         echo "$VERSION";;
1231 esac
1232 cd $__PWD
This page took 0.09979 seconds and 2 git commands to generate.