]>
Commit | Line | Data |
---|---|---|
b054f772 | 1 | #!/bin/sh |
33f5276d | 2 | # ----------- |
25fa34fe | 3 | # $Id$ |
33f5276d | 4 | # Exit codes: |
5 | # 0 - succesful | |
10b4dd7f | 6 | # 1 - help displayed |
33f5276d | 7 | # 2 - no spec file name in cmdl parameters |
8 | # 3 - spec file not stored in repo | |
0ad50ce9 | 9 | # 4 - some source, patch or icon files not stored in repo |
10 | # 5 - package build failed | |
10b4dd7f | 11 | # 6 - spec file with errors |
da0048be | 12 | # 7 - wrong source in /etc/poldek.conf |
26b77e30 | 13 | # 8 - Failed installing buildrequirements and subrequirements |
5a491465 | 14 | |
931a4acf TP |
15 | # Notes (todo): |
16 | # - builder -u fetches current version first | |
17 | # - tries to get new version from distfiles without new md5 | |
18 | # - after fetching new version doesn't update md5 | |
2837871a | 19 | # - doesn't get sources for specs with %include /usr/lib/rpm/macros.python |
9308ddd0 | 20 | # when there's no rpm-pythonprov (rpm's fault, but it's ugly anyway) |
2837871a | 21 | # - as above with %include /usr/lib/rpm/macros.perl and no rpm-perlprov |
82d4501c | 22 | # - when Icon: field is present, -5 and -a5 doesn't work |
931a4acf | 23 | |
4003ad8c | 24 | VERSION="\ |
25 | Build package utility from PLD CVS repository | |
06cb623c | 26 | V 0.11 (C) 1999-2004 Free Penguins". |
5a491465 | 27 | PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin" |
a7af9862 | 28 | |
b03f053b | 29 | COMMAND="build" |
30 | ||
bde1c404 | 31 | SPECFILE="" |
d287305c | 32 | BE_VERBOSE="" |
4003ad8c | 33 | QUIET="" |
5dd89621 | 34 | CLEAN="" |
7c2dd1b2 | 35 | DEBUG="" |
cc97f1f3 | 36 | NOURLS="" |
157dc315 | 37 | NOCVS="" |
6fc910c7 | 38 | NOCVSSPEC="" |
fc0e5bb5 | 39 | NODIST="" |
b130abf2 | 40 | UPDATE="" |
a9d9a79a | 41 | UPDATE5="" |
de6b5b2a | 42 | ADD5="" |
81474543 | 43 | ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"} |
c8f50498 | 44 | CVSROOT="" |
b2975fc3 | 45 | |
46 | # It can be used i.e. in log file naming. | |
47 | # See LOGFILE example. | |
48 | DATE=`date +%Y-%m-%d_%H-%M-%S` | |
49 | ||
d6a75d60 | 50 | # Example: LOGFILE='../log.$PACKAGE_NAME' |
b2975fc3 | 51 | # Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE' |
d6a75d60 | 52 | # Yes, you can use variable name! Note _single_ quotes! |
53 | LOGFILE='' | |
00fcec7e | 54 | |
55 | LOGDIR="" | |
56 | LOGDIROK="" | |
57 | LOGDIRFAIL="" | |
58 | LASTLOG_FILE="" | |
b2975fc3 | 59 | |
79d76918 | 60 | CHMOD="no" |
d6a75d60 | 61 | CHMOD_MODE="0444" |
33a9d2d1 | 62 | RPMOPTS="" |
6049c3d1 | 63 | BCOND="" |
a6253cb6 | 64 | GROUP_BCONDS="no" |
d287305c | 65 | |
66 | PATCHES="" | |
67 | SOURCES="" | |
7053d3fd | 68 | ICONS="" |
d287305c | 69 | PACKAGE_RELEASE="" |
70 | PACKAGE_VERSION="" | |
71 | PACKAGE_NAME="" | |
d7f490f3 | 72 | PROTOCOL="ftp" |
34c911e6 | 73 | WGET_RETRIES=${MAX_WGET_RETRIES:-0} |
b92ecfc9 | 74 | CVS_RETRIES=${MAX_CVS_RETRIES:-1000} |
5a491465 | 75 | |
00fcec7e | 76 | CVSTAG="" |
77 | RES_FILE="" | |
78 | ||
62546902 | 79 | CVS_SERVER="cvs.pld-linux.org" |
d7f490f3 | 80 | DISTFILES_SERVER="://distfiles.pld-linux.org" |
ea15df77 | 81 | |
3ae81a20 | 82 | DEF_NICE_LEVEL=0 |
83 | ||
c6a390a1 AM |
84 | FAIL_IF_NO_SOURCES="yes" |
85 | ||
d8140aad AM |
86 | wget --help 2>&1 | grep -q ' \-\-inet ' && WGET_OPTS="$WGET_OPTS --inet" |
87 | wget --help 2>&1 | grep -q ' \-\-retry\-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused" | |
88 | ||
89 | GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS" | |
90 | GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS" | |
6aefe77b | 91 | GETLOCAL="cp -a" |
11f33a0c | 92 | |
7147050f | 93 | if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then |
286a0bb9 | 94 | RPM="rpm" |
95 | RPMBUILD="rpm" | |
7147050f | 96 | else |
286a0bb9 | 97 | RPM="rpm" |
98 | RPMBUILD="rpmbuild" | |
7147050f AM |
99 | fi |
100 | ||
c8740da7 | 101 | POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/" |
da0048be | 102 | POLDEK_SOURCE="cvs" |
33885d2b | 103 | POLDEK_CMD="/usr/bin/poldek --noask" |
da0048be | 104 | |
0d5952c3 | 105 | # Here we load saved user environment used to |
b2975fc3 | 106 | # predefine options set above, or passed to builder |
107 | # in command line. | |
108 | # This one reads global system environment settings: | |
6eb44b93 | 109 | if [ -f ~/etc/builderrc ]; then |
286a0bb9 | 110 | . ~/etc/builderrc |
5aa0ef93 | 111 | fi |
b2975fc3 | 112 | # And this one cascades settings using user personal |
113 | # builder settings. | |
114 | # Example of ~/.builderrc: | |
115 | # | |
116 | #UPDATE_POLDEK_INDEXES="yes" | |
117 | #FETCH_BUILD_REQUIRES="yes" | |
118 | #REMOVE_BUILD_REQUIRES="force" | |
119 | #GROUP_BCONDS="yes" | |
120 | #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE' | |
121 | # | |
541008f6 | 122 | if [ -n "$HOME_ETC" ]; then |
794ffd1e | 123 | USER_CFG="$HOME_ETC/.builderrc" |
541008f6 | 124 | else |
b2975fc3 | 125 | USER_CFG=~/.builderrc |
541008f6 | 126 | fi |
127 | ||
794ffd1e | 128 | [ -f "$USER_CFG" ] && . "$USER_CFG" |
541008f6 | 129 | |
47fa83c4 | 130 | run_poldek() |
131 | { | |
2fed6de4 | 132 | RES_FILE=~/tmp/poldek-exit-status.$RANDOM |
47fa83c4 | 133 | if [ -n "$LOGFILE" ]; then |
0d5952c3 | 134 | LOG=`eval echo $LOGFILE` |
135 | if [ -n "$LASTLOG_FILE" ]; then | |
136 | echo "LASTLOG=$LOG" > $LASTLOG_FILE | |
137 | fi | |
2fed6de4 | 138 | (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee $LOG |
47fa83c4 | 139 | return $exit_pldk |
140 | else | |
2fed6de4 | 141 | (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null |
142 | return `cat ${RES_FILE}` | |
143 | rm -rf ${RES_FILE} | |
47fa83c4 | 144 | fi |
145 | } | |
146 | ||
a9914892 | 147 | # Example grep cvs /etc/poldek.conf: |
148 | # source = cvs /home/users/yoshi/rpm/RPMS/ | |
149 | if [ "$UPDATE_POLDEK_INDEXES" = "yes" ]; then | |
47fa83c4 | 150 | run_poldek -l -n ${POLDEK_SOURCE} 1>&2 > /dev/null |
0d5952c3 | 151 | if [ ! "$?" == "0" ]; then |
a9914892 | 152 | echo "Using improper source '${POLDEK_SOURCE}' in /etc/poldek.conf" |
153 | echo "Fix it and try to continue" | |
154 | exit 7 | |
155 | fi | |
156 | fi | |
157 | ||
da946cd6 | 158 | #--------------------------------------------- |
159 | # functions | |
160 | ||
5a491465 | 161 | usage() |
162 | { | |
b2975fc3 | 163 | if [ -n "$DEBUG" ]; then set -xv; fi |
164 | echo "\ | |
7922b3ec | 165 | Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build] |
81f85806 | 166 | |
b2975fc3 | 167 | [-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade] |
168 | [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get] | |
169 | [-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper] | |
170 | [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>] | |
171 | [-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest] | |
0d5952c3 | 172 | [-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version] |
b2975fc3 | 173 | [{-Tp|--tag-prefix} <prefix>] |
174 | [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] | |
175 | [--with/--without <feature>] [--define <macro> <value>] <package>[.spec] | |
176 | ||
177 | -5, --update-md5 - update md5 comments in spec, implies -nd -ncs | |
178 | -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs | |
179 | -D, --debug - enable script debugging mode, | |
180 | -V, --version - output builder version | |
181 | -a, --as_anon - get files via pserver as cvs@$CVS_SERVER, | |
182 | -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package | |
183 | from <package>.spec, | |
0d5952c3 | 184 | -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary |
b2975fc3 | 185 | only package from <package>.spec, |
0d5952c3 | 186 | -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack |
b2975fc3 | 187 | them into src.rpm, |
188 | -bp, --build-prep - execute the %prep phase of <package>.spec, | |
189 | -B, --branch - add branch | |
0d5952c3 | 190 | -c, --clean - clean all temporarily created files (in BUILD, SOURCES, |
b2975fc3 | 191 | SPECS and \$RPM_BUILD_ROOT), |
192 | -d <cvsroot>, --cvsroot <cvsroot> | |
193 | - setup \$CVSROOT, | |
194 | --define <macro> <value> | |
195 | - define a macro <macro> with value <value>, | |
196 | --nodeps - rpm won't check any dependences | |
197 | -g, --get - get <package>.spec and all related files from CVS repo | |
198 | or HTTP/FTP, | |
199 | -h, --help - this message, | |
200 | --http - use http instead of ftp, | |
201 | -l <logfile>, --logtofile <logfile> | |
202 | - log all to file, | |
0d5952c3 | 203 | -m, --mr-proper - only remove all files related to spec file and all work |
b2975fc3 | 204 | resources, |
205 | -nc, --no-cvs - don't download sources from CVS, if source URL is given, | |
206 | -ncs, --no-cvs-specs | |
207 | - don't check specs in CVS | |
208 | -nd, --no-distfiles - don't download from distfiles | |
209 | -nm, --no-mirrors - don't download from mirror, if source URL is given, | |
210 | -nu, --no-urls - don't try to download from FTP/HTTP location, | |
211 | -ns, --no-srcs - don't download Sources | |
212 | -ns0, --no-source0 - don't download Source0 | |
932cca61 | 213 | -nn, --no-net - don't download anything from the net |
b2975fc3 | 214 | --opts <rpm opts> - additional options for rpm |
215 | -q, --quiet - be quiet, | |
216 | --date yyyy-mm-dd - build package using resources from specified CVS date, | |
217 | -r <cvstag>, --cvstag <cvstag> | |
218 | - build package using resources from specified CVS tag, | |
219 | -R, --fetch-build-requires | |
220 | - fetch what is BuildRequired, | |
221 | -RB, --remove-build-requires | |
222 | - remove all you fetched with -R or --fetch-build-requires | |
223 | remember, this option requires confirmation, | |
224 | -FRB, --force-remove-build-requires | |
225 | - remove all you fetched with -R or --fetch-build-requires | |
226 | remember, this option works without confirmation, | |
227 | -T <cvstag> , --tag <cvstag> | |
228 | - add cvs tag <cvstag> for files, | |
229 | -Tvs, --tag-version-stable | |
230 | - add cvs tags STABLE and NAME-VERSION-RELESE for files, | |
231 | -Tvn, --tag-version-nest | |
232 | - add cvs tags NEST and NAME-VERSION-RELESE for files, | |
233 | -Ts, --tag-stable | |
234 | - add cvs tag STABLE for files, | |
235 | -Tn, --tag-nest | |
236 | - add cvs tag NEST for files, | |
237 | -Tv, --tag-version | |
238 | - add cvs tag NAME-VERSION-RELESE for files, | |
239 | -Tp, --tag-prefix <prefix> | |
240 | - add <prefix> to NAME-VERSION-RELEASE tags, | |
241 | -v, --verbose - be verbose, | |
242 | -u, --try-upgrade - check version, and try to upgrade package | |
243 | -un, --try-upgrade-with-float-version | |
244 | - as above, but allow float version | |
245 | -U, --update - refetch sources, don't use distfiles, and update md5 comments | |
0d5952c3 | 246 | -Upi, --update-poldek-indexes |
b2975fc3 | 247 | - refresh or make poldek package index files. |
248 | --with/--without <feature> | |
249 | - conditional build package depending on %_with_<feature>/ | |
0d5952c3 | 250 | %_without_<feature> macro switch. You may now use |
251 | --with feat1 feat2 feat3 --without feat4 feat5 --with feat6 | |
b2975fc3 | 252 | constructions. Set GROUP_BCONDS to yes to make use of it. |
5a491465 | 253 | " |
254 | } | |
255 | ||
5f26c239 | 256 | cache_rpm_dump () { |
b2975fc3 | 257 | rpm_dump_cache=` |
ad6f43de | 258 | case "$RPMBUILD" in |
b2975fc3 | 259 | rpm ) |
0d5952c3 | 260 | rpm -bp --nodeps --define 'prep %dump' $BCOND $SPECFILE 2>&1 |
b2975fc3 | 261 | ;; |
262 | rpmbuild ) | |
0d5952c3 | 263 | rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $SPECFILE 2>&1 |
b2975fc3 | 264 | ;; |
15a71f66 | 265 | esac` |
5f26c239 MM |
266 | } |
267 | ||
268 | rpm_dump () { | |
b2975fc3 | 269 | if [ -z "$rpm_dump_cache" ] ; then |
270 | echo "internal error: cache_rpm_dump not called!" 1>&2 | |
271 | fi | |
272 | echo "$rpm_dump_cache" | |
ad6f43de MM |
273 | } |
274 | ||
59398507 | 275 | parse_spec() |
276 | { | |
b2975fc3 | 277 | if [ -n "$DEBUG" ]; then |
278 | set -x; | |
279 | set -v; | |
280 | fi | |
7c2dd1b2 | 281 | |
b2975fc3 | 282 | cd $SPECS_DIR |
5f26c239 | 283 | |
b2975fc3 | 284 | cache_rpm_dump |
5f26c239 | 285 | |
b2975fc3 | 286 | if [ "$NOSRCS" != "yes" ]; then |
287 | SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`" | |
288 | fi | |
289 | if (rpm_dump | grep -qEi ":.*nosource.*1"); then | |
290 | FAIL_IF_NO_SOURCES="no" | |
291 | fi | |
c6a390a1 | 292 | |
b2975fc3 | 293 | PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`" |
294 | ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`" | |
e2ab686e JB |
295 | PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`" |
296 | PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -n 1`" | |
297 | PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`" | |
79379585 | 298 | |
b2975fc3 | 299 | if [ -n "$BE_VERBOSE" ]; then |
300 | echo "- Sources : `nourl $SOURCES`" | |
301 | if [ -n "$PATCHES" ]; then | |
302 | echo "- Patches : `nourl $PATCHES`" | |
303 | else | |
304 | echo "- Patches : *no patches needed*" | |
305 | fi | |
306 | if [ -n "$ICONS" ]; then | |
307 | echo "- Icon : `nourl $ICONS`" | |
308 | else | |
309 | echo "- Icon : *no package icon*" | |
310 | fi | |
311 | echo "- Name : $PACKAGE_NAME" | |
312 | echo "- Version : $PACKAGE_VERSION" | |
313 | echo "- Release : $PACKAGE_RELEASE" | |
a3df415f | 314 | fi |
33f5276d | 315 | } |
316 | ||
317 | Exit_error() | |
318 | { | |
b2975fc3 | 319 | if [ -n "$DEBUG" ]; then |
320 | set -x; | |
321 | set -v; | |
322 | fi | |
323 | ||
4e868bdf | 324 | cd "$__PWD" |
b2975fc3 | 325 | |
326 | case "$1" in | |
327 | "err_no_spec_in_cmdl" ) | |
328 | remove_build_requires | |
329 | echo "ERROR: spec file name not specified."; | |
330 | exit 2 ;; | |
331 | "err_no_spec_in_repo" ) | |
332 | remove_build_requires | |
333 | echo "Error: spec file not stored in CVS repo."; | |
334 | exit 3 ;; | |
335 | "err_no_source_in_repo" ) | |
336 | remove_build_requires | |
337 | echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"; | |
338 | exit 4 ;; | |
339 | "err_build_fail" ) | |
340 | remove_build_requires | |
341 | echo "Error: package build failed. (${2:-no more info})"; | |
342 | exit 5 ;; | |
343 | esac | |
33f5276d | 344 | } |
bc8d444f | 345 | |
33f5276d | 346 | init_builder() |
347 | { | |
b2975fc3 | 348 | if [ -n "$DEBUG" ]; then |
349 | set -x; | |
350 | set -v; | |
351 | fi | |
7c2dd1b2 | 352 | |
b2975fc3 | 353 | SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`" |
354 | SPECS_DIR="`$RPM --eval '%{_specdir}'`" | |
bc8d444f | 355 | |
4e868bdf | 356 | __PWD="`pwd`" |
59398507 | 357 | } |
358 | ||
359 | get_spec() | |
360 | { | |
b2975fc3 | 361 | if [ -n "$DEBUG" ]; then |
362 | set -x; | |
363 | set -v; | |
364 | fi | |
5644bf7e | 365 | |
794ffd1e | 366 | cd "$SPECS_DIR" |
2162a0d8 | 367 | if [ \! -f "$SPECFILE" ]; then |
368 | SPECFILE="`basename $SPECFILE .spec`.spec"; | |
369 | fi | |
b2975fc3 | 370 | if [ "$NOCVSSPEC" != "yes" ]; then |
b2975fc3 | 371 | OPTIONS="up " |
00fcec7e | 372 | |
b2975fc3 | 373 | if [ -n "$CVSROOT" ]; then |
374 | OPTIONS="-d $CVSROOT $OPTIONS" | |
375 | else | |
376 | if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then | |
377 | echo "warning: No cvs access defined - using local .spec file" | |
378 | NOCVSSPEC="yes" | |
379 | fi | |
380 | fi | |
33f5276d | 381 | |
b2975fc3 | 382 | if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then |
383 | OPTIONS="$OPTIONS -A" | |
384 | else | |
385 | if [ -n "$CVSDATE" ]; then | |
386 | OPTIONS="$OPTIONS -D $CVSDATE" | |
387 | fi | |
388 | if [ -n "$CVSTAG" ]; then | |
389 | OPTIONS="$OPTIONS -r $CVSTAG" | |
390 | fi | |
0dd6320d | 391 | fi |
b2975fc3 | 392 | |
393 | result=1 | |
394 | retries_counter=0 | |
395 | while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ] | |
396 | do | |
397 | retries_counter=$(( $retries_counter + 1 )) | |
398 | output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1) | |
399 | result=$? | |
400 | [ -n "$output" ] && echo "$output" | |
401 | if [ "$result" -ne "0" ]; then | |
402 | 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 | |
403 | echo "Trying again [$SPECFILE]... ($retries_counter)" | |
404 | sleep 2 | |
405 | continue | |
406 | fi | |
407 | Exit_error err_no_spec_in_repo; | |
408 | fi | |
409 | done | |
410 | fi | |
411 | if [ ! -f "$SPECFILE" ]; then | |
0dd6320d | 412 | Exit_error err_no_spec_in_repo; |
b2975fc3 | 413 | fi |
414 | ||
415 | if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then | |
416 | chmod $CHMOD_MODE $SPECFILE | |
417 | fi | |
418 | unset OPTIONS | |
419 | grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE | |
59398507 | 420 | } |
421 | ||
b2975fc3 | 422 | find_mirror() |
423 | { | |
424 | cd "$SPECS_DIR" | |
425 | url="$1" | |
426 | if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then | |
427 | cvs update mirrors >&2 | |
4ca52257 | 428 | fi |
b2975fc3 | 429 | |
430 | IFS="|" | |
431 | while read origin mirror name rest | |
432 | do | |
433 | ol=`echo -n "$origin"|wc -c` | |
434 | prefix="`echo -n "$url" | head -c $ol`" | |
435 | if [ "$prefix" = "$origin" ] ; then | |
436 | suffix="`echo "$url"|cut -b $ol-`" | |
437 | echo -n "$mirror$suffix" | |
438 | return 0 | |
439 | fi | |
440 | done < mirrors | |
441 | echo "$url" | |
4ca52257 JK |
442 | } |
443 | ||
00fcec7e | 444 | src_no () |
445 | { | |
b2975fc3 | 446 | cd $SPECS_DIR |
447 | rpm_dump | \ | |
0dd6320d | 448 | grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \ |
449 | sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \ | |
e2ab686e | 450 | head -n 1 | xargs |
00fcec7e | 451 | } |
452 | ||
453 | src_md5 () | |
454 | { | |
b2975fc3 | 455 | no=$(src_no "$1") |
456 | [ -z "$no" ] && return | |
457 | cd $SPECS_DIR | |
458 | spec_rev=$(grep $SPECFILE CVS/Entries | sed -e s:/$SPECFILE/:: -e s:/.*::) | |
459 | if [ -z "$spec_rev" ]; then | |
e2ab686e | 460 | spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')" |
b2975fc3 | 461 | fi |
462 | spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')" | |
463 | md5=$(grep -s -v '^#' additional-md5sums | \ | |
0dd6320d | 464 | grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \ |
465 | sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \ | |
466 | grep -E '^[0-9a-f]{32}$') | |
b2975fc3 | 467 | if [ X"$md5" = X"" ] ; then |
468 | grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://' | xargs | |
469 | else | |
470 | if [ $(echo "$md5" | wc -l) != 1 ] ; then | |
471 | echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2 | |
472 | fi | |
e2ab686e | 473 | echo "$md5" | tail -n 1 |
0dd6320d | 474 | fi |
00fcec7e | 475 | } |
476 | ||
477 | distfiles_url () | |
478 | { | |
b2975fc3 | 479 | echo "$PROTOCOL$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")" |
00fcec7e | 480 | } |
481 | ||
f9d1b625 JR |
482 | distfiles_attic_url () |
483 | { | |
484 | echo "$PROTOCOL$DISTFILES_SERVER/Attic/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")" | |
485 | } | |
486 | ||
d99ac371 MM |
487 | good_md5 () |
488 | { | |
b2975fc3 | 489 | md5=$(src_md5 "$1") |
490 | [ "$md5" = "" ] || \ | |
491 | [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ] | |
d99ac371 MM |
492 | } |
493 | ||
25fa34fe | 494 | get_files() |
59398507 | 495 | { |
b2975fc3 | 496 | GET_FILES="$@" |
25fa34fe | 497 | |
b2975fc3 | 498 | if [ -n "$DEBUG" ]; then |
499 | set -x; | |
500 | set -v; | |
501 | fi | |
7c2dd1b2 | 502 | |
b2975fc3 | 503 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then |
794ffd1e | 504 | cd "$SOURCE_DIR" |
33f5276d | 505 | |
b2975fc3 | 506 | OPTIONS="up " |
507 | if [ -n "$CVSROOT" ]; then | |
508 | OPTIONS="-d $CVSROOT $OPTIONS" | |
2daea751 | 509 | else |
b2975fc3 | 510 | if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then |
511 | echo "warning: No cvs access defined for SOURCES" | |
512 | NOCVS="yes" | |
00fcec7e | 513 | fi |
b2975fc3 | 514 | fi |
515 | if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then | |
516 | OPTIONS="$OPTIONS -A" | |
517 | else | |
518 | if [ -n "$CVSDATE" ]; then | |
519 | OPTIONS="$OPTIONS -D $CVSDATE" | |
57422365 | 520 | fi |
b2975fc3 | 521 | if [ -n "$CVSTAG" ]; then |
522 | OPTIONS="$OPTIONS -r $CVSTAG" | |
b92ecfc9 | 523 | fi |
157dc315 | 524 | fi |
b2975fc3 | 525 | for i in $GET_FILES |
526 | do | |
527 | if [ -n "$UPDATE5" ]; then | |
528 | if [ -n "$ADD5" ]; then | |
529 | [ `nourl $i` = "$i" ] && continue | |
530 | grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE && continue | |
531 | else | |
532 | grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE || continue | |
533 | fi | |
534 | fi | |
535 | FROM_DISTFILES=0 | |
536 | if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then | |
537 | if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then | |
538 | echo "Warning: no URL given for $i" | |
539 | fi | |
a7af9862 | 540 | |
b2975fc3 | 541 | if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then |
542 | if good_md5 "$i"; then | |
543 | echo "$(nourl "$i") having proper md5sum already exists" | |
544 | continue | |
545 | fi | |
546 | target=$(nourl "$i") | |
547 | url=$(distfiles_url "$i") | |
f9d1b625 JR |
548 | url_attic=$(distfiles_attic_url "$i") |
549 | FROM_DISTFILES=1 | |
b2975fc3 | 550 | if [ `echo $url | grep -E '^(\.|/)'` ]; then |
551 | ${GETLOCAL} $url $target | |
552 | else | |
b2975fc3 | 553 | if [ -z "$NOMIRRORS" ]; then |
554 | url="`find_mirror "$url"`" | |
555 | fi | |
556 | ${GETURI} -O "$target" "$url" || \ | |
557 | if [ `echo $url | grep -E 'ftp://'` ]; then | |
558 | ${GETURI2} -O "$target" "$url" | |
559 | fi | |
f9d1b625 | 560 | fi |
286a0bb9 | 561 | if ! test -s "$target"; then |
562 | rm -f "$target" | |
f9d1b625 JR |
563 | if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then |
564 | ${GETLOCAL} $url_attic $target | |
565 | else | |
566 | if [ -z "$NOMIRRORS" ]; then | |
567 | url_attic="`find_mirror "$url_attic"`" | |
568 | fi | |
569 | ${GETURI} -O "$target" "$url_attic" || \ | |
570 | if [ `echo $url_attic | grep -E 'ftp://'` ]; then | |
571 | ${GETURI2} -O "$target" "$url_attic" | |
572 | fi | |
b2975fc3 | 573 | fi |
574 | fi | |
286a0bb9 | 575 | if ! test -s "$target"; then |
576 | rm -f "$target" | |
577 | FROM_DISTFILES=0 | |
578 | fi | |
b2975fc3 | 579 | elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then |
580 | # ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred | |
581 | result=1 | |
582 | retries_counter=0 | |
583 | while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ] | |
584 | do | |
585 | retries_counter=$(( $retries_counter + 1 )) | |
586 | output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1) | |
587 | result=$? | |
588 | [ -n "$output" ] && echo "$output" | |
589 | 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 | |
590 | echo "Trying again [`nourl $i`]... ($retries_counter)" | |
591 | sleep 2 | |
592 | continue | |
593 | else | |
594 | break | |
595 | fi | |
596 | done | |
597 | fi | |
286a0bb9 | 598 | |
b2975fc3 | 599 | if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then |
600 | if [ -z "$NOMIRRORS" ]; then | |
601 | im="`find_mirror "$i"`" | |
602 | else | |
603 | im="$i" | |
604 | fi | |
605 | ${GETURI} "$im" || \ | |
0d5952c3 | 606 | if [ `echo $im | grep -E 'ftp://'` ]; then |
b2975fc3 | 607 | ${GETURI2} "$im" |
608 | fi | |
609 | fi | |
157dc315 | 610 | |
b2975fc3 | 611 | fi |
612 | srcno=$(src_no $i) | |
613 | if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then | |
614 | Exit_error err_no_source_in_repo $i; | |
615 | elif [ -n "$UPDATE5" ] && \ | |
616 | ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \ | |
617 | [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \ | |
618 | grep -q -i -E '^#[ ]*source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE ) | |
619 | then | |
620 | echo "Updating source-$srcno md5." | |
621 | md5=$(md5sum `nourl $i` | cut -f1 -d' ') | |
622 | perl -i -ne ' | |
82db6b8d | 623 | print unless /^\s*#\s*Source'$srcno'-md5\s*:/i; |
0d5952c3 | 624 | print "# Source'$srcno'-md5:\t'$md5'\n" |
b2975fc3 | 625 | if /^Source'$srcno'\s*:\s+/; |
82db6b8d | 626 | ' \ |
422fbc56 | 627 | $SPECS_DIR/$SPECFILE |
b2975fc3 | 628 | fi |
629 | ||
630 | if good_md5 "$i"; then | |
631 | : | |
632 | elif [ "$FROM_DISTFILES" = 1 ]; then | |
633 | # wrong md5 from distfiles: remove the file and try again | |
634 | # but only once ... | |
635 | echo "MD5 sum mismatch. Trying full fetch." | |
636 | FROM_DISTFILES=2 | |
637 | rm -f $target | |
638 | ${GETURI} -O "$target" "$url" || \ | |
639 | if [ `echo $url | grep -E 'ftp://'` ]; then | |
640 | ${GETURI2} -O "$target" "$url" | |
641 | fi | |
f9d1b625 JR |
642 | if ! test -s "$target"; then |
643 | rm -f "$target" | |
feb7fc58 JR |
644 | ${GETURI} -O "$target" "$url_attic" || \ |
645 | if [ `echo $url_attic | grep -E 'ftp://'` ]; then | |
646 | ${GETURI2} -O "$target" "$url_attic" | |
f9d1b625 JR |
647 | fi |
648 | fi | |
b2975fc3 | 649 | test -s "$target" || rm -f "$target" |
650 | fi | |
651 | ||
652 | if good_md5 "$i"; then | |
653 | : | |
654 | else | |
655 | echo "MD5 sum mismatch. Use -U to refetch sources," | |
656 | echo "or -5 to update md5 sums, if you're sure files are correct." | |
657 | Exit_error err_no_source_in_repo $i | |
658 | fi | |
659 | done | |
a7af9862 | 660 | |
b2975fc3 | 661 | if [ "$CHMOD" = "yes" ]; then |
662 | CHMOD_FILES="`nourl $GET_FILES`" | |
663 | if [ -n "$CHMOD_FILES" ]; then | |
664 | chmod $CHMOD_MODE $CHMOD_FILES | |
665 | fi | |
666 | fi | |
667 | unset OPTIONS | |
5aa0ef93 | 668 | fi |
59398507 | 669 | } |
670 | ||
1471f6d6 | 671 | tag_files() |
672 | { | |
b2975fc3 | 673 | TAG_FILES="$@" |
1471f6d6 | 674 | |
b2975fc3 | 675 | if [ -n "$DEBUG" ]; then |
676 | set -x; | |
677 | set -v; | |
01de2036 | 678 | fi |
1471f6d6 | 679 | |
b2975fc3 | 680 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then |
681 | echo "Version: $PACKAGE_VERSION" | |
682 | echo "Release: $PACKAGE_RELEASE" | |
683 | # Check whether first character of PACKAGE_NAME is legal for tag name | |
684 | if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then | |
685 | TAG_PREFIX=tag_ | |
686 | fi | |
687 | 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"` | |
688 | # Remove #kernel.version_release from TAGVER because tagging sources | |
689 | # could occur with different kernel-headers than kernel-headers used at build time. | |
690 | TAGVER=$(echo "$TAGVER" | sed -e 's/#.*//g') | |
691 | if [ "$TAG_VERSION" = "yes" ]; then | |
692 | echo "CVS tag: $TAGVER" | |
693 | fi | |
694 | if [ -n "$TAG" ]; then | |
695 | echo "CVS tag: $TAG" | |
696 | fi | |
697 | ||
698 | OPTIONS="tag -F" | |
699 | if [ -n "$CVSROOT" ]; then | |
700 | OPTIONS="-d $CVSROOT $OPTIONS" | |
701 | fi | |
702 | ||
794ffd1e | 703 | cd "$SOURCE_DIR" |
b2975fc3 | 704 | for i in $TAG_FILES |
705 | do | |
286a0bb9 | 706 | # don't tag files stored on distfiles |
707 | [ -n "`src_md5 $i`" ] && continue | |
b2975fc3 | 708 | if [ -f "`nourl $i`" ]; then |
709 | if [ "$TAG_VERSION" = "yes" ]; then | |
710 | cvs $OPTIONS $TAGVER `nourl $i` | |
711 | fi | |
712 | if [ -n "$TAG" ]; then | |
713 | cvs $OPTIONS $TAG `nourl $i` | |
714 | fi | |
715 | else | |
716 | Exit_error err_no_source_in_repo $i | |
717 | fi | |
718 | done | |
1471f6d6 | 719 | |
794ffd1e | 720 | cd "$SPECS_DIR" |
f02788de | 721 | if [ "$TAG_VERSION" = "yes" ]; then |
b2975fc3 | 722 | cvs $OPTIONS $TAGVER $SPECFILE |
f02788de JB |
723 | fi |
724 | if [ -n "$TAG" ]; then | |
b2975fc3 | 725 | cvs $OPTIONS $TAG $SPECFILE |
f02788de | 726 | fi |
1471f6d6 | 727 | |
b2975fc3 | 728 | unset OPTIONS |
f02788de | 729 | fi |
1471f6d6 | 730 | } |
731 | ||
8ba5cdda PG |
732 | branch_files() |
733 | { | |
b2975fc3 | 734 | TAG=$1 |
735 | echo "CVS branch tag: $TAG" | |
736 | shift; | |
8ba5cdda | 737 | |
b2975fc3 | 738 | TAG_FILES="$@" |
8ba5cdda | 739 | |
b2975fc3 | 740 | if [ -n "$DEBUG" ]; then |
741 | set -x; | |
742 | set -v; | |
743 | fi | |
8ba5cdda | 744 | |
b2975fc3 | 745 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then |
a7af9862 | 746 | |
b2975fc3 | 747 | OPTIONS="tag -b" |
748 | if [ -n "$CVSROOT" ]; then | |
749 | OPTIONS="-d $CVSROOT $OPTIONS" | |
750 | fi | |
794ffd1e | 751 | cd "$SOURCE_DIR" |
b2975fc3 | 752 | for i in $TAG_FILES |
753 | do | |
754 | if [ -f `nourl $i` ]; then | |
755 | cvs $OPTIONS $TAG `nourl $i` | |
756 | else | |
757 | Exit_error err_no_source_in_repo $i | |
758 | fi | |
759 | done | |
794ffd1e | 760 | cd "$SPECS_DIR" |
b2975fc3 | 761 | cvs $OPTIONS $TAG $SPECFILE |
a7af9862 | 762 | |
b2975fc3 | 763 | unset OPTIONS |
764 | fi | |
8ba5cdda PG |
765 | } |
766 | ||
f308b816 | 767 | |
768 | ||
59398507 | 769 | build_package() |
770 | { | |
b2975fc3 | 771 | if [ -n "$DEBUG" ]; then |
772 | set -x; | |
773 | set -v; | |
a7af9862 | 774 | fi |
775 | ||
794ffd1e | 776 | cd "$SPECS_DIR" |
a7af9862 | 777 | |
b2975fc3 | 778 | if [ -n "$TRY_UPGRADE" ]; then |
779 | if [ -n "$FLOAT_VERSION" ]; then | |
780 | TNOTIFY=`./pldnotify.awk $SPECFILE -n` | |
781 | else | |
782 | TNOTIFY=`./pldnotify.awk $SPECFILE` | |
783 | fi | |
a7af9862 | 784 | |
b2975fc3 | 785 | TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'` |
a7af9862 | 786 | |
b2975fc3 | 787 | if [ -n "$TNEWVER" ]; then |
788 | TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'` | |
789 | echo "New version found, updating spec file to version " $TNEWVER | |
790 | cp -f $SPECFILE $SPECFILE.bak | |
791 | chmod +w $SPECFILE | |
792 | eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE" | |
793 | eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t1/' $SPECFILE" | |
794 | parse_spec; | |
795 | get_files "$SOURCES $PATCHES"; | |
796 | unset TOLDVER TNEWVER TNOTIFY | |
797 | fi | |
3d97a432 | 798 | fi |
794ffd1e | 799 | cd "$SPECS_DIR" |
00fcec7e | 800 | |
b2975fc3 | 801 | case "$COMMAND" in |
802 | build ) | |
803 | BUILD_SWITCH="-ba" ;; | |
804 | build-binary ) | |
805 | BUILD_SWITCH="-bb" ;; | |
806 | build-source ) | |
807 | BUILD_SWITCH="-bs --nodeps" ;; | |
808 | build-prep ) | |
809 | BUILD_SWITCH="-bp --nodeps" ;; | |
810 | esac | |
811 | if [ -n "$LOGFILE" ]; then | |
812 | LOG=`eval echo $LOGFILE` | |
4f21dfe8 | 813 | if [ -d "$LOG" ]; then |
814 | echo "Log file $LOG is a directory." | |
815 | echo "Parse error in the spec?" | |
816 | Exit_error err_build_fail; | |
817 | fi | |
b2975fc3 | 818 | if [ -n "$LASTLOG_FILE" ]; then |
819 | echo "LASTLOG=$LOG" > $LASTLOG_FILE | |
820 | fi | |
821 | RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM | |
822 | (time nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG | |
823 | RETVAL=`cat $RES_FILE` | |
824 | rm $RES_FILE | |
825 | if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then | |
826 | if [ "$RETVAL" -eq "0" ]; then | |
827 | mv $LOG $LOGDIROK | |
828 | else | |
829 | mv $LOG $LOGDIRFAIL | |
830 | fi | |
831 | fi | |
832 | else | |
833 | eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE | |
834 | RETVAL=$? | |
00fcec7e | 835 | fi |
b2975fc3 | 836 | if [ "$RETVAL" -ne "0" ]; then |
837 | if [ -n "$TRY_UPGRADE" ]; then | |
838 | echo "\n!!! Package with new version cannot be build automagically\n" | |
839 | mv -f $SPECFILE.bak $SPECFILE | |
840 | fi | |
841 | Exit_error err_build_fail; | |
3d97a432 | 842 | fi |
b2975fc3 | 843 | unset BUILD_SWITCH |
59398507 | 844 | } |
845 | ||
cc97f1f3 SZ |
846 | nourl() |
847 | { | |
b2975fc3 | 848 | echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g' |
cc97f1f3 | 849 | } |
2daea751 | 850 | |
47fa83c4 | 851 | |
e79b53b6 | 852 | install_required_packages() |
853 | { | |
47fa83c4 | 854 | run_poldek -vi $1 |
9be0208e | 855 | return $? |
e79b53b6 | 856 | } |
857 | ||
da0048be | 858 | set_bconds_values() |
859 | { | |
b2975fc3 | 860 | AVAIL_BCONDS_WITHOUT="" |
861 | AVAIL_BCONDS_WITH="" | |
640ddf59 | 862 | if `grep -q ^%bcond ${SPECFILE}`; then |
863 | BCOND_VERSION="NEW" | |
864 | elif `grep -q bcond ${SPECFILE}`; then | |
865 | BCOND_VERSION="OLD" | |
ff5f7ec0 | 866 | else |
640ddf59 | 867 | BCOND_VERSION="NONE" |
ff5f7ec0 | 868 | fi |
869 | case "${BCOND_VERSION}" in | |
801f1540 | 870 | NONE) |
871 | : | |
872 | ;; | |
ff5f7ec0 | 873 | OLD) |
e79b53b6 | 874 | echo "Warning: This spec has old style bconds. Fix it || die." |
ff5f7ec0 | 875 | for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_without_` |
876 | do | |
877 | AVAIL_BCOND_WITHOUT=`echo $opt|sed -e "s/^_without_//g"` | |
640ddf59 | 878 | if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then |
ff5f7ec0 | 879 | AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>" |
880 | else | |
881 | AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT" | |
882 | fi | |
883 | done | |
884 | ||
885 | for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_with_` | |
886 | do | |
887 | AVAIL_BCOND_WITH=`echo $opt|sed -e "s/^_with_//g"` | |
640ddf59 | 888 | if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then |
ff5f7ec0 | 889 | AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>" |
890 | else | |
891 | AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH" | |
892 | fi | |
893 | done | |
894 | ;; | |
895 | NEW) | |
896 | cond_type="" # with || without | |
897 | for opt in `$RPMBUILD --bcond $SPECFILE` | |
898 | do | |
899 | case "$opt" in | |
900 | _without) | |
901 | cond_type="without" | |
902 | ;; | |
903 | _with) | |
904 | cond_type="with" | |
0d5952c3 | 905 | ;; |
ff5f7ec0 | 906 | *) |
907 | case "$cond_type" in | |
908 | with) | |
909 | cond_type='' | |
910 | AVAIL_BCOND_WITH="$opt" | |
640ddf59 | 911 | if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then |
ff5f7ec0 | 912 | AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>" |
913 | else | |
914 | AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH" | |
915 | fi | |
916 | ;; | |
917 | without) | |
918 | cond_type='' | |
919 | AVAIL_BCOND_WITHOUT="$opt" | |
640ddf59 | 920 | if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then |
ff5f7ec0 | 921 | AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>" |
922 | else | |
923 | AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT" | |
924 | fi | |
925 | ;; | |
926 | esac | |
927 | ;; | |
928 | esac | |
929 | done | |
930 | ;; | |
931 | esac | |
da0048be | 932 | } |
933 | ||
d79f7220 | 934 | run_sub_builder() |
935 | { | |
b2975fc3 | 936 | package_name="${1}" |
937 | echo -ne "Package installation failed:\t$package_name\n" | |
938 | # | |
939 |