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)
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
28 Build package utility from PLD CVS repository
29 V 0.12 (C) 1999-2005 Free Penguins".
30 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
49 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
52 # It can be used i.e. in log file naming.
53 # See LOGFILE example.
54 DATE=`date +%Y-%m-%d_%H-%M-%S`
56 # Example: LOGFILE='../log.$PACKAGE_NAME'
57 # Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
58 # Yes, you can use variable name! Note _single_ quotes!
80 WGET_RETRIES=${MAX_WGET_RETRIES:-0}
81 CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
86 CVS_SERVER="cvs.pld-linux.org"
87 DISTFILES_SERVER="://distfiles.pld-linux.org"
88 ATTICDISTFILES_SERVER="://attic-distfiles.pld-linux.org"
92 FAIL_IF_NO_SOURCES="yes"
94 # Here we load saved user environment used to
95 # predefine options set above, or passed to builder
97 # This one reads global system environment settings:
98 if [ -f ~/etc/builderrc ]; then
101 # And this one cascades settings using user personal
103 # Example of ~/.builderrc:
105 #UPDATE_POLDEK_INDEXES="yes"
106 #FETCH_BUILD_REQUIRES="yes"
107 #REMOVE_BUILD_REQUIRES="force"
109 #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
112 if [ -n "$HOME_ETC" ]; then
113 USER_CFG="$HOME_ETC/.builderrc"
115 USER_CFG=~/.builderrc
118 [ -f "$USER_CFG" ] && . "$USER_CFG"
120 if [ -n "$USE_PROZILLA" ]; then
121 GETURI="proz --no-getch -r -P ./ -t$WGET_RETRIES $PROZILLA_OPTS"
124 elif [ -n "$USE_AXEL" ]; then
125 GETURI="axel -a $AXEL_OPTS"
129 wget --help 2>&1 | grep -q ' \-\-inet ' && WGET_OPTS="$WGET_OPTS --inet"
130 wget --help 2>&1 | grep -q ' \-\-retry\-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
132 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
133 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
139 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
147 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
148 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
152 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
153 if [ -n "$LOGFILE" ]; then
154 LOG=`eval echo $LOGFILE`
155 if [ -n "$LASTLOG_FILE" ]; then
156 echo "LASTLOG=$LOG" > $LASTLOG_FILE
158 (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
161 (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
162 return `cat ${RES_FILE}`
167 #---------------------------------------------
172 if [ -n "$DEBUG" ]; then set -xv; fi
174 Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build]
176 [-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade]
177 [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get]
178 [-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
179 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>]
180 [-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest]
181 [-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version]
182 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}]
183 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>]
184 [--with/--without <feature>] [--define <macro> <value>] <package>[.spec]
186 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
187 -a, --adapter[ize] - run adapter.awk on SPECFILE
188 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
189 -n5, --no-md5 - ignore md5 comments in spec
190 -D, --debug - enable builder script debugging mode,
191 -debug - produce rpm debug package (same as --opts -debug)
192 -V, --version - output builder version
193 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
194 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
196 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
197 only package from <package>.spec,
198 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
200 -bp, --build-prep - execute the %prep phase of <package>.spec,
201 -B, --branch - add branch
202 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
203 SPECS and \$RPM_BUILD_ROOT),
204 -d <cvsroot>, --cvsroot <cvsroot>
206 --define <macro> <value>
207 - define a macro <macro> with value <value>,
208 --nodeps - rpm won't check any dependences
209 -g, --get - get <package>.spec and all related files from CVS repo
211 -h, --help - this message,
212 --http - use http instead of ftp,
213 -l <logfile>, --logtofile <logfile>
215 -m, --mr-proper - only remove all files related to spec file and all work
217 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
219 - don't check specs in CVS
220 -nd, --no-distfiles - don't download from distfiles
221 -nm, --no-mirrors - don't download from mirror, if source URL is given,
222 -nu, --no-urls - don't try to download from FTP/HTTP location,
223 -ns, --no-srcs - don't download Sources
224 -ns0, --no-source0 - don't download Source0
225 -nn, --no-net - don't download anything from the net
226 --opts <rpm opts> - additional options for rpm
227 -q, --quiet - be quiet,
228 --date yyyy-mm-dd - build package using resources from specified CVS date,
229 -r <cvstag>, --cvstag <cvstag>
230 - build package using resources from specified CVS tag,
231 -R, --fetch-build-requires
232 - fetch what is BuildRequired,
233 -RB, --remove-build-requires
234 - remove all you fetched with -R or --fetch-build-requires
235 remember, this option requires confirmation,
236 -FRB, --force-remove-build-requires
237 - remove all you fetched with -R or --fetch-build-requires
238 remember, this option works without confirmation,
239 -sf, --source-files - list sources - bare filenames (intended for offline
240 operations; does not work when Icon field is present
241 but icon file is absent),
242 -sp, --source-paths - list sources - filenames with full local paths (intended for
243 offline operations; does not work when Icon field is present
244 but icon file is absent),
245 -T <cvstag> , --tag <cvstag>
246 - add cvs tag <cvstag> for files,
247 -Tvs, --tag-version-stable
248 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
249 -Tvn, --tag-version-nest
250 - add cvs tags NEST and NAME-VERSION-RELEASE for files,
252 - add cvs tag STABLE for files,
254 - add cvs tag NEST for files,
256 - add cvs tag NAME-VERSION-RELEASE for files,
257 -Tp, --tag-prefix <prefix>
258 - add <prefix> to NAME-VERSION-RELEASE tags,
259 -tt, --test-tag <prefix>
260 - fail if tag is already present,
261 -ir, --integer-release-only
262 - allow only integer and snapshot releases
263 -v, --verbose - be verbose,
264 -u, --try-upgrade - check version, and try to upgrade package
265 -un, --try-upgrade-with-float-version
266 - as above, but allow float version
267 -U, --update - refetch sources, don't use distfiles, and update md5 comments
268 -Upi, --update-poldek-indexes
269 - refresh or make poldek package index files.
270 --with/--without <feature>
271 - conditional build package depending on %_with_<feature>/
272 %_without_<feature> macro switch. You may now use
273 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
274 constructions. Set GROUP_BCONDS to yes to make use of it.
275 --target <platform>, --target=<platform>
276 - build for platform <platform>.
281 if [ -n "$DEBUG" ]; then
288 rpm -bp --nodeps --define 'prep %dump' $BCOND $TARGET_SWITCH $SPECFILE 2>&1
291 rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $SPECFILE 2>&1
297 if [ -z "$rpm_dump_cache" ] ; then
298 echo "internal error: cache_rpm_dump not called!" 1>&2
300 echo "$rpm_dump_cache"
305 if [ -n "$DEBUG" ]; then
314 if [ "$NOSRCS" != "yes" ]; then
315 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
317 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
318 FAIL_IF_NO_SOURCES="no"
321 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
322 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
323 PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
324 PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -n 1`"
325 PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
327 # These variables may be unset after first cache_rpm_dump call
328 # (because of not-yet-retrieved icon file)
330 # if [ -z "$PACKAGE_NAME" -o -z "$PACKAGE_VERSION" -o -z "$PACKAGE_RELEASE" ]; then
331 # Exit_error err_no_package_data;
334 if [ -n "$BE_VERBOSE" ]; then
335 echo "- Sources : `nourl $SOURCES`"
336 if [ -n "$PATCHES" ]; then
337 echo "- Patches : `nourl $PATCHES`"
339 echo "- Patches : *no patches needed*"
341 if [ -n "$ICONS" ]; then
342 echo "- Icon : `nourl $ICONS`"
344 echo "- Icon : *no package icon*"
346 echo "- Name : $PACKAGE_NAME"
347 echo "- Version : $PACKAGE_VERSION"
348 echo "- Release : $PACKAGE_RELEASE"
354 if [ -n "$DEBUG" ]; then
362 "err_no_spec_in_cmdl" )
363 remove_build_requires
364 echo "ERROR: spec file name not specified.";
366 "err_no_spec_in_repo" )
367 remove_build_requires
368 echo "Error: spec file not stored in CVS repo.";
370 "err_no_source_in_repo" )
371 remove_build_requires
372 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)";
375 remove_build_requires
376 echo "Error: package build failed. (${2:-no more info})";
378 "err_no_package_data" )
379 remove_build_requires
380 echo "Error: couldn't get out package name/version/release from spec file."
383 remove_build_requires
384 echo "Tag ${2} already exists (spec release: ${3}).";
387 remove_build_requires
388 echo "Release ${2} not integer and not a snapshot.";
392 echo "Unknown error."
398 if [ -n "$DEBUG" ]; then
403 SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`"
404 SPECS_DIR="`$RPM --eval '%{_specdir}'`"
411 if [ -n "$DEBUG" ]; then
417 if [ \! -f "$SPECFILE" ]; then
418 SPECFILE="`basename $SPECFILE .spec`.spec";
420 if [ "$NOCVSSPEC" != "yes" ]; then
423 if [ -n "$CVSROOT" ]; then
424 OPTIONS="-d $CVSROOT $OPTIONS"
426 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
427 echo "warning: No cvs access defined - using local .spec file"
432 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
433 OPTIONS="$OPTIONS -A"
435 if [ -n "$CVSDATE" ]; then
436 OPTIONS="$OPTIONS -D $CVSDATE"
438 if [ -n "$CVSTAG" ]; then
439 OPTIONS="$OPTIONS -r $CVSTAG"
445 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
447 retries_counter=$(( $retries_counter + 1 ))
448 output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1)
450 [ -n "$output" ] && echo "$output"
451 if [ "$result" -ne "0" ]; then
452 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
453 echo "Trying again [$SPECFILE]... ($retries_counter)"
457 Exit_error err_no_spec_in_repo;
461 if [ ! -f "$SPECFILE" ]; then
462 Exit_error err_no_spec_in_repo;
465 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
466 chmod $CHMOD_MODE $SPECFILE
469 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
476 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
477 cvs update mirrors >&2
481 while read origin mirror name rest
483 ol=`echo -n "$origin"|wc -c`
484 prefix="`echo -n "$url" | head -c $ol`"
485 if [ "$prefix" = "$origin" ] ; then
486 suffix="`echo "$url"|cut -b $ol-`"
487 echo -n "$mirror$suffix"
498 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
499 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
505 [ X"$NO5" = X"yes" ] && return
507 [ -z "$no" ] && return
509 spec_rev=$(grep $SPECFILE CVS/Entries | sed -e s:/$SPECFILE/:: -e s:/.*::)
510 if [ -z "$spec_rev" ]; then
511 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
513 spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
514 md5=$(grep -s -v '^#' additional-md5sums | \
515 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
516 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
517 grep -E '^[0-9a-f]{32}$')
518 if [ X"$md5" = X"" ] ; then
519 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
520 if [ ! -z "$source_md5" ] ; then
523 # we have empty SourceX-md5, but it is still possible
524 # that we have NoSourceX-md5 AND NoSource: X
525 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
526 if [ ! -z "$nosource_md5" -a ! X"`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" = X"" ] ; then
531 if [ $(echo "$md5" | wc -l) != 1 ] ; then
532 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
534 echo "$md5" | tail -n 1
540 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
543 distfiles_attic_url ()
545 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
552 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
557 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
558 [ -n "$size" -a "$size" -gt 0 ]
563 if [ "$CVSIGNORE_DF" != "yes" ]; then
566 cvsignore=${SOURCE_DIR}/.cvsignore
567 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
568 echo "$1" >> $cvsignore
576 if [ -n "$DEBUG" ]; then
581 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
585 if [ -n "$CVSROOT" ]; then
586 OPTIONS="-d $CVSROOT $OPTIONS"
588 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
589 echo "warning: No cvs access defined for SOURCES"
593 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
594 OPTIONS="$OPTIONS -A"
596 if [ -n "$CVSDATE" ]; then
597 OPTIONS="$OPTIONS -D $CVSDATE"
599 if [ -n "$CVSTAG" ]; then
600 OPTIONS="$OPTIONS -r $CVSTAG"
605 if [ -n "$UPDATE5" ]; then
606 if [ -n "$ADD5" ]; then
607 [ `nourl $i` = "$i" ] && continue
608 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE && continue
610 grep -qiE '^#[ ]*Source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE || continue
614 if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
615 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
616 echo "Warning: no URL given for $i"
619 if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then
620 if good_md5 "$i" && good_size "$i"; then
621 echo "$(nourl "$i") having proper md5sum already exists"
625 url=$(distfiles_url "$i")
626 url_attic=$(distfiles_attic_url "$i")
628 if [ `echo $url | grep -E '^(\.|/)'` ]; then
629 ${GETLOCAL} $url $target
631 if [ -z "$NOMIRRORS" ]; then
632 url="`find_mirror "$url"`"
634 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
635 if [ `echo $url | grep -E 'ftp://'` ]; then
636 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
639 if ! test -s "$target"; then
641 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
642 ${GETLOCAL} $url_attic $target
644 if [ -z "$NOMIRRORS" ]; then
645 url_attic="`find_mirror "$url_attic"`"
647 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
648 if [ `echo $url_attic | grep -E 'ftp://'` ]; then
649 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
653 if test -s "$target"; then
659 elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then
660 # ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred
663 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]
665 retries_counter=$(( $retries_counter + 1 ))
666 output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1)
668 [ -n "$output" ] && echo "$output"
669 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
670 echo "Trying again [`nourl $i`]... ($retries_counter)"
679 if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then
680 if [ -z "$NOMIRRORS" ]; then
681 im="`find_mirror "$i"`"
686 if [ `echo $im | grep -E 'ftp://'` ]; then
693 if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
694 Exit_error err_no_source_in_repo $i;
695 elif [ -n "$UPDATE5" ] && \
696 ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \
697 [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \
698 grep -q -i -E '^#[ ]*source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE )
700 echo "Updating source-$srcno md5."
701 md5=$(md5sum `nourl $i` | cut -f1 -d' ')
703 print unless /^\s*#\s*Source'$srcno'-md5\s*:/i;
704 print "# Source'$srcno'-md5:\t'$md5'\n"
705 if /^Source'$srcno'\s*:\s+/;
710 if good_md5 "$i" && good_size "$i"; then
712 elif [ "$FROM_DISTFILES" = 1 ]; then
713 # wrong md5 from distfiles: remove the file and try again
715 echo "MD5 sum mismatch. Trying full fetch."
718 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
719 if [ `echo $url | grep -E 'ftp://'` ]; then
720 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
722 if ! test -s "$target"; then
724 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
725 if [ `echo $url_attic | grep -E 'ftp://'` ]; then
726 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
729 test -s "$target" || rm -f "$target"
732 if good_md5 "$i" && good_size "$i" ; then
735 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
736 echo "or -5 to update md5 sums, if you're sure files are correct."
737 Exit_error err_no_source_in_repo $i
741 if [ "$CHMOD" = "yes" ]; then
742 CHMOD_FILES="`nourl $GET_FILES`"
743 if [ -n "$CHMOD_FILES" ]; then
744 chmod $CHMOD_MODE $CHMOD_FILES
753 if [ -n "$DEBUG" ]; then
758 # Check whether first character of PACKAGE_NAME is legal for tag name
759 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
762 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"`
763 # Remove #kernel.version_release from TAGVER because tagging sources
764 # could occur with different kernel-headers than kernel-headers used at build time.
765 TAGVER=$(echo "$TAGVER" | sed -e 's/#.*//g')
773 if [ -n "$DEBUG" ]; then
778 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
779 echo "Version: $PACKAGE_VERSION"
780 echo "Release: $PACKAGE_RELEASE"
784 if [ "$TAG_VERSION" = "yes" ]; then
785 echo "CVS tag: $TAGVER"
787 if [ -n "$TAG" ]; then
792 if [ -n "$CVSROOT" ]; then
793 OPTIONS="-d $CVSROOT $OPTIONS"
799 # don't tag files stored on distfiles
800 [ -n "`src_md5 $i`" ] && continue
801 if [ -f "`nourl $i`" ]; then
802 if [ "$TAG_VERSION" = "yes" ]; then
803 cvs $OPTIONS $TAGVER `nourl $i`
805 if [ -n "$TAG" ]; then
806 cvs $OPTIONS $TAG `nourl $i`
809 Exit_error err_no_source_in_repo $i
814 if [ "$TAG_VERSION" = "yes" ]; then
815 cvs $OPTIONS $TAGVER $SPECFILE
817 if [ -n "$TAG" ]; then
818 cvs $OPTIONS $TAG $SPECFILE
828 echo "CVS branch tag: $TAG"
833 if [ -n "$DEBUG" ]; then
838 if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
841 if [ -n "$CVSROOT" ]; then
842 OPTIONS="-d $CVSROOT $OPTIONS"
847 if [ -f `nourl $i` ]; then
848 cvs $OPTIONS $TAG `nourl $i`
850 Exit_error err_no_source_in_repo $i
854 cvs $OPTIONS $TAG $SPECFILE
864 if [ -n "$DEBUG" ]; then
871 if [ -n "$TRY_UPGRADE" ]; then
872 if [ -n "$FLOAT_VERSION" ]; then
873 TNOTIFY=`./pldnotify.awk $SPECFILE -n`
875 TNOTIFY=`./pldnotify.awk $SPECFILE`
878 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
880 if [ -n "$TNEWVER" ]; then
881 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
882 echo "New version found, updating spec file to version " $TNEWVER
883 cp -f $SPECFILE $SPECFILE.bak
885 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
886 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t1/' $SPECFILE"
888 if [ -n "$ICONS" ]; then
892 get_files "$SOURCES $PATCHES";
893 unset TOLDVER TNEWVER TNOTIFY
900 BUILD_SWITCH="-ba" ;;
902 BUILD_SWITCH="-bb" ;;
904 BUILD_SWITCH="-bs --nodeps" ;;
906 BUILD_SWITCH="-bp --nodeps" ;;
908 if [ -n "$LOGFILE" ]; then
909 LOG=`eval echo $LOGFILE`
910 if [ -d "$LOG" ]; then
911 echo "Log file $LOG is a directory."
912 echo "Parse error in the spec?"
913 Exit_error err_build_fail;
915 if [ -n "$LASTLOG_FILE" ]; then
916 echo "LASTLOG=$LOG" > $LASTLOG_FILE
918 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
919 (time nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
920 RETVAL=`cat $RES_FILE`
922 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
923 if [ "$RETVAL" -eq "0" ]; then
930 eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $TARGET_SWITCH $SPECFILE
933 if [ "$RETVAL" -ne "0" ]; then
934 if [ -n "$TRY_UPGRADE" ]; then
935 echo "\n!!! Package with new version cannot be build automagically\n"
936 mv -f $SPECFILE.bak $SPECFILE
938 Exit_error err_build_fail;
945 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
948 install_required_packages()
956 AVAIL_BCONDS_WITHOUT=""
958 if `grep -q ^%bcond ${SPECFILE}`; then
960 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
966 # expand bconds from ~/.bcondrc
967 # The file structure is like gentoo's package.use:
970 # samba -mysql -pgsql
971 # w32codec license_agreement
974 if [ "${BCOND_VERSION}" != "NONE" ] && ( [ -f $HOME/.bcondrc ] || ( [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] ) ) ; then
975 # This takes package name, first defined in spec.
976 # so consider that when defining flags for package.
977 PN=`$RPM -q --qf '%{NAME}\n' --specfile $SPECFILE | head -n 1`
978 AVAIL=`$RPMBUILD --bcond $SPECFILE`
980 BCONDRC=$HOME/.bcondrc
981 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && BCONDRC=$HOME_ETC/.bcondrc
983 while read pkg flags; do
985 [[ "$pkg" == \#* ]] && continue
987 # any package or current package?
988 if [ "$pkg" = "*" ] || [ "$pkg" = "$PN" ]; then
989 for flag in $flags; do
992 # use only flags which are in this package.
993 if [[ $AVAIL = *${opt}* ]]; then
994 if [[ $flag = -* ]]; then
995 BCOND="$BCOND --without $opt"
997 BCOND="$BCOND --with $opt"
1005 case "${BCOND_VERSION}" in
1010 echo "Warning: This spec has old style bconds. Fix it || die."
1011 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_without_`
1013 AVAIL_BCOND_WITHOUT=`echo $opt|sed -e "s/^_without_//g"`
1014 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1015 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1017 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1021 for opt in `$RPMBUILD --bcond $SPECFILE |grep ^_with_`
1023 AVAIL_BCOND_WITH=`echo $opt|sed -e "s/^_with_//g"`
1024 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1025 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1027 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1032 cond_type="" # with || without
1033 for opt in `$RPMBUILD --bcond $SPECFILE`
1043 case "$cond_type" in
1046 AVAIL_BCOND_WITH="$opt"
1047 if `echo $BCOND|grep -q -- "--with $AVAIL_BCOND_WITH"`;then
1048 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1050 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1055 AVAIL_BCOND_WITHOUT="$opt"
1056 if `echo $BCOND|grep -q -- "--without $AVAIL_BCOND_WITHOUT"`;then
1057 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1059 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1073 echo -ne "Package installation failed:\t$package_name\n"
1075 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1076 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1077 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1078 # jakby nie bylo tego kawalka kodu.
1080 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1081 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1088 # Istnieje taki spec? ${package}.spec
1089 if [ -f "${SPECS_DIR}${package}.spec" ]; then
1090 parent_spec_name=${package}.spec
1091 elif [ -f "${SPECS_DIR}`echo ${package_name}|sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1092 parent_spec_name="`echo ${package_name}|sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1094 for provides_line in `grep ^Provides:.*$package ${SPECS_DIR} -R`
1100 if [ "${parent_spec_name}" != "" ]; then
1102 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1103 sub_builder_opts="${sub_builder_opts} -R"
1105 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1106 sub_builder_opts="${sub_builder_opts} -RB"
1107 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1108 sub_builder_opts="${sub_builder_opts} -FRB"
1110 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1111 sub_builder_opts="${sub_builder_opts} -Upi"
1114 ./builder ${sub_builder_opts} ${parent_spec_name}
1116 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1119 remove_build_requires()
1121 if [ "$INSTALLED_PACKAGES" != "" ]; then
1122 case "$REMOVE_BUILD_REQUIRES" in
1124 run_poldek --noask -ve $INSTALLED_PACKAGES
1127 run_poldek --ask -ve $INSTALLED_PACKAGES
1130 echo You may want to manually remove following BuildRequires fetched:
1131 echo $INSTALLED_PACKAGES
1132 echo Try poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`
1140 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1141 if [ "$BCOND" != "" ]; then
1142 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1145 echo -ne "\nNo conditional flags passed"
1147 echo -ne "\n\nfrom available:\n"
1148 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1152 fetch_build_requires()
1154 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1155 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1156 CONF=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print "@" $3 } ' | xargs)
1157 DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print "@" $3 } ' | xargs)
1158 if [ -n "$CONF" -o -n "$DEPS" ]; then
1159 $SU_SUDO /usr/bin/poldek --update; $SU_SUDO /usr/bin/poldek --upa
1161 if [ -n "$CONF" ]; then
1162 echo "Trying to uninstall conflicting packages ($CONF):"
1163 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CONF
1165 if [ -n "$DEPS" ]; then
1166 echo "Trying to install dependencies ($DEPS):"
1167 $SU_SUDO /usr/bin/poldek --caplookup -uGv $DEPS
1172 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1173 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1174 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1175 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1176 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1177 for package_item in `cat $SPECFILE|grep -B100000 ^%changelog|grep -v ^#|grep BuildRequires|grep -v ^-|sed -e "s/^.*BuildRequires://g"|awk '{print $1}'|sed -e s,perl\(,perl-,g -e s,::,-,g -e s,\(.*\),,g -e s,%{,,g -e s,},,g|grep -v OpenGL-devel|sed -e s,sh-utils,coreutils,g -e s,fileutils,coreutils,g -e s,textutils,coreutils,g -e s,kgcc_package,gcc,g -e s,\),,g`
1179 package_item="`echo $package_item|sed -e s,rpmbuild,rpm-build,g |sed -e s,__perl,perl,g |sed -e s,gasp,binutils-gasp,g -e s,binutils-binutils,binutils,g -e s,apxs,apache,g|sed -e s,apache\(EAPI\)-devel,apache-devel,g -e s,kernel-headers\(netfilter\),kernel-headers,g -e s,awk,mawk,g -e s,mmawk,mawk,g -e s,motif,openmotif,g -e s,openopenmotif,openmotif,g`"
1181 package=`basename "$package_item"|sed -e "s/}$//g"`
1182 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1185 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1186 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1187 if [ "$COND_ARCH_TST" != "" ] && [ "`echo $COND_ARCH_TST|sed -e "s/i.86/ix86/g"`" != "`echo $mach|sed -e "s/i.86/ix86/g"`" ]; then
1192 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1195 if `echo $COND_TST|grep -q 'without_'`; then
1196 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1197 if `echo $COND_TST|grep -q !`; then
1202 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1203 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1204 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1210 elif `echo $COND_TST|grep -q 'with_'`; then
1211 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1212 if `echo $COND_TST|grep -q !`; then
1217 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1218 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1219 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1225 RESULT="${COND_STATE}-${COND_ARGV}"
1227 "with-wout" | "wout-with" )
1230 "wout-wout" | "with-with" )
1234 echo "Action '$RESULT' was not defined for package '$package_item'"
1240 if [ "$GO" = "yes" ]; then
1241 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1242 echo "Testing if $package has subrequirements..."
1243 run_poldek -t -i $package --dumpn=".$package-req.txt"
1244 if [ -f ".$package-req.txt" ]; then
1245 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1247 if [ "$package_name" = "$package" ]; then
1248 echo -ne "Installing BuildRequired package:\t$package_name\n"
1249 export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}: Installing BuildRequired package: ${package_name}\007"`
1250 install_required_packages $package;
1252 echo -ne "Installing (sub)Required package:\t$package_name\n"
1253 export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}: Installing (sub)Required package: ${package_name}\007"`
1254 install_required_packages $package_name;
1258 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1259 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1262 echo "Attempting to run spawn sub - builder..."
1263 run_sub_builder $package_name
1264 if [ $? -eq 0 ]; then
1265 install_required_packages $package_name;
1268 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1269 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1272 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1279 rm -f ".$package-req.txt"
1281 echo "Attempting to run spawn sub - builder..."
1282 run_sub_builder $package
1283 if [ $? -eq 0 ]; then
1284 install_required_packages $package;
1287 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1288 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1291 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1297 echo "Package $package is already installed. BuildRequirement satisfied."
1301 export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}\007"`
1302 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1303 echo "Unable to install following packages and their dependencies:"
1304 for pkg in "$NOT_INSTALLED_PACKAGES"
1308 remove_build_requires
1316 # vim like diff colourization, glen@pld-linux.org
1318 s,
\e,
\e[44m^[
\e[49m,g;
1319 s,
\a,
\e[44m^G
\e[49m,g;
1320 s,^\(Index:\|diff\|---\|+++\) .*$,
\e[32m&,;
1324 s,
\r,
\e[44m^M
\e[49m,g;
1326 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1
\e[41m\2
\e[49m,g;
1335 tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/adapter-XXXXXX) || exit
1336 awk -f adapter.awk $SPECFILE > $tmpdir/$SPECFILE
1338 if [ "`diff --brief $SPECFILE $tmpdir/$SPECFILE`" ] ; then
1339 diff -u $SPECFILE $tmpdir/$SPECFILE > $tmpdir/$SPECFILE.diff
1340 diffcol $tmpdir/$SPECFILE.diff | less -r
1343 echo -n "Accept? [yn] "
1347 mv -f $tmpdir/$SPECFILE $SPECFILE
1348 echo "Ok, adapterized."
1359 echo "The SPEC is perfect ;)"
1365 #---------------------------------------------
1368 if [ "$#" = 0 ]; then
1382 -a | --adapter | --adapterize )
1383 COMMAND="adapterize";
1400 DEBUG="yes"; shift ;;
1402 COMMAND="version"; shift ;;
1404 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
1405 -b | -ba | --build )
1406 COMMAND="build"; shift ;;
1407 -bb | --build-binary )
1408 COMMAND="build-binary"; shift ;;
1409 -bs | --build-source )
1410 COMMAND="build-source"; shift ;;
1411 -bp | --build-prep )
1412 COMMAND="build-prep"; shift ;;
1414 COMMAND="branch"; shift; TAG="${1}"; shift;;
1416 CLEAN="--clean --rmspec --rmsource"; shift ;;
1418 shift; CVSROOT="${1}"; shift ;;
1420 COMMAND="get"; shift ;;
1422 COMMAND="usage"; shift ;;
1424 PROTOCOL="http"; shift ;;
1426 shift; LOGFILE="${1}"; shift ;;
1428 shift; DEF_NICE_LEVEL=${1}; shift ;;
1430 COMMAND="mr-proper"; shift ;;
1432 NOCVS="yes"; shift ;;
1433 -ncs | --no-cvs-specs )
1434 NOCVSSPEC="yes"; shift ;;
1435 -nd | --no-distfiles )
1436 NODIST="yes"; shift ;;
1437 -nm | --no-mirrors )
1438 NOMIRRORS="yes"; shift ;;
1440 NOURLS="yes"; shift ;;
1442 NOSRCS="yes"; shift ;;
1443 -ns0 | --no-source0 )
1444 NOSOURCE0="yes"; shift ;;
1454 shift; RPMOPTS="$RPM_OPTS ${1}"; shift ;;
1455 --with | --without )
1456 case $GROUP_BCONDS in
1460 while ! `echo ${1}|grep -qE '(^-|spec)'`
1462 BCOND="$BCOND $COND $1"
1466 BCOND="$BCOND $1 $2" ; shift 2 ;;
1470 shift; TARGET="${1}"; shift ;;
1472 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
1474 QUIET="--quiet"; shift ;;
1476 CVSDATE="${2}"; shift 2 ;;
1478 shift; CVSTAG="${1}"; shift ;;
1479 -R | --fetch-build-requires)
1480 FETCH_BUILD_REQUIRES="yes"
1481 NOT_INSTALLED_PACKAGES=
1483 -RB | --remove-build-requires)
1484 REMOVE_BUILD_REQUIRES="nice"
1486 -FRB | --force-remove-build-requires)
1487 REMOVE_BUILD_REQUIRES="force"
1489 -sf | --sources-files)
1490 COMMAND="list-sources-files"
1492 -sp | --sources-paths)
1493 COMMAND="list-sources-local-paths"
1495 -Tvs | --tag-version-stable )
1500 -Tvn | --tag-version-nest )
1505 -Ts | --tag-stable )
1515 -Tv | --tag-version )
1520 -Tp | --tag-prefix )
1532 -ir | --integer-release-only )
1533 INTEGER_RELEASE="yes"
1542 -Upi | --update-poldek-indexes )
1543 UPDATE_POLDEK_INDEXES="yes"
1545 -u | --try-upgrade )
1546 TRY_UPGRADE="1"; shift ;;
1547 -un | --try-upgrade-with-float-version )
1548 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
1550 BE_VERBOSE="1"; shift ;;
1556 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
1560 RPMOPTS="${RPMOPTS} --nodeps"
1563 RPMOPTS="${RPMOPTS} -debug"; shift ;;
1566 export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}\007"`
1571 if [ -n "$DEBUG" ]; then
1576 if [ -n "$TARGET" ]; then
1579 TARGET_SWITCH="--target $TARGET" ;;
1581 TARGET_SWITCH="--target=$TARGET" ;;
1586 "build" | "build-binary" | "build-source" | "build-prep" )
1588 if [ -n "$SPECFILE" ]; then
1592 fetch_build_requires;
1594 if [ "$INTEGER_RELEASE" = "yes" ]; then
1595 echo "Checking release $PACKAGE_RELEASE..."
1596 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
1597 Exit_error err_fract_rel "$PACKAGE_RELEASE"
1601 if [ -n "$TEST_TAG" ]; then
1602 TAGVER=`make_tagver`
1603 echo "Searching for tag $TAGVER..."
1604 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
1605 if [ -n "$TAGREL" ]; then
1606 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
1610 if [ -n "$ICONS" ]; then
1614 if [ -n "$NOSOURCE0" ] ; then
1615 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
1617 get_files "$SOURCES $PATCHES";
1619 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
1620 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
1622 remove_build_requires;
1624 Exit_error err_no_spec_in_cmdl;
1629 if [ -n "$SPECFILE" ]; then
1632 if [ -n "$ICONS" ]; then
1636 get_files $SOURCES $PATCHES;
1637 branch_files $TAG "$SOURCES $PATCHES $ICONS";
1639 Exit_error err_no_spec_in_cmdl;
1644 if [ -n "$SPECFILE" ]; then
1647 if [ -n "$ICONS" ]; then
1648 OLD_UPDATE5=$UPDATE5
1649 UPDATE5= get_files $ICONS
1650 UPDATE5=$OLD_UPDATE5
1653 if [ -n "$NOSOURCE0" ] ; then
1654 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
1656 get_files $SOURCES $PATCHES
1658 Exit_error err_no_spec_in_cmdl;
1665 if [ -n "$SPECFILE" ]; then
1668 if [ -n "$ICONS" ]; then
1672 # don't fetch sources from remote locations
1674 for file in $SOURCES
1676 [ -n "`src_md5 $file`" ] && continue
1677 new_SOURCES="$new_SOURCES $file"
1679 SOURCES="$new_SOURCES"
1680 get_files $SOURCES $PATCHES;
1681 tag_files "$SOURCES $PATCHES $ICONS";
1683 Exit_error err_no_spec_in_cmdl;
1687 $RPM --clean --rmsource --rmspec --force --nodeps $SPECFILE
1689 "list-sources-files" )
1692 DONT_PRINT_REVISION="yes"
1695 SAPS="$SOURCES $PATCHES"
1696 for SAP in $SAPS ; do
1697 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
1700 "list-sources-local-paths" )
1703 DONT_PRINT_REVISION="yes"
1706 SAPS="$SOURCES $PATCHES"
1707 for SAP in $SAPS ; do
1708 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
1719 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
1720 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
1724 # vi:syntax=sh:ts=3:sw=4