]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - builder.sh
- leave /usr/sbin/{chsh,usermod} untouched
[packages/rpm-build-tools.git] / builder.sh
CommitLineData
cd445739
AM
1#!/bin/sh
2# -----------
3# $Id$
4# Exit codes:
2a5f078d 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# 8 - Failed installing buildrequirements and subrequirements
14# 9 - Requested tag already exist
15# 10 - Refused to build fractional release
16# 100 - Unknown error (should not happen)
cd445739
AM
17
18# Notes (todo):
f7b91886 19# - builder -u fetches current version first (well that's okay, how you compare versions if you have no old spec?)
cd445739 20# - when Icon: field is present, -5 and -a5 doesn't work
f3ada241 21# - builder -R skips installing BR if spec is not present before builder invocation (need to run builder twice)
931a4acf 22
4003ad8c 23VERSION="\
c9acaed9 24Build package utility from PLD Linux CVS repository
7304d35c 25V 0.13 (C) 1999-2005 Free Penguins".
d6a77ddb 26PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
b03f053b 27
cd445739 28COMMAND="build"
64ea5308 29TARGET=""
cd445739 30
bde1c404 31SPECFILE=""
d287305c 32BE_VERBOSE=""
4003ad8c 33QUIET=""
cd445739
AM
34CLEAN=""
35DEBUG=""
36NOURLS=""
37NOCVS=""
38NOCVSSPEC=""
39NODIST=""
40UPDATE=""
41UPDATE5=""
42ADD5=""
43NO5=""
f5985980 44ADAPTERIZE=""
cd445739 45ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
c8f50498 46CVSROOT=""
cd445739
AM
47
48# It can be used i.e. in log file naming.
49# See LOGFILE example.
50DATE=`date +%Y-%m-%d_%H-%M-%S`
51
52# Example: LOGFILE='../log.$PACKAGE_NAME'
53# Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
54# Yes, you can use variable name! Note _single_ quotes!
55LOGFILE=''
56
57LOGDIR=""
58LOGDIROK=""
59LOGDIRFAIL=""
60LASTLOG_FILE=""
61
62CHMOD="no"
63CHMOD_MODE="0444"
64RPMOPTS=""
65BCOND=""
66GROUP_BCONDS="no"
947025e5 67CVSIGNORE_DF="no"
d287305c 68
69PATCHES=""
70SOURCES=""
cd445739 71ICONS=""
d287305c 72PACKAGE_RELEASE=""
73PACKAGE_VERSION=""
74PACKAGE_NAME=""
cd445739
AM
75PROTOCOL="ftp"
76WGET_RETRIES=${MAX_WGET_RETRIES:-0}
77CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
78
79CVSTAG=""
80RES_FILE=""
81
82CVS_SERVER="cvs.pld-linux.org"
83DISTFILES_SERVER="://distfiles.pld-linux.org"
d4730dae 84ATTICDISTFILES_SERVER="://attic-distfiles.pld-linux.org"
cd445739 85
36d03934 86DEF_NICE_LEVEL=19
cd445739
AM
87
88FAIL_IF_NO_SOURCES="yes"
89
ab4a2b6e
ER
90if [ -x /usr/bin/rpm-getdeps ]; then
91 FETCH_BUILD_REQUIRES_RPMGETDEPS="yes"
92else
93 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
94fi
95
cd445739
AM
96# Here we load saved user environment used to
97# predefine options set above, or passed to builder
98# in command line.
99# This one reads global system environment settings:
100if [ -f ~/etc/builderrc ]; then
101 . ~/etc/builderrc
102fi
103# And this one cascades settings using user personal
104# builder settings.
105# Example of ~/.builderrc:
106#
107#UPDATE_POLDEK_INDEXES="yes"
108#FETCH_BUILD_REQUIRES="yes"
109#REMOVE_BUILD_REQUIRES="force"
110#GROUP_BCONDS="yes"
111#LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
112#
a83e5405 113SU_SUDO=""
cd445739
AM
114if [ -n "$HOME_ETC" ]; then
115 USER_CFG="$HOME_ETC/.builderrc"
116else
117 USER_CFG=~/.builderrc
118fi
119
120[ -f "$USER_CFG" ] && . "$USER_CFG"
121
06f3864d
AM
122wget --help 2>&1 | grep -q ' \-\-no-check\-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
123
ca2e6c31 124if [ -n "$USE_PROZILLA" ]; then
7e365483
KK
125 GETURI="proz --no-getch -r -P ./ -t$WGET_RETRIES $PROZILLA_OPTS"
126 GETURI2="$GETURI"
127 OUTFILEOPT="-O"
ca2e6c31 128elif [ -n "$USE_AXEL" ]; then
cede92b3 129 GETURI="axel -a $AXEL_OPTS"
7e365483
KK
130 GETURI2="$GETURI"
131 OUTFILEOPT="-o"
ca2e6c31 132else
7e365483
KK
133 wget --help 2>&1 | grep -q ' \-\-inet ' && WGET_OPTS="$WGET_OPTS --inet"
134 wget --help 2>&1 | grep -q ' \-\-retry\-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
6f9a5d76 135
7e365483
KK
136 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
137 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
138 OUTFILEOPT="-O"
2bc5451f 139fi
11468b23 140
11468b23
AM
141GETLOCAL="cp -a"
142
143if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
144 RPM="rpm"
145 RPMBUILD="rpm"
146else
147 RPM="rpm"
148 RPMBUILD="rpmbuild"
149fi
150
151POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
a83e5405 152POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
11468b23 153
cd445739
AM
154run_poldek()
155{
156 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
157 if [ -n "$LOGFILE" ]; then
158 LOG=`eval echo $LOGFILE`
159 if [ -n "$LASTLOG_FILE" ]; then
160 echo "LASTLOG=$LOG" > $LASTLOG_FILE
161 fi
040282bb 162 (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
cd445739
AM
163 return $exit_pldk
164 else
165 (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
166 return `cat ${RES_FILE}`
167 rm -rf ${RES_FILE}
168 fi
169}
170
cd445739
AM
171#---------------------------------------------
172# functions
da946cd6 173
5a491465 174usage()
175{
cd445739
AM
176 if [ -n "$DEBUG" ]; then set -xv; fi
177 echo "\
178Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build]
81f85806 179
cd445739
AM
180[-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade]
181[{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get]
182[-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
183[-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>]
184[-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest]
185[-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version]
186[{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}]
dfe2cb9a 187[-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--show-bconds]
cd445739 188[--with/--without <feature>] [--define <macro> <value>] <package>[.spec]
2a5f078d 189
cd445739 190-5, --update-md5 - update md5 comments in spec, implies -nd -ncs
15caef33 191--adapter[ize] - run adapter.awk on SPECFILE
cd445739
AM
192-a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
193-n5, --no-md5 - ignore md5 comments in spec
9243e80b
ER
194-D, --debug - enable builder script debugging mode,
195-debug - produce rpm debug package (same as --opts -debug)
cd445739
AM
196-V, --version - output builder version
197-a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
198-b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
199 from <package>.spec,
200-bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
201 only package from <package>.spec,
202-bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
203 them into src.rpm,
204-bp, --build-prep - execute the %prep phase of <package>.spec,
205-B, --branch - add branch
206-c, --clean - clean all temporarily created files (in BUILD, SOURCES,
207 SPECS and \$RPM_BUILD_ROOT),
2a5f078d 208-d <cvsroot>, --cvsroot <cvsroot>
cd445739
AM
209 - setup \$CVSROOT,
210--define <macro> <value>
211 - define a macro <macro> with value <value>,
212--nodeps - rpm won't check any dependences
213-g, --get - get <package>.spec and all related files from CVS repo
214 or HTTP/FTP,
215-h, --help - this message,
216--http - use http instead of ftp,
217-l <logfile>, --logtofile <logfile>
218 - log all to file,
219-m, --mr-proper - only remove all files related to spec file and all work
220 resources,
221-nc, --no-cvs - don't download sources from CVS, if source URL is given,
222-ncs, --no-cvs-specs
223 - don't check specs in CVS
224-nd, --no-distfiles - don't download from distfiles
225-nm, --no-mirrors - don't download from mirror, if source URL is given,
226-nu, --no-urls - don't try to download from FTP/HTTP location,
227-ns, --no-srcs - don't download Sources
228-ns0, --no-source0 - don't download Source0
229-nn, --no-net - don't download anything from the net
230--opts <rpm opts> - additional options for rpm
231-q, --quiet - be quiet,
232--date yyyy-mm-dd - build package using resources from specified CVS date,
233-r <cvstag>, --cvstag <cvstag>
234 - build package using resources from specified CVS tag,
235-R, --fetch-build-requires
236 - fetch what is BuildRequired,
237-RB, --remove-build-requires
238 - remove all you fetched with -R or --fetch-build-requires
239 remember, this option requires confirmation,
240-FRB, --force-remove-build-requires
241 - remove all you fetched with -R or --fetch-build-requires
242 remember, this option works without confirmation,
a7eefc54 243-sf, --source-files - list sources - bare filenames (intended for offline
244 operations; does not work when Icon field is present
245 but icon file is absent),
246-sp, --source-paths - list sources - filenames with full local paths (intended for
247 offline operations; does not work when Icon field is present
248 but icon file is absent),
cd445739
AM
249-T <cvstag> , --tag <cvstag>
250 - add cvs tag <cvstag> for files,
251-Tvs, --tag-version-stable
094bd95b 252 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
cd445739 253-Tvn, --tag-version-nest
1691a37b 254 - add cvs tags NEST and NAME-VERSION-RELEASE for files,
cd445739
AM
255-Ts, --tag-stable
256 - add cvs tag STABLE for files,
257-Tn, --tag-nest
258 - add cvs tag NEST for files,
259-Tv, --tag-version
1691a37b 260 - add cvs tag NAME-VERSION-RELEASE for files,
cd445739
AM
261-Tp, --tag-prefix <prefix>
262 - add <prefix> to NAME-VERSION-RELEASE tags,
263-tt, --test-tag <prefix>
264 - fail if tag is already present,
50321881
JK
265-ir, --integer-release-only
266 - allow only integer and snapshot releases
cd445739
AM
267-v, --verbose - be verbose,
268-u, --try-upgrade - check version, and try to upgrade package
269-un, --try-upgrade-with-float-version
270 - as above, but allow float version
deccc50e 271-U, --update - refetch sources, don't use distfiles, and update md5 comments
cd445739
AM
272-Upi, --update-poldek-indexes
273 - refresh or make poldek package index files.
c890b916 274-np, --nopatch <patchnumber>
bed98670 275 - don't apply <patchnumber>
dfe2cb9a
MK
276--show-bconds - show available conditional builds, which can be used
277 - with --with and/or --without switches.
cd445739
AM
278--with/--without <feature>
279 - conditional build package depending on %_with_<feature>/
280 %_without_<feature> macro switch. You may now use
281 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
282 constructions. Set GROUP_BCONDS to yes to make use of it.
6dd19291 283--target <platform>, --target=<platform>
64ea5308 284 - build for platform <platform>.
5a491465 285"
286}
287
c890b916 288update_shell_title() {
2e5be021 289 local msg="builder[$SPECFILE] $*"
c890b916
ER
290 case "$TERM" in
291 cygwin|xterm*)
2e5be021 292 echo -ne "\033]1;$msg\007\033]2;$msg\007"
c890b916
ER
293 ;;
294 screen*)
2e5be021 295 echo -ne "\033]0;$msg\007"
c890b916
ER
296 ;;
297 esac
298}
299
7e40520f
ER
300# set TARGET from BuildArch: from SPECFILE
301set_spec_target() {
302 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
303 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
304 if [ "$tmp" ]; then
305 TARGET="$tmp"
306 case "$RPMBUILD" in
307 "rpmbuild")
308 TARGET_SWITCH="--target $TARGET" ;;
309 "rpm")
310 TARGET_SWITCH="--target=$TARGET" ;;
311 esac
312 fi
313 fi
314}
315
cd445739 316cache_rpm_dump () {
b2aeec7d
AM
317 if [ -n "$DEBUG" ]; then
318 set -x;
319 set -v;
320 fi
7e40520f 321
cd445739
AM
322rpm_dump_cache=`
323 case "$RPMBUILD" in
324 rpm )
2a5f078d 325 rpm -bp --nodeps --define 'prep %dump' $BCOND $TARGET_SWITCH $SPECFILE 2>&1
cd445739
AM
326 ;;
327 rpmbuild )
2f810e46 328 rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $TARGET_SWITCH $SPECFILE 2>&1
cd445739
AM
329 ;;
330 esac`
331}
332
333rpm_dump () {
334 if [ -z "$rpm_dump_cache" ] ; then
335 echo "internal error: cache_rpm_dump not called!" 1>&2
336 fi
337 echo "$rpm_dump_cache"
338}
339
59398507 340parse_spec()
341{
2e5be021 342 update_shell_title "parse_spec"
cd445739
AM
343 if [ -n "$DEBUG" ]; then
344 set -x;
345 set -v;
346 fi
b2975fc3 347
cd445739 348 cd $SPECS_DIR
4ca52257 349
cd445739 350 cache_rpm_dump
00fcec7e 351
cd445739
AM
352 if [ "$NOSRCS" != "yes" ]; then
353 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
354 fi
355 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
356 FAIL_IF_NO_SOURCES="no"
357 fi
358
359 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
360 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
361 PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
362 PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -n 1`"
363 PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
364
341603cf 365# These variables may be unset after first cache_rpm_dump call
366# (because of not-yet-retrieved icon file)
367#
368# if [ -z "$PACKAGE_NAME" -o -z "$PACKAGE_VERSION" -o -z "$PACKAGE_RELEASE" ]; then
369# Exit_error err_no_package_data;
370# fi
78eab2a1 371
cd445739
AM
372 if [ -n "$BE_VERBOSE" ]; then
373 echo "- Sources : `nourl $SOURCES`"
374 if [ -n "$PATCHES" ]; then
375 echo "- Patches : `nourl $PATCHES`"
376 else
377 echo "- Patches : *no patches needed*"
378 fi
379 if [ -n "$ICONS" ]; then
380 echo "- Icon : `nourl $ICONS`"
381 else
382 echo "- Icon : *no package icon*"
383 fi
384 echo "- Name : $PACKAGE_NAME"
385 echo "- Version : $PACKAGE_VERSION"
386 echo "- Release : $PACKAGE_RELEASE"
387 fi
388}
389
390Exit_error()
391{
392 if [ -n "$DEBUG" ]; then
393 set -x;
394 set -v;
395 fi
396
397 cd "$__PWD"
398
399 case "$1" in
400 "err_no_spec_in_cmdl" )
401 remove_build_requires
402 echo "ERROR: spec file name not specified.";
403 exit 2 ;;
404 "err_no_spec_in_repo" )
405 remove_build_requires
406 echo "Error: spec file not stored in CVS repo.";
407 exit 3 ;;
408 "err_no_source_in_repo" )
409 remove_build_requires
410 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)";
411 exit 4 ;;
412 "err_build_fail" )
413 remove_build_requires
414 echo "Error: package build failed. (${2:-no more info})";
415 exit 5 ;;
78eab2a1
AM
416 "err_no_package_data" )
417 remove_build_requires
418 echo "Error: couldn't get out package name/version/release from spec file."
419 exit 6 ;;
50321881
JK
420 "err_tag_exists" )
421 remove_build_requires
422 echo "Tag ${2} already exists (spec release: ${3}).";
423 exit 9 ;;
424 "err_fract_rel" )
425 remove_build_requires
426 echo "Release ${2} not integer and not a snapshot.";
427 exit 10 ;;
fb96e0b5
AM
428 "err_branch_exists" )
429 remove_build_requires
430 echo "Tree branch already exists (${2}).";
431 exit 11 ;;
50321881 432
cd445739 433 esac
50321881 434 echo "Unknown error."
2a5f078d 435 exit 100
cd445739
AM
436}
437
438init_builder()
439{
440 if [ -n "$DEBUG" ]; then
441 set -x;
442 set -v;
0dd6320d 443 fi
cd445739
AM
444
445 SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`"
446 SPECS_DIR="`$RPM --eval '%{_specdir}'`"
447
448 __PWD="`pwd`"
00fcec7e 449}
450
d6a77ddb 451get_spec()
1471f6d6 452{
c890b916 453
2e5be021 454 update_shell_title "get_spec"
c890b916 455
cd445739
AM
456 if [ -n "$DEBUG" ]; then
457 set -x;
458 set -v;
459 fi
460
461 cd "$SPECS_DIR"
462 if [ \! -f "$SPECFILE" ]; then
463 SPECFILE="`basename $SPECFILE .spec`.spec";
464 fi
465 if [ "$NOCVSSPEC" != "yes" ]; then
466 OPTIONS="up "
467
468 if [ -n "$CVSROOT" ]; then
469 OPTIONS="-d $CVSROOT $OPTIONS"
470 else
471 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
472 echo "warning: No cvs access defined - using local .spec file"
473 NOCVSSPEC="yes"
474 fi
475 fi
476
477 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
478 OPTIONS="$OPTIONS -A"
479 else
480 if [ -n "$CVSDATE" ]; then
481 OPTIONS="$OPTIONS -D $CVSDATE"
482 fi
483 if [ -n "$CVSTAG" ]; then
484 OPTIONS="$OPTIONS -r $CVSTAG"
485 fi
486 fi
487
488 result=1
489 retries_counter=0
490 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
491 do
492 retries_counter=$(( $retries_counter + 1 ))
493 output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1)
494 result=$?
495 [ -n "$output" ] && echo "$output"
496 if [ "$result" -ne "0" ]; then
497 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
498 echo "Trying again [$SPECFILE]... ($retries_counter)"
499 sleep 2
500 continue
501 fi
502 Exit_error err_no_spec_in_repo;
503 fi
504 done
505 fi
506 if [ ! -f "$SPECFILE" ]; then
507 Exit_error err_no_spec_in_repo;
508 fi
509
510 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
511 chmod $CHMOD_MODE $SPECFILE
512 fi
513 unset OPTIONS
a7eefc54 514 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
7e40520f
ER
515
516 set_spec_target
cd445739
AM
517}
518
519find_mirror()
520{
521 cd "$SPECS_DIR"
522 url="$1"
523 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
524 cvs update mirrors >&2
525 fi
526
527 IFS="|"
528 while read origin mirror name rest
529 do
530 ol=`echo -n "$origin"|wc -c`
531 prefix="`echo -n "$url" | head -c $ol`"
532 if [ "$prefix" = "$origin" ] ; then
533 suffix="`echo "$url"|cut -b $ol-`"
534 echo -n "$mirror$suffix"
535 return 0
536 fi
537 done < mirrors
538 echo "$url"
539}
540
541src_no ()
542{
543 cd $SPECS_DIR
544 rpm_dump | \
545 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
546 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
547 head -n 1 | xargs
1471f6d6 548}
549
cd445739 550src_md5 ()
8ba5cdda 551{
cd445739
AM
552 [ X"$NO5" = X"yes" ] && return
553 no=$(src_no "$1")
554 [ -z "$no" ] && return
555 cd $SPECS_DIR
47a8df12 556 spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
cd445739
AM
557 if [ -z "$spec_rev" ]; then
558 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
559 fi
560 spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
561 md5=$(grep -s -v '^#' additional-md5sums | \
562 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
563 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
564 grep -E '^[0-9a-f]{32}$')
565 if [ X"$md5" = X"" ] ; then
6203ea52
AG
566 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
567 if [ ! -z "$source_md5" ] ; then
7e365483 568 echo $source_md5;
6203ea52 569 else
7e365483
KK
570 # we have empty SourceX-md5, but it is still possible
571 # that we have NoSourceX-md5 AND NoSource: X
572 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
573 if [ ! -z "$nosource_md5" -a ! X"`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" = X"" ] ; then
574 echo $nosource_md5;
575 fi;
6203ea52 576 fi;
cd445739
AM
577 else
578 if [ $(echo "$md5" | wc -l) != 1 ] ; then
579 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
580 fi
581 echo "$md5" | tail -n 1
582 fi
583}
584
585distfiles_url ()
586{
1246dc2a 587 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
cd445739
AM
588}
589
590distfiles_attic_url ()
591{
1246dc2a 592 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
cd445739
AM
593}
594
595good_md5 ()
596{
597 md5=$(src_md5 "$1")
598 [ "$md5" = "" ] || \
599 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
8ba5cdda
PG
600}
601
a4b50627
AF
602good_size ()
603{
deccc50e
AM
604 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
605 [ -n "$size" -a "$size" -gt 0 ]
a4b50627
AF
606}
607
947025e5 608cvsignore_df ()
609{
610 if [ "$CVSIGNORE_DF" != "yes" ]; then
611 return
612 fi
613 cvsignore=${SOURCE_DIR}/.cvsignore
614 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
615 echo "$1" >> $cvsignore
616 fi
617}
618
cd445739
AM
619get_files()
620{
621 GET_FILES="$@"
28fac57a 622 update_shell_title "get_files"
cd445739
AM
623
624 if [ -n "$DEBUG" ]; then
625 set -x;
626 set -v;
627 fi
628
629 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
630 cd "$SOURCE_DIR"
631
632 OPTIONS="up "
633 if [ -n "$CVSROOT" ]; then
634 OPTIONS="-d $CVSROOT $OPTIONS"
635 else
636 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
637 echo "warning: No cvs access defined for SOURCES"
638 NOCVS="yes"
639 fi
640 fi
641 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
642 OPTIONS="$OPTIONS -A"
643 else
644 if [ -n "$CVSDATE" ]; then
645 OPTIONS="$OPTIONS -D $CVSDATE"
646 fi
647 if [ -n "$CVSTAG" ]; then
648 OPTIONS="$OPTIONS -r $CVSTAG"
649 fi
650 fi
651 for i in $GET_FILES
652 do
653 if [ -n "$UPDATE5" ]; then
654 if [ -n "$ADD5" ]; then
655 [ `nourl $i` = "$i" ] && continue
656 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE && continue
657 else
658 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE || continue
659 fi
660 fi
661 FROM_DISTFILES=0
662 if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
663 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
664 echo "Warning: no URL given for $i"
665 fi
666
667 if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then
a4b50627 668 if good_md5 "$i" && good_size "$i"; then
deccc50e 669 echo "$(nourl "$i") having proper md5sum already exists"
cd445739
AM
670 continue
671 fi
672 target=$(nourl "$i")
673 url=$(distfiles_url "$i")
674 url_attic=$(distfiles_attic_url "$i")
675 FROM_DISTFILES=1
33da77c4 676 if [ "`echo $url | grep -E '^(\.|/)'`" ]; then
2e5be021 677 update_shell_title "get_files: $url"
cd445739
AM
678 ${GETLOCAL} $url $target
679 else
680 if [ -z "$NOMIRRORS" ]; then
681 url="`find_mirror "$url"`"
682 fi
2e5be021 683 update_shell_title "get_files: $url"
ca2e6c31 684 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
33da77c4 685 if [ "`echo $url | grep -E 'ftp://'`" ]; then
2e5be021 686 update_shell_title "get_files: $url"
ca2e6c31 687 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
cd445739
AM
688 fi
689 fi
690 if ! test -s "$target"; then
691 rm -f "$target"
692 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
2e5be021 693 update_shell_title "get_files: $url_attic"
cd445739
AM
694 ${GETLOCAL} $url_attic $target
695 else
696 if [ -z "$NOMIRRORS" ]; then
697 url_attic="`find_mirror "$url_attic"`"
698 fi
2e5be021 699 update_shell_title "get_files: $url_attic"
ca2e6c31 700 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
33da77c4 701 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
2e5be021 702 update_shell_title "get_files: $url_attic"
ca2e6c31 703 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
cd445739
AM
704 fi
705 fi
706 fi
947025e5 707 if test -s "$target"; then
708 cvsignore_df $target
709 else
cd445739
AM
710 rm -f "$target"
711 FROM_DISTFILES=0
712 fi
713 elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then
714 # ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred
715 result=1
716 retries_counter=0
717 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
718 do
719 retries_counter=$(( $retries_counter + 1 ))
720 output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1)
721 result=$?
722 [ -n "$output" ] && echo "$output"
723 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
724 echo "Trying again [`nourl $i`]... ($retries_counter)"
725 sleep 2
726 continue
727 else
728 break
729 fi
730 done
731 fi
732
33da77c4 733 if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
cd445739
AM
734 if [ -z "$NOMIRRORS" ]; then
735 im="`find_mirror "$i"`"
736 else
737 im="$i"
738 fi
2e5be021 739 update_shell_title "get_files: $im"
cd445739 740 ${GETURI} "$im" || \
33da77c4 741 if [ "`echo $im | grep -E 'ftp://'`" ]; then
2e5be021 742 update_shell_title "get_files: $im"
cd445739 743 ${GETURI2} "$im"
7e365483 744 fi
cd445739
AM
745 fi
746
747 fi
748 srcno=$(src_no $i)
749 if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
750 Exit_error err_no_source_in_repo $i;
751 elif [ -n "$UPDATE5" ] && \
752 ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \
753 [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \
754 grep -q -i -E '^#[ ]*source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE )
755 then
deccc50e 756 echo "Updating source-$srcno md5."
cd445739
AM
757 md5=$(md5sum `nourl $i` | cut -f1 -d' ')
758 perl -i -ne '
deccc50e
AM
759 print unless /^\s*#\s*Source'$srcno'-md5\s*:/i;
760 print "# Source'$srcno'-md5:\t'$md5'\n"
cd445739
AM
761 if /^Source'$srcno'\s*:\s+/;
762 ' \
763 $SPECS_DIR/$SPECFILE
764 fi
2a5f078d 765
a4b50627 766 if good_md5 "$i" && good_size "$i"; then
cd445739
AM
767 :
768 elif [ "$FROM_DISTFILES" = 1 ]; then
deccc50e 769 # wrong md5 from distfiles: remove the file and try again
cd445739 770 # but only once ...
deccc50e 771 echo "MD5 sum mismatch. Trying full fetch."
cd445739
AM
772 FROM_DISTFILES=2
773 rm -f $target
2e5be021 774 update_shell_title "get_files: $url"
ca2e6c31 775 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
33da77c4 776 if [ "`echo $url | grep -E 'ftp://'`" ]; then
2e5be021 777 update_shell_title "get_files: $url"
ca2e6c31 778 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
cd445739
AM
779 fi
780 if ! test -s "$target"; then
781 rm -f "$target"
2e5be021 782 update_shell_title "get_files: $url_attic"
ca2e6c31 783 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
33da77c4 784 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
2e5be021 785 update_shell_title "get_files: $url_attic"
ca2e6c31 786 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
cd445739
AM
787 fi
788 fi
789 test -s "$target" || rm -f "$target"
790 fi
791
a4b50627 792 if good_md5 "$i" && good_size "$i" ; then
cd445739
AM
793 :
794 else
deccc50e
AM
795 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
796 echo "or -5 to update md5 sums, if you're sure files are correct."
cd445739
AM
797 Exit_error err_no_source_in_repo $i
798 fi
799 done
800
801 if [ "$CHMOD" = "yes" ]; then
802 CHMOD_FILES="`nourl $GET_FILES`"
803 if [ -n "$CHMOD_FILES" ]; then
804 chmod $CHMOD_MODE $CHMOD_FILES
805 fi
806 fi
807 unset OPTIONS
808 fi
809}
810
811make_tagver() {
78eab2a1
AM
812
813 if [ -n "$DEBUG" ]; then
814 set -x;
815 set -v;
816 fi
2a5f078d 817
cd445739
AM
818 # Check whether first character of PACKAGE_NAME is legal for tag name
819 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
820 TAG_PREFIX=tag_
821 fi
822 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"`
823 # Remove #kernel.version_release from TAGVER because tagging sources
824 # could occur with different kernel-headers than kernel-headers used at build time.
825 TAGVER=$(echo "$TAGVER" | sed -e 's/#.*//g')
826 echo -n "$TAGVER"
827}
828
829tag_files()
830{
831 TAG_FILES="$@"
832
833 if [ -n "$DEBUG" ]; then
834 set -x;
835 set -v;
836 fi
837
838 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
839 echo "Version: $PACKAGE_VERSION"
840 echo "Release: $PACKAGE_RELEASE"
841
842 TAGVER=`make_tagver`
843
844 if [ "$TAG_VERSION" = "yes" ]; then
845 echo "CVS tag: $TAGVER"
846 fi
847 if [ -n "$TAG" ]; then
848 echo "CVS tag: $TAG"
849 fi
850
851 OPTIONS="tag -F"
852 if [ -n "$CVSROOT" ]; then
853 OPTIONS="-d $CVSROOT $OPTIONS"
854 fi
855
856 cd "$SOURCE_DIR"
857 for i in $TAG_FILES
858 do
859 # don't tag files stored on distfiles
860 [ -n "`src_md5 $i`" ] && continue
861 if [ -f "`nourl $i`" ]; then
862 if [ "$TAG_VERSION" = "yes" ]; then
863 cvs $OPTIONS $TAGVER `nourl $i`
864 fi
865 if [ -n "$TAG" ]; then
866 cvs $OPTIONS $TAG `nourl $i`
867 fi
868 else
869 Exit_error err_no_source_in_repo $i
870 fi
871 done
872
873 cd "$SPECS_DIR"
874 if [ "$TAG_VERSION" = "yes" ]; then
875 cvs $OPTIONS $TAGVER $SPECFILE
876 fi
877 if [ -n "$TAG" ]; then
878 cvs $OPTIONS $TAG $SPECFILE
879 fi
880
881 unset OPTIONS
882 fi
883}
884
885branch_files()
886{
887 TAG=$1
888 echo "CVS branch tag: $TAG"
889 shift;
890
891 TAG_FILES="$@"
892
893 if [ -n "$DEBUG" ]; then
894 set -x;
895 set -v;
896 fi
897
898 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
899
900 OPTIONS="tag -b"
901 if [ -n "$CVSROOT" ]; then
902 OPTIONS="-d $CVSROOT $OPTIONS"
903 fi
904 cd "$SOURCE_DIR"
905 for i in $TAG_FILES
906 do
907 if [ -f `nourl $i` ]; then
908 cvs $OPTIONS $TAG `nourl $i`
909 else
910 Exit_error err_no_source_in_repo $i
911 fi
912 done
913 cd "$SPECS_DIR"
914 cvs $OPTIONS $TAG $SPECFILE
915
916 unset OPTIONS
917 fi
918}
919
920
921
59398507 922build_package()
923{
2e5be021 924 update_shell_title "build_package"
cd445739
AM
925 if [ -n "$DEBUG" ]; then
926 set -x;
927 set -v;
928 fi
5a491465 929
cd445739
AM
930 cd "$SPECS_DIR"
931
932 if [ -n "$TRY_UPGRADE" ]; then
2e5be021 933 update_shell_title "build_package: try_upgrade"
cd445739 934 if [ -n "$FLOAT_VERSION" ]; then
cc538c24 935 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
cd445739 936 else
cc538c24 937 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
cd445739
AM
938 fi
939
940 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
941
942 if [ -n "$TNEWVER" ]; then
943 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
944 echo "New version found, updating spec file to version " $TNEWVER
945 cp -f $SPECFILE $SPECFILE.bak
946 chmod +w $SPECFILE
947 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
f7b91886 948 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
cd445739 949 parse_spec;
7f347798 950 if [ -n "$ICONS" ]; then
951 get_files $ICONS;
952 parse_spec;
953 fi
f7b91886 954 NODIST="yes" UPDATE5="yes" get_files "$SOURCES $PATCHES";
cd445739
AM
955 unset TOLDVER TNEWVER TNOTIFY
956 fi
957 fi
958 cd "$SPECS_DIR"
2a5f078d 959
cd445739
AM
960 case "$COMMAND" in
961 build )
962 BUILD_SWITCH="-ba" ;;
963 build-binary )
964 BUILD_SWITCH="-bb" ;;
965 build-source )
966 BUILD_SWITCH="-bs --nodeps" ;;
967 build-prep )
968 BUILD_SWITCH="-bp --nodeps" ;;
969 esac
c890b916 970
2e5be021 971 update_shell_title "build_package: $COMMAND"
cd445739
AM
972 if [ -n "$LOGFILE" ]; then
973 LOG=`eval echo $LOGFILE`
974 if [ -d "$LOG" ]; then
975 echo "Log file $LOG is a directory."
976 echo "Parse error in the spec?"
977 Exit_error err_build_fail;
978 fi
979 if [ -n "$LASTLOG_FILE" ]; then
980 echo "LASTLOG=$LOG" > $LASTLOG_FILE
981 fi
982 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
21bc1a97 983 (time eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
cd445739
AM
984 RETVAL=`cat $RES_FILE`
985 rm $RES_FILE
986 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
987 if [ "$RETVAL" -eq "0" ]; then
988 mv $LOG $LOGDIROK
989 else
990 mv $LOG $LOGDIRFAIL
991 fi
992 fi
8ba5cdda 993 else
8f96ab6c 994 eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $TARGET_SWITCH $SPECFILE
cd445739 995 RETVAL=$?
8ba5cdda 996 fi
cd445739
AM
997 if [ "$RETVAL" -ne "0" ]; then
998 if [ -n "$TRY_UPGRADE" ]; then
999 echo "\n!!! Package with new version cannot be build automagically\n"
1000 mv -f $SPECFILE.bak $SPECFILE
1001 fi
1002 Exit_error err_build_fail;
1003 fi
1004 unset BUILD_SWITCH
1005}
1006
1007nourl()
1008{
1009 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1010}
1011
cd445739
AM
1012install_required_packages()
1013{
1014 run_poldek -vi $1
1015 return $?
1016}
1017
1018set_bconds_values()
1019{
2e5be021 1020 update_shell_title "set_bconds_values"
c890b916 1021
cd445739
AM
1022 AVAIL_BCONDS_WITHOUT=""
1023 AVAIL_BCONDS_WITH=""
1024 if `grep -q ^%bcond ${SPECFILE}`; then
1025 BCOND_VERSION="NEW"
36d03934 1026 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
cd445739
AM
1027 BCOND_VERSION="OLD"
1028 else
1029 BCOND_VERSION="NONE"
1030 fi
301cbfd4
ER
1031
1032 # expand bconds from ~/.bcondrc
1033 # The file structure is like gentoo's package.use:
1034 # ---
1035 # * -selinux
1036 # samba -mysql -pgsql
47a8df12 1037 # w32codec-installer license_agreement
301cbfd4
ER
1038 # php +mysqli
1039 # ---
c8a3e2ac 1040 if [ "${BCOND_VERSION}" != "NONE" ] && ( [ -f $HOME/.bcondrc ] || ( [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] ) ) ; then
301cbfd4
ER
1041 # This takes package name, first defined in spec.
1042 # so consider that when defining flags for package.
1043 PN=`$RPM -q --qf '%{NAME}\n' --specfile $SPECFILE | head -n 1`
3e1cbfe0 1044 SN=${SPECFILE%%\.spec}
301cbfd4
ER
1045 AVAIL=`$RPMBUILD --bcond $SPECFILE`
1046
c8a3e2ac
AG
1047 BCONDRC=$HOME/.bcondrc
1048 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && BCONDRC=$HOME_ETC/.bcondrc
1049
301cbfd4
ER
1050 while read pkg flags; do
1051 # ignore comments
1052 [[ "$pkg" == \#* ]] && continue
1053
1054 # any package or current package?
3e1cbfe0 1055 if [ "$pkg" = "*" ] || [ "$pkg" = "$PN" ] || [ "$pkg" = "$SN" ]; then
301cbfd4
ER
1056 for flag in $flags; do
1057 opt=${flag#[+-]}
1058
1059 # use only flags which are in this package.
1060 if [[ $AVAIL = *${opt}* ]]; then
3b5101f0
ER
1061 if [[ $flag = -* ]]; then
1062 BCOND="$BCOND --without $opt"
301cbfd4 1063 else
3b5101f0 1064 BCOND="$BCOND --with $opt"
301cbfd4
ER
1065 fi
1066 fi
1067 done
1068 fi
c8a3e2ac 1069 done < $BCONDRC
301cbfd4
ER
1070 fi
1071
cd445739
AM
1072 case "${BCOND_VERSION}" in
1073 NONE)
7e365483 1074 :
cd445739 1075 ;;
7e365483 1076 OLD)
cd445739
AM
1077 echo "Warning: This spec has old style bconds. Fix it || die."
1078 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_without_`
1079 do
1080 AVAIL_BCOND_WITHOUT=`echo $opt|sed -e "s/^_without_//g"`
1081 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1082 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1083 else
1084 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1085 fi
1086 done
2a5f078d 1087
cd445739
AM
1088 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_with_`
1089 do
1090 AVAIL_BCOND_WITH=`echo $opt|sed -e "s/^_with_//g"`
1091 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1092 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1093 else
1094 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1095 fi
1096 done
1097 ;;
1098 NEW)
1099 cond_type="" # with || without
1100 for opt in `$RPMBUILD --bcond $SPECFILE`
1101 do
1102 case "$opt" in
1103 _without)
1104 cond_type="without"
1105 ;;
1106 _with)
1107 cond_type="with"
1108 ;;
f8d24cee 1109 _without_*)
1110 AVAIL_BCOND_WITHOUT="`echo $opt | sed 's/^_without_//g'`"
1111 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1112 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1113 else
1114 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1115 fi
1116 ;;
1117 _with_*)
1118 AVAIL_BCOND_WITH="`echo $opt | sed 's/^_with_//g'`"
1119 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1120 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1121 else
1122 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1123 fi
1124 ;;
cd445739
AM
1125 *)
1126 case "$cond_type" in
1127 with)
1128 cond_type=''
1129 AVAIL_BCOND_WITH="$opt"
1130 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1131 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1132 else
1133 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1134 fi
7e365483 1135 ;;
cd445739
AM
1136 without)
1137 cond_type=''
1138 AVAIL_BCOND_WITHOUT="$opt"
1139 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1140 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1141 else
1142 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1143 fi
1144 ;;
1145 esac
1146 ;;
1147 esac
1148 done
1149 ;;
1150 esac
1151}
1152
1153run_sub_builder()
1154{
1155 package_name="${1}"
1156 echo -ne "Package installation failed:\t$package_name\n"
1157 #
1158