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