]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - builder.sh
- /etc/... .d doesn't usually require %config
[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() {
a0d6396b 289 [ -t 1 ] || return
2e5be021 290 local msg="builder[$SPECFILE] $*"
c890b916
ER
291 case "$TERM" in
292 cygwin|xterm*)
2e5be021 293 echo -ne "\033]1;$msg\007\033]2;$msg\007"
c890b916
ER
294 ;;
295 screen*)
2e5be021 296 echo -ne "\033]0;$msg\007"
c890b916
ER
297 ;;
298 esac
299}
300
7e40520f
ER
301# set TARGET from BuildArch: from SPECFILE
302set_spec_target() {
303 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
304 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
305 if [ "$tmp" ]; then
306 TARGET="$tmp"
307 case "$RPMBUILD" in
308 "rpmbuild")
309 TARGET_SWITCH="--target $TARGET" ;;
310 "rpm")
311 TARGET_SWITCH="--target=$TARGET" ;;
312 esac
313 fi
314 fi
315}
316
cd445739 317cache_rpm_dump () {
b2aeec7d
AM
318 if [ -n "$DEBUG" ]; then
319 set -x;
320 set -v;
321 fi
7e40520f 322
cd445739
AM
323rpm_dump_cache=`
324 case "$RPMBUILD" in
325 rpm )
2a5f078d 326 rpm -bp --nodeps --define 'prep %dump' $BCOND $TARGET_SWITCH $SPECFILE 2>&1
cd445739
AM
327 ;;
328 rpmbuild )
2f810e46 329 rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $TARGET_SWITCH $SPECFILE 2>&1
cd445739
AM
330 ;;
331 esac`
332}
333
334rpm_dump () {
335 if [ -z "$rpm_dump_cache" ] ; then
336 echo "internal error: cache_rpm_dump not called!" 1>&2
337 fi
338 echo "$rpm_dump_cache"
339}
340
59398507 341parse_spec()
342{
2e5be021 343 update_shell_title "parse_spec"
cd445739
AM
344 if [ -n "$DEBUG" ]; then
345 set -x;
346 set -v;
347 fi
b2975fc3 348
cd445739 349 cd $SPECS_DIR
4ca52257 350
cd445739 351 cache_rpm_dump
00fcec7e 352
cd445739
AM
353 if [ "$NOSRCS" != "yes" ]; then
354 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
355 fi
356 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
357 FAIL_IF_NO_SOURCES="no"
358 fi
359
360 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
361 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
362 PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
363 PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -n 1`"
364 PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
365
341603cf 366# These variables may be unset after first cache_rpm_dump call
367# (because of not-yet-retrieved icon file)
368#
369# if [ -z "$PACKAGE_NAME" -o -z "$PACKAGE_VERSION" -o -z "$PACKAGE_RELEASE" ]; then
370# Exit_error err_no_package_data;
371# fi
78eab2a1 372
cd445739
AM
373 if [ -n "$BE_VERBOSE" ]; then
374 echo "- Sources : `nourl $SOURCES`"
375 if [ -n "$PATCHES" ]; then
376 echo "- Patches : `nourl $PATCHES`"
377 else
378 echo "- Patches : *no patches needed*"
379 fi
380 if [ -n "$ICONS" ]; then
381 echo "- Icon : `nourl $ICONS`"
382 else
383 echo "- Icon : *no package icon*"
384 fi
385 echo "- Name : $PACKAGE_NAME"
386 echo "- Version : $PACKAGE_VERSION"
387 echo "- Release : $PACKAGE_RELEASE"
388 fi
389}
390
391Exit_error()
392{
393 if [ -n "$DEBUG" ]; then
394 set -x;
395 set -v;
396 fi
397
398 cd "$__PWD"
399
400 case "$1" in
401 "err_no_spec_in_cmdl" )
402 remove_build_requires
403 echo "ERROR: spec file name not specified.";
404 exit 2 ;;
405 "err_no_spec_in_repo" )
406 remove_build_requires
407 echo "Error: spec file not stored in CVS repo.";
408 exit 3 ;;
409 "err_no_source_in_repo" )
410 remove_build_requires
411 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)";
412 exit 4 ;;
413 "err_build_fail" )
414 remove_build_requires
415 echo "Error: package build failed. (${2:-no more info})";
416 exit 5 ;;
78eab2a1
AM
417 "err_no_package_data" )
418 remove_build_requires
419 echo "Error: couldn't get out package name/version/release from spec file."
420 exit 6 ;;
50321881
JK
421 "err_tag_exists" )
422 remove_build_requires
423 echo "Tag ${2} already exists (spec release: ${3}).";
424 exit 9 ;;
425 "err_fract_rel" )
426 remove_build_requires
427 echo "Release ${2} not integer and not a snapshot.";
428 exit 10 ;;
fb96e0b5
AM
429 "err_branch_exists" )
430 remove_build_requires
431 echo "Tree branch already exists (${2}).";
432 exit 11 ;;
50321881 433
cd445739 434 esac
50321881 435 echo "Unknown error."
2a5f078d 436 exit 100
cd445739
AM
437}
438
439init_builder()
440{
441 if [ -n "$DEBUG" ]; then
442 set -x;
443 set -v;
0dd6320d 444 fi
cd445739
AM
445
446 SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`"
447 SPECS_DIR="`$RPM --eval '%{_specdir}'`"
448
449 __PWD="`pwd`"
00fcec7e 450}
451
d6a77ddb 452get_spec()
1471f6d6 453{
c890b916 454
2e5be021 455 update_shell_title "get_spec"
c890b916 456
cd445739
AM
457 if [ -n "$DEBUG" ]; then
458 set -x;
459 set -v;
460 fi
461
462 cd "$SPECS_DIR"
463 if [ \! -f "$SPECFILE" ]; then
464 SPECFILE="`basename $SPECFILE .spec`.spec";
465 fi
466 if [ "$NOCVSSPEC" != "yes" ]; then
467 OPTIONS="up "
468
469 if [ -n "$CVSROOT" ]; then
470 OPTIONS="-d $CVSROOT $OPTIONS"
471 else
472 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
473 echo "warning: No cvs access defined - using local .spec file"
474 NOCVSSPEC="yes"
475 fi
476 fi
477
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
489 result=1
490 retries_counter=0
491 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
492 do
493 retries_counter=$(( $retries_counter + 1 ))
494 output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1)
495 result=$?
496 [ -n "$output" ] && echo "$output"
497 if [ "$result" -ne "0" ]; then
498 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
499 echo "Trying again [$SPECFILE]... ($retries_counter)"
500 sleep 2
501 continue
502 fi
503 Exit_error err_no_spec_in_repo;
504 fi
505 done
506 fi
507 if [ ! -f "$SPECFILE" ]; then
508 Exit_error err_no_spec_in_repo;
509 fi
510
511 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
512 chmod $CHMOD_MODE $SPECFILE
513 fi
514 unset OPTIONS
a7eefc54 515 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
7e40520f
ER
516
517 set_spec_target
cd445739
AM
518}
519
520find_mirror()
521{
522 cd "$SPECS_DIR"
523 url="$1"
524 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
525 cvs update mirrors >&2
526 fi
527
528 IFS="|"
529 while read origin mirror name rest
530 do
531 ol=`echo -n "$origin"|wc -c`
532 prefix="`echo -n "$url" | head -c $ol`"
533 if [ "$prefix" = "$origin" ] ; then
534 suffix="`echo "$url"|cut -b $ol-`"
535 echo -n "$mirror$suffix"
536 return 0
537 fi
538 done < mirrors
539 echo "$url"
540}
541
542src_no ()
543{
544 cd $SPECS_DIR
545 rpm_dump | \
546 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
547 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
548 head -n 1 | xargs
1471f6d6 549}
550
cd445739 551src_md5 ()
8ba5cdda 552{
cd445739
AM
553 [ X"$NO5" = X"yes" ] && return
554 no=$(src_no "$1")
555 [ -z "$no" ] && return
556 cd $SPECS_DIR
47a8df12 557 spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
cd445739
AM
558 if [ -z "$spec_rev" ]; then
559 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
560 fi
561 spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
562 md5=$(grep -s -v '^#' additional-md5sums | \
563 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
564 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
565 grep -E '^[0-9a-f]{32}$')
566 if [ X"$md5" = X"" ] ; then
6203ea52
AG
567 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
568 if [ ! -z "$source_md5" ] ; then
7e365483 569 echo $source_md5;
6203ea52 570 else
7e365483
KK
571 # we have empty SourceX-md5, but it is still possible
572 # that we have NoSourceX-md5 AND NoSource: X
573 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
574 if [ ! -z "$nosource_md5" -a ! X"`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" = X"" ] ; then
575 echo $nosource_md5;
576 fi;
6203ea52 577 fi;
cd445739
AM
578 else
579 if [ $(echo "$md5" | wc -l) != 1 ] ; then
580 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
581 fi
582 echo "$md5" | tail -n 1
583 fi
584}
585
586distfiles_url ()
587{
1246dc2a 588 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
cd445739
AM
589}
590
591distfiles_attic_url ()
592{
1246dc2a 593 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
cd445739
AM
594}
595
596good_md5 ()
597{
598 md5=$(src_md5 "$1")
599 [ "$md5" = "" ] || \
600 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
8ba5cdda
PG
601}
602
a4b50627
AF
603good_size ()
604{
deccc50e
AM
605 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
606 [ -n "$size" -a "$size" -gt 0 ]
a4b50627
AF
607}
608
947025e5 609cvsignore_df ()
610{
611 if [ "$CVSIGNORE_DF" != "yes" ]; then
612 return
613 fi
614 cvsignore=${SOURCE_DIR}/.cvsignore
615 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
616 echo "$1" >> $cvsignore
617 fi
618}
619
cd445739
AM
620get_files()
621{
622 GET_FILES="$@"
28fac57a 623 update_shell_title "get_files"
cd445739
AM
624
625 if [ -n "$DEBUG" ]; then
626 set -x;
627 set -v;
628 fi
629
630 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
631 cd "$SOURCE_DIR"
632
633 OPTIONS="up "
634 if [ -n "$CVSROOT" ]; then
635 OPTIONS="-d $CVSROOT $OPTIONS"
636 else
637 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
638 echo "warning: No cvs access defined for SOURCES"
639 NOCVS="yes"
640 fi
641 fi
642 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
643 OPTIONS="$OPTIONS -A"
644 else
645 if [ -n "$CVSDATE" ]; then
646 OPTIONS="$OPTIONS -D $CVSDATE"
647 fi
648 if [ -n "$CVSTAG" ]; then
649 OPTIONS="$OPTIONS -r $CVSTAG"
650 fi
651 fi
652 for i in $GET_FILES
653 do
654 if [ -n "$UPDATE5" ]; then
655 if [ -n "$ADD5" ]; then
656 [ `nourl $i` = "$i" ] && continue
657 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE && continue
658 else
659 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE || continue
660 fi
661 fi
662 FROM_DISTFILES=0
663 if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
664 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
665 echo "Warning: no URL given for $i"
666 fi
667
668 if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then
a4b50627 669 if good_md5 "$i" && good_size "$i"; then
deccc50e 670 echo "$(nourl "$i") having proper md5sum already exists"
cd445739
AM
671 continue
672 fi
673 target=$(nourl "$i")
674 url=$(distfiles_url "$i")
675 url_attic=$(distfiles_attic_url "$i")
676 FROM_DISTFILES=1
33da77c4 677 if [ "`echo $url | grep -E '^(\.|/)'`" ]; then
2e5be021 678 update_shell_title "get_files: $url"
cd445739
AM
679 ${GETLOCAL} $url $target
680 else
681 if [ -z "$NOMIRRORS" ]; then
682 url="`find_mirror "$url"`"
683 fi
2e5be021 684 update_shell_title "get_files: $url"
ca2e6c31 685 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
33da77c4 686 if [ "`echo $url | grep -E 'ftp://'`" ]; then
2e5be021 687 update_shell_title "get_files: $url"
ca2e6c31 688 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
cd445739
AM
689 fi
690 fi
691 if ! test -s "$target"; then
692 rm -f "$target"
693 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
2e5be021 694 update_shell_title "get_files: $url_attic"
cd445739
AM
695 ${GETLOCAL} $url_attic $target
696 else
697 if [ -z "$NOMIRRORS" ]; then
698 url_attic="`find_mirror "$url_attic"`"
699 fi
2e5be021 700 update_shell_title "get_files: $url_attic"
ca2e6c31 701 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
33da77c4 702 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
2e5be021 703 update_shell_title "get_files: $url_attic"
ca2e6c31 704 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
cd445739
AM
705 fi
706 fi
707 fi
947025e5 708 if test -s "$target"; then
709 cvsignore_df $target
710 else
cd445739
AM
711 rm -f "$target"
712 FROM_DISTFILES=0
713 fi
714 elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then
715 # ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred
716 result=1
717 retries_counter=0
718 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
719 do
720 retries_counter=$(( $retries_counter + 1 ))
721 output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1)
722 result=$?
723 [ -n "$output" ] && echo "$output"
724 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
725 echo "Trying again [`nourl $i`]... ($retries_counter)"
726 sleep 2
727 continue
728 else
729 break
730 fi
731 done
732 fi
733
33da77c4 734 if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
cd445739
AM
735 if [ -z "$NOMIRRORS" ]; then
736 im="`find_mirror "$i"`"
737 else
738 im="$i"
739 fi
2e5be021 740 update_shell_title "get_files: $im"
cd445739 741 ${GETURI} "$im" || \
33da77c4 742 if [ "`echo $im | grep -E 'ftp://'`" ]; then
2e5be021 743 update_shell_title "get_files: $im"
cd445739 744 ${GETURI2} "$im"
7e365483 745 fi
cd445739
AM
746 fi
747
748 fi
749 srcno=$(src_no $i)
750 if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
751 Exit_error err_no_source_in_repo $i;
752 elif [ -n "$UPDATE5" ] && \
753 ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \
754 [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \
755 grep -q -i -E '^#[ ]*source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE )
756 then
deccc50e 757 echo "Updating source-$srcno md5."
cd445739
AM
758 md5=$(md5sum `nourl $i` | cut -f1 -d' ')
759 perl -i -ne '
deccc50e
AM
760 print unless /^\s*#\s*Source'$srcno'-md5\s*:/i;
761 print "# Source'$srcno'-md5:\t'$md5'\n"
cd445739
AM
762 if /^Source'$srcno'\s*:\s+/;
763 ' \
764 $SPECS_DIR/$SPECFILE
765 fi
2a5f078d 766
a4b50627 767 if good_md5 "$i" && good_size "$i"; then
cd445739
AM
768 :
769 elif [ "$FROM_DISTFILES" = 1 ]; then
deccc50e 770 # wrong md5 from distfiles: remove the file and try again
cd445739 771 # but only once ...
deccc50e 772 echo "MD5 sum mismatch. Trying full fetch."
cd445739
AM
773 FROM_DISTFILES=2
774 rm -f $target
2e5be021 775 update_shell_title "get_files: $url"
ca2e6c31 776 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
33da77c4 777 if [ "`echo $url | grep -E 'ftp://'`" ]; then
2e5be021 778 update_shell_title "get_files: $url"
ca2e6c31 779 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
cd445739
AM
780 fi
781 if ! test -s "$target"; then
782 rm -f "$target"
2e5be021 783 update_shell_title "get_files: $url_attic"
ca2e6c31 784 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
33da77c4 785 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
2e5be021 786 update_shell_title "get_files: $url_attic"
ca2e6c31 787 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
cd445739
AM
788 fi
789 fi
790 test -s "$target" || rm -f "$target"
791 fi
792
a4b50627 793 if good_md5 "$i" && good_size "$i" ; then
cd445739
AM
794 :
795 else
deccc50e
AM
796 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
797 echo "or -5 to update md5 sums, if you're sure files are correct."
cd445739
AM
798 Exit_error err_no_source_in_repo $i
799 fi
800 done
801
802 if [ "$CHMOD" = "yes" ]; then
803 CHMOD_FILES="`nourl $GET_FILES`"
804 if [ -n "$CHMOD_FILES" ]; then
805 chmod $CHMOD_MODE $CHMOD_FILES
806 fi
807 fi
808 unset OPTIONS
809 fi
810}
811
812make_tagver() {
78eab2a1
AM
813
814 if [ -n "$DEBUG" ]; then
815 set -x;
816 set -v;
817 fi
2a5f078d 818
cd445739
AM
819 # Check whether first character of PACKAGE_NAME is legal for tag name
820 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
821 TAG_PREFIX=tag_
822 fi
823 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"`
824 # Remove #kernel.version_release from TAGVER because tagging sources
825 # could occur with different kernel-headers than kernel-headers used at build time.
826 TAGVER=$(echo "$TAGVER" | sed -e 's/#.*//g')
827 echo -n "$TAGVER"
828}
829
830tag_files()
831{
832 TAG_FILES="$@"
833
834 if [ -n "$DEBUG" ]; then
835 set -x;
836 set -v;
837 fi
838
839 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
840 echo "Version: $PACKAGE_VERSION"
841 echo "Release: $PACKAGE_RELEASE"
842
843 TAGVER=`make_tagver`
844
845 if [ "$TAG_VERSION" = "yes" ]; then
846 echo "CVS tag: $TAGVER"
847 fi
848 if [ -n "$TAG" ]; then
849 echo "CVS tag: $TAG"
850 fi
851
852 OPTIONS="tag -F"
853 if [ -n "$CVSROOT" ]; then
854 OPTIONS="-d $CVSROOT $OPTIONS"
855 fi
856
857 cd "$SOURCE_DIR"
858 for i in $TAG_FILES
859 do
860 # don't tag files stored on distfiles
861 [ -n "`src_md5 $i`" ] && continue
862 if [ -f "`nourl $i`" ]; then
863 if [ "$TAG_VERSION" = "yes" ]; then
864 cvs $OPTIONS $TAGVER `nourl $i`
865 fi
866 if [ -n "$TAG" ]; then
867 cvs $OPTIONS $TAG `nourl $i`
868 fi
869 else
870 Exit_error err_no_source_in_repo $i
871 fi
872 done
873
874 cd "$SPECS_DIR"
875 if [ "$TAG_VERSION" = "yes" ]; then
876 cvs $OPTIONS $TAGVER $SPECFILE
877 fi
878 if [ -n "$TAG" ]; then
879 cvs $OPTIONS $TAG $SPECFILE
880 fi
881
882 unset OPTIONS
883 fi
884}
885
886branch_files()
887{
888 TAG=$1
889 echo "CVS branch tag: $TAG"
890 shift;
891
892 TAG_FILES="$@"
893
894 if [ -n "$DEBUG" ]; then
895 set -x;
896 set -v;
897 fi
898
899 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
900
901 OPTIONS="tag -b"
902 if [ -n "$CVSROOT" ]; then
903 OPTIONS="-d $CVSROOT $OPTIONS"
904 fi
905 cd "$SOURCE_DIR"
906 for i in $TAG_FILES
907 do
908 if [ -f `nourl $i` ]; then
909 cvs $OPTIONS $TAG `nourl $i`
910 else
911 Exit_error err_no_source_in_repo $i
912 fi
913 done
914 cd "$SPECS_DIR"
915 cvs $OPTIONS $TAG $SPECFILE
916
917 unset OPTIONS
918 fi
919}
920
921
922
59398507 923build_package()
924{
2e5be021 925 update_shell_title "build_package"
cd445739
AM
926 if [ -n "$DEBUG" ]; then
927 set -x;
928 set -v;
929 fi
5a491465 930
cd445739
AM
931 cd "$SPECS_DIR"
932
933 if [ -n "$TRY_UPGRADE" ]; then
2e5be021 934 update_shell_title "build_package: try_upgrade"
cd445739 935 if [ -n "$FLOAT_VERSION" ]; then
cc538c24 936 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
cd445739 937 else
cc538c24 938 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
cd445739
AM
939 fi
940
941 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
942
943 if [ -n "$TNEWVER" ]; then
944 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
945 echo "New version found, updating spec file to version " $TNEWVER
946 cp -f $SPECFILE $SPECFILE.bak
947 chmod +w $SPECFILE
948 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
f7b91886 949 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
cd445739 950 parse_spec;
7f347798 951 if [ -n "$ICONS" ]; then
952 get_files $ICONS;
953 parse_spec;
954 fi
f7b91886 955 NODIST="yes" UPDATE5="yes" get_files "$SOURCES $PATCHES";
cd445739
AM
956 unset TOLDVER TNEWVER TNOTIFY
957 fi
958 fi
959 cd "$SPECS_DIR"
2a5f078d 960
cd445739
AM
961 case "$COMMAND" in
962 build )
963 BUILD_SWITCH="-ba" ;;
964 build-binary )
965 BUILD_SWITCH="-bb" ;;
966 build-source )
967 BUILD_SWITCH="-bs --nodeps" ;;
968 build-prep )
969 BUILD_SWITCH="-bp --nodeps" ;;
970 esac
c890b916 971
2e5be021 972 update_shell_title "build_package: $COMMAND"
cd445739
AM
973 if [ -n "$LOGFILE" ]; then
974 LOG=`eval echo $LOGFILE`
975 if [ -d "$LOG" ]; then
976 echo "Log file $LOG is a directory."
977 echo "Parse error in the spec?"
978 Exit_error err_build_fail;
979 fi
980 if [ -n "$LASTLOG_FILE" ]; then
981 echo "LASTLOG=$LOG" > $LASTLOG_FILE
982 fi
983 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
21bc1a97 984 (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
985 RETVAL=`cat $RES_FILE`
986 rm $RES_FILE
987 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
988 if [ "$RETVAL" -eq "0" ]; then
989 mv $LOG $LOGDIROK
990 else
991 mv $LOG $LOGDIRFAIL
992 fi
993 fi
8ba5cdda 994 else
8f96ab6c 995 eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $TARGET_SWITCH $SPECFILE
cd445739 996 RETVAL=$?
8ba5cdda 997 fi
cd445739
AM
998 if [ "$RETVAL" -ne "0" ]; then
999 if [ -n "$TRY_UPGRADE" ]; then
1000 echo "\n!!! Package with new version cannot be build automagically\n"
1001 mv -f $SPECFILE.bak $SPECFILE
1002 fi
1003 Exit_error err_build_fail;
1004 fi
1005 unset BUILD_SWITCH
1006}
1007
1008nourl()
1009{
1010 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1011}
1012
cd445739
AM
1013install_required_packages()
1014{
1015 run_poldek -vi $1
1016 return $?
1017}
1018
1019set_bconds_values()
1020{
2e5be021 1021 update_shell_title "set_bconds_values"
c890b916 1022
cd445739
AM
1023 AVAIL_BCONDS_WITHOUT=""
1024 AVAIL_BCONDS_WITH=""
1025 if `grep -q ^%bcond ${SPECFILE}`; then
1026 BCOND_VERSION="NEW"
36d03934 1027 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
cd445739
AM
1028 BCOND_VERSION="OLD"
1029 else
1030 BCOND_VERSION="NONE"
1031 fi
301cbfd4
ER
1032
1033 # expand bconds from ~/.bcondrc
1034 # The file structure is like gentoo's package.use:
1035 # ---
1036 # * -selinux
1037 # samba -mysql -pgsql
47a8df12 1038 # w32codec-installer license_agreement
301cbfd4
ER
1039 # php +mysqli
1040 # ---
c8a3e2ac 1041 if [ "${BCOND_VERSION}" != "NONE" ] && ( [ -f $HOME/.bcondrc ] || ( [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] ) ) ; then
301cbfd4
ER
1042 # This takes package name, first defined in spec.
1043 # so consider that when defining flags for package.
1044 PN=`$RPM -q --qf '%{NAME}\n' --specfile $SPECFILE | head -n 1`
3e1cbfe0 1045 SN=${SPECFILE%%\.spec}
301cbfd4
ER
1046 AVAIL=`$RPMBUILD --bcond $SPECFILE`
1047
c8a3e2ac
AG
1048 BCONDRC=$HOME/.bcondrc
1049 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && BCONDRC=$HOME_ETC/.bcondrc
1050
301cbfd4
ER
1051 while read pkg flags; do
1052 # ignore comments
1053 [[ "$pkg" == \#* ]] && continue
1054
1055 # any package or current package?
3e1cbfe0 1056 if [ "$pkg" = "*" ] || [ "$pkg" = "$PN" ] || [ "$pkg" = "$SN" ]; then
301cbfd4
ER
1057 for flag in $flags; do
1058 opt=${flag#[+-]}
1059
1060 # use only flags which are in this package.
1061 if [[ $AVAIL = *${opt}* ]]; then
3b5101f0
ER
1062 if [[ $flag = -* ]]; then
1063 BCOND="$BCOND --without $opt"
301cbfd4 1064 else
3b5101f0 1065 BCOND="$BCOND --with $opt"
301cbfd4
ER
1066 fi
1067 fi
1068 done
1069 fi
c8a3e2ac 1070 done < $BCONDRC
301cbfd4
ER
1071 fi
1072
cd445739
AM
1073 case "${BCOND_VERSION}" in
1074 NONE)
7e365483 1075 :
cd445739 1076 ;;
7e365483 1077 OLD)
cd445739
AM
1078 echo "Warning: This spec has old style bconds. Fix it || die."
1079 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_without_`
1080 do
1081 AVAIL_BCOND_WITHOUT=`echo $opt|sed -e "s/^_without_//g"`
1082 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1083 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1084 else
1085 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1086 fi
1087 done
2a5f078d 1088
cd445739
AM
1089 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_with_`
1090 do
1091 AVAIL_BCOND_WITH=`echo $opt|sed -e "s/^_with_//g"`
1092 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1093 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1094 else
1095 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1096 fi
1097 done
1098 ;;
1099 NEW)
1100 cond_type="" # with || without
1101 for opt in `$RPMBUILD --bcond $SPECFILE`
1102 do
1103 case "$opt" in
1104 _without)
1105 cond_type="without"
1106 ;;
1107 _with)
1108 cond_type="with"
1109 ;;
f8d24cee 1110 _without_*)
1111 AVAIL_BCOND_WITHOUT="`echo $opt | sed 's/^_without_//g'`"
1112 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1113 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1114 else
1115 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1116 fi
1117 ;;
1118 _with_*)
1119 AVAIL_BCOND_WITH="`echo $opt | sed 's/^_with_//g'`"
1120 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1121 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1122 else
1123 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1124 fi
1125 ;;
cd445739
AM
1126 *)
1127 case "$cond_type" in
1128 with)
1129 cond_type=''
1130 AVAIL_BCOND_WITH="$opt"
1131 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1132 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1133 else
1134 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1135 fi
7e365483 1136 ;;
cd445739
AM
1137 without)
1138 cond_type=''
1139 AVAIL_BCOND_WITHOUT="$opt"
1140 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1141 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1142 else
1143 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1144 fi
1145 ;;
1146 esac
1147 ;;
1148 esac
1149 done
1150 ;;
1151 esac
1152}
1153
1154run_sub_builder()
1155{
1156 package_name="${1}"
1157 echo -ne "Package installation failed:\t$package_name\n"
1158 #
1159