3 # This program is free software, distributed under the terms of
4 # the GNU General Public License Version 2.
10 # 2 - no spec file name in cmdl parameters
11 # 3 - spec file not stored in repo
12 # 4 - some source, patch or icon files not stored in repo
13 # 5 - package build failed
14 # 6 - spec file with errors
15 # 7 - wrong source in /etc/poldek.conf
16 # 8 - Failed installing buildrequirements and subrequirements
17 # 9 - Requested tag already exist
18 # 10 - Refused to build fractional release
19 # 100 - Unknown error (should not happen)
22 # - builder -u fetches current version first (well that's okay, how you compare versions if you have no old spec?)
23 # - when Icon: field is present, -5 and -a5 doesn't work
24 # - builder -R skips installing BR if spec is not present before builder invocation (need to run builder twice)
31 Build package utility from PLD Linux CVS repository
32 $VERSION (C) 1999-2007 Free Penguins".
34 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
53 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
57 # use rpm 4.4.6+ digest format instead of comments if non-zero
60 # user agent when fetching files
61 USER_AGENT="PLD/Builder($VERSION)"
63 # It can be used i.e. in log file naming.
64 # See LOGFILE example.
65 DATE=`date +%Y-%m-%d_%H-%M-%S`
67 # Example: LOGFILE='../log.$PACKAGE_NAME'
68 # Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
69 # Yes, you can use variable name! Note _single_ quotes!
93 WGET_RETRIES=${MAX_WGET_RETRIES:-0}
94 CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
100 CVS_SERVER="cvs.pld-linux.org"
101 DISTFILES_SERVER="://distfiles.pld-linux.org"
102 ATTICDISTFILES_SERVER="://attic-distfiles.pld-linux.org"
107 FAIL_IF_NO_SOURCES="yes"
109 # let get_files skip over files which are present to get those damn files fetched
110 SKIP_EXISTING_FILES="no"
113 # should the specfile be restored if upgrade failed?
114 REVERT_BROKEN_UPGRADE="yes"
116 if rpm --specsrpm 2>/dev/null; then
117 FETCH_BUILD_REQUIRES_RPMSPECSRPM="yes"
118 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
120 FETCH_BUILD_REQUIRES_RPMSPECSRPM="no"
121 if [ -x /usr/bin/rpm-getdeps ]; then
122 FETCH_BUILD_REQUIRES_RPMGETDEPS="yes"
124 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
129 # Here we load saved user environment used to
130 # predefine options set above, or passed to builder
132 # This one reads global system environment settings:
133 if [ -f ~/etc/builderrc ]; then
136 # And this one cascades settings using user personal
138 # Example of ~/.builderrc:
140 #UPDATE_POLDEK_INDEXES="yes"
141 #FETCH_BUILD_REQUIRES="yes"
142 #REMOVE_BUILD_REQUIRES="force"
144 #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
148 if [ -n "$HOME_ETC" ]; then
149 USER_CFG="$HOME_ETC/.builderrc"
150 BUILDER_MACROS="$HOME_ETC/.builder-rpmmacros"
152 USER_CFG=~/.builderrc
153 BUILDER_MACROS=~/.builder-rpmmacros
156 [ -f "$USER_CFG" ] && . "$USER_CFG"
158 if [ "$SCHEDTOOL" = "auto" ]; then
159 if [ -x /usr/bin/schedtool ] && schedtool -B -e echo >/dev/null; then
160 SCHEDTOOL="schedtool -B -e"
166 if [ -n "$USE_PROZILLA" ]; then
167 GETURI="proz --no-getch -r -P ./ -t$WGET_RETRIES $PROZILLA_OPTS"
170 elif [ -n "$USE_AXEL" ]; then
171 GETURI="axel -a $AXEL_OPTS"
175 wget --help 2>&1 | grep -q -- ' --no-check-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
176 wget --help 2>&1 | grep -q -- ' --inet ' && WGET_OPTS="$WGET_OPTS --inet"
177 wget --help 2>&1 | grep -q -- ' --retry-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
178 WGET_OPTS="$WGET_OPTS --user-agent=$USER_AGENT"
180 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
181 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
187 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
195 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
196 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
200 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
201 if [ -n "$LOGFILE" ]; then
202 LOG=`eval echo $LOGFILE`
203 if [ -n "$LASTLOG_FILE" ]; then
204 echo "LASTLOG=$LOG" > $LASTLOG_FILE
206 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
209 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
210 return `cat ${RES_FILE}`
215 #---------------------------------------------
220 if [ -n "$DEBUG" ]; then set -xv; fi
222 Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
223 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
224 [{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
225 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
226 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
227 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
228 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
229 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
230 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
231 <package>[.spec][:cvstag]
233 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
234 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
235 -n5, --no-md5 - ignore md5 comments in spec
236 -D, --debug - enable builder script debugging mode,
237 -debug - produce rpm debug package (same as --opts -debug)
238 -V, --version - output builder version string
239 --short-version - output builder short version
240 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
241 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
243 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
244 only package from <package>.spec,
245 -bp, --build-prep - execute the %prep phase of <package>.spec,
246 -bc - execute the %build phase of <package>.spec,
247 -bi - execute the %install phase of <package>.spec
248 -bl - execute the %files phase of <package>.spec
249 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
251 --short-circuit - short-circuit build
252 -B, --branch - add branch
253 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
254 SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
255 -m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
256 SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
258 -cf, --cvs-force - use -F when tagging (useful when moving branches)
259 -d <cvsroot>, --cvsroot <cvsroot>
261 --define <macro> <value>
262 - define a macro <macro> with value <value>,
263 --alt_kernel <kernel>
264 - same as --define 'alt_kernel <kernel>'
265 --nodeps - rpm won't check any dependences
266 -g, --get - get <package>.spec and all related files from CVS repo
268 -h, --help - this message,
269 --http - use http instead of ftp,
270 -l <logfile>, --logtofile <logfile>
272 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
274 - don't check specs in CVS
275 -nd, --no-distfiles - don't download from distfiles
276 -nm, --no-mirrors - don't download from mirror, if source URL is given,
277 -nu, --no-urls - don't try to download from FTP/HTTP location,
278 -ns, --no-srcs - don't download Sources
279 -ns0, --no-source0 - don't download Source0
280 -nn, --no-net - don't download anything from the net
281 -pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
282 --no-init - don't initialize builder paths (SPECS and SOURCES)
284 --skip-existing-files - skip existing files in get_files
285 --opts <rpm opts> - additional options for rpm
286 -q, --quiet - be quiet,
287 --date yyyy-mm-dd - build package using resources from specified CVS date,
288 -r <cvstag>, --cvstag <cvstag>
289 - build package using resources from specified CVS tag,
290 -A - build package using CVS resources as any sticky tags/date/kopts being reset.
291 -R, --fetch-build-requires
292 - fetch what is BuildRequired,
293 -RB, --remove-build-requires
294 - remove all you fetched with -R or --fetch-build-requires
295 remember, this option requires confirmation,
296 -FRB, --force-remove-build-requires
297 - remove all you fetched with -R or --fetch-build-requires
298 remember, this option works without confirmation,
299 -sd, --source-distfiles - list sources available from distfiles (intended for offline
300 operations; does not work when Icon field is present
301 but icon file is absent),
302 -sc, --source-cvs - list sources available from CVS
303 -sdp, --source-distfiles-paths - list sources available from distfiles -
304 paths relative to distfiles directory (intended for offline
305 operations; does not work when Icon field is present
306 but icon file is absent),
307 -sf, --source-files - list sources - bare filenames (intended for offline
308 operations; does not work when Icon field is present
309 but icon file is absent),
310 -sp, --source-paths - list sources - filenames with full local paths (intended for
311 offline operations; does not work when Icon field is present
312 but icon file is absent),
313 -su, --source-urls - list urls - urls to sources and patches
314 intended for copying urls with spec with lots of macros in urls
315 -T <cvstag> , --tag <cvstag>
316 - add cvs tag <cvstag> for files,
317 -Tvs, --tag-version-stable
318 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
320 - add cvs tag STABLE for files,
322 - add cvs tag NAME-VERSION-RELEASE for files,
323 -Tp, --tag-prefix <prefix>
324 - add <prefix> to NAME-VERSION-RELEASE tags,
325 -tt, --test-tag <prefix>
326 - fail if tag is already present,
327 -ir, --integer-release-only
328 - allow only integer and snapshot releases
329 -v, --verbose - be verbose,
330 -u, --try-upgrade - check version, and try to upgrade package
331 -un, --try-upgrade-with-float-version
332 - as above, but allow float version
334 - try download source from tag head if don't find it in
336 -U, --update - refetch sources, don't use distfiles, and update md5 comments
337 -Upi, --update-poldek-indexes
338 - refresh or make poldek package index files.
339 -np, --nopatch <patchnumber>
340 - don't apply <patchnumber>
341 --show-bconds - show available conditional builds, which can be used
342 - with --with and/or --without switches.
343 --show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
344 ./repackage.sh script. in other words, the output is
345 parseable by scripts.
346 --with/--without <feature>
347 - conditional build package depending on %_with_<feature>/
348 %_without_<feature> macro switch. You may now use
349 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
350 constructions. Set GROUP_BCONDS to yes to make use of it.
351 --target <platform>, --target=<platform>
352 - build for platform <platform>.
353 --init-rpm-dir - initialize ~/rpm directory structure
357 # change dependency to specname
359 # - perl(Package::Name) -> perl-Package-Name
363 package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g}')
367 update_shell_title() {
369 local len=${COLUMNS:-80}
370 local msg=$(echo "$*" | cut -c-$len)
372 if [ -n "$BE_VERBOSE" ]; then
373 echo >&2 "$(date +%s.%N) $*"
376 if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
378 if [ -n "$PACKAGE_NAME" ]; then
379 pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
384 msg="$pkg: ${SHELL_TITLE_PREFIX:+$SHELL_TITLE_PREFIX }$msg"
385 msg="$(echo $msg | tr -d '\n\r')"
388 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
391 echo >&2 -ne "\033]0;$msg\007"
397 # set TARGET from BuildArch: from SPECFILE
399 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
400 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
402 target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
406 TARGET_SWITCH="--target ${TARGET}-${target_platform}" ;;
408 TARGET_SWITCH="--target=$TARGET" ;;
414 # runs rpm with minimal macroset
416 # we reset macros not to contain macros.build as all the %() macros are
417 # executed here, while none of them are actually needed.
418 # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
419 safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
421 # TODO: move these to /usr/lib/rpm/macros
422 cat > $BUILDER_MACROS <<'EOF'
423 %x8664 x86_64 amd64 ia32e
426 %requires_releq_kernel_up %{nil}
427 %requires_releq_kernel_smp %{nil}
428 %requires_releq_kernel %{nil}
429 %requires_releq() %{nil}
430 %pyrequires_eq() %{nil}
431 %requires_eq() %{nil}
432 %requires_eq_to() %{nil}
433 %releq_kernel_up ERROR
434 %releq_kernel_smp ERROR
439 %ruby_ver_requires_eq() %{nil}
440 %ruby_mod_ver_requires_eq() %{nil}
441 %__php_api_requires() %{nil}
442 %php_major_version ERROR
443 %php_api_version ERROR
444 %requires_xorg_xserver_extension %{nil}
445 %requires_xorg_xserver_xinput %{nil}
446 %requires_xorg_xserver_font %{nil}
447 %requires_xorg_xserver_videodrv %{nil}
449 %perl_vendorarch ERROR
450 %perl_vendorlib ERROR
451 # damn. need it here! - copied from /usr/lib/rpm/macros.build
452 %tmpdir %(echo "${TMPDIR:-/tmp}")
453 %patchset_source(f:b:) %(
454 base=%{-b*}%{!-b*:10000};
455 start=$(expr $base + %1);
456 end=$(expr $base + %{?2}%{!?2:%{1}});
457 # we need to call seq twice as it doesn't allow two formats
458 seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
459 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
460 paste %{tmpdir}/__ps{1,2};
461 rm -f %{tmpdir}/__ps{1,2};
465 if [ "$NOINIT" = "yes" ] ; then
466 cat >> $BUILDER_MACROS <<'EOF'
471 eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
475 if [ -n "$DEBUG" ]; then
480 update_shell_title "cache_rpm_dump"
481 if [ -x /usr/bin/rpm-specdump ]; then
482 rpm_dump_cache=`rpm-specdump $BCOND $TARGET_SWITCH $SPECFILE`
486 # what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
487 dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
493 ARGS='--nodigest --nosignature --nobuild'
496 minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
498 if [ $? -gt 0 ]; then
499 error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
501 Exit_error err_build_fail
504 # make small dump cache
505 rpm_dump_cache=`echo "$rpm_dump" | awk '
506 $2 ~ /^SOURCEURL/ {print}
507 $2 ~ /^PATCHURL/ {print}
508 $2 ~ /^nosource/ {print}
509 $2 ~ /^PACKAGE_/ {print}
513 update_shell_title "cache_rpm_dump: OK!"
517 if [ -z "$rpm_dump_cache" ] ; then
518 echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
520 echo "$rpm_dump_cache"
525 update_shell_title "get icons"
526 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
527 if [ -z "$ICONS" ]; then
531 rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
536 update_shell_title "parsing specfile"
537 if [ -n "$DEBUG" ]; then
542 # icons are needed for successful spec parse
548 if [ "$NOSRCS" != "yes" ]; then
549 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
552 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
553 FAIL_IF_NO_SOURCES="no"
556 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
557 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
558 PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}')
559 PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
560 PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
562 if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
563 echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
566 if [ -n "$BE_VERBOSE" ]; then
567 echo "- Sources : `nourl $SOURCES`"
568 if [ -n "$PATCHES" ]; then
569 echo "- Patches : `nourl $PATCHES`"
571 echo "- Patches : *no patches needed*"
573 if [ -n "$ICONS" ]; then
574 echo "- Icon : `nourl $ICONS`"
576 echo "- Icon : *no package icon*"
578 echo "- Name : $PACKAGE_NAME"
579 echo "- Version : $PACKAGE_VERSION"
580 echo "- Release : $PACKAGE_RELEASE"
583 update_shell_title "parse_spec: OK!"
588 if [ -n "$DEBUG" ]; then
596 "err_no_spec_in_cmdl" )
597 remove_build_requires
598 echo "ERROR: spec file name not specified."
600 "err_invalid_cmdline" )
601 echo "ERROR: invalid command line arg ($2)."
603 "err_no_spec_in_repo" )
604 remove_build_requires
605 echo "Error: spec file not stored in CVS repo."
607 "err_no_source_in_repo" )
608 remove_build_requires
609 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"
612 remove_build_requires
613 echo "Error: package build failed. (${2:-no more info})"
615 "err_no_package_data" )
616 remove_build_requires
617 echo "Error: couldn't get out package name/version/release from spec file."
620 remove_build_requires
621 echo "Tag ${2} already exists (spec release: ${3})."
624 remove_build_requires
625 echo "Release ${2} not integer and not a snapshot."
627 "err_branch_exists" )
628 remove_build_requires
629 echo "Tree branch already exists (${2})."
632 remove_build_requires
633 echo "Error: conditions reject building this spec (${2})."
636 echo "Unknown error."
642 if [ -n "$DEBUG" ]; then
647 if [ "$NOINIT" != "yes" ] ; then
649 if [ "$ASSUMED_NAME" ]; then
650 extra="--define 'name $ASSUMED_NAME'"
652 SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
653 SPEC_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
665 update_shell_title "get_spec"
667 if [ -n "$DEBUG" ]; then
673 if [ ! -f "$SPECFILE" ]; then
674 SPECFILE="`basename $SPECFILE .spec`.spec"
676 if [ "$NOCVSSPEC" != "yes" ]; then
678 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
679 echo "Warning: No CVS access defined - using local .spec file"
683 cvsup "$SPECFILE" || Exit_error err_no_spec_in_repo
686 if [ ! -f "$SPECFILE" ]; then
687 Exit_error err_no_spec_in_repo
690 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
691 chmod $CHMOD_MODE $SPECFILE
694 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
703 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
704 cvs update mirrors >&2
708 local origin mirror name rest ol prefix
709 while read origin mirror name rest; do
710 # skip comments and empty lines
711 if [ -z "$origin" ] || [[ $origin == \#* ]]; then
714 ol=`echo -n "$origin"|wc -c`
715 prefix="`echo -n "$url" | head -c $ol`"
716 if [ "$prefix" = "$origin" ] ; then
717 suffix="`echo "$url"|cut -b $((ol+1))-`"
718 echo -n "$mirror$suffix"
725 # Warning: unpredictable results if same URL used twice
730 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
731 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
737 [ "$NO5" = "yes" ] && return
739 [ -z "$no" ] && return
743 if [ -f additional-md5sums ]; then
744 local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
745 if [ -z "$spec_rev" ]; then
746 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
748 local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
749 md5=$(grep -s -v '^#' additional-md5sums | \
750 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
751 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
752 grep -E '^[0-9a-f]{32}$')
755 if [ $(echo "$md5" | wc -l) != 1 ] ; then
756 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
758 echo "$md5" | tail -n 1
763 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
764 if [ -n "$source_md5" ]; then
767 source_md5=`grep -i "BuildRequires:[ ]*digest(%SOURCE$no)[ ]*=" $SPECFILE | sed -e 's/.*=//'`
768 if [ -n "$source_md5" ]; then
771 # we have empty SourceX-md5, but it is still possible
772 # that we have NoSourceX-md5 AND NoSource: X
773 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
774 if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
783 echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
788 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
791 distfiles_attic_url ()
793 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
800 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
805 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
806 [ -n "$size" -a "$size" -gt 0 ]
811 if [ "$CVSIGNORE_DF" != "yes" ]; then
814 cvsignore=${SOURCE_DIR}/.cvsignore
815 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
816 echo "$1" >> $cvsignore
822 update_shell_title "cvsup"
824 if [ -n "$CVSROOT" ]; then
825 OPTIONS="-d $CVSROOT $OPTIONS"
828 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
829 OPTIONS="$OPTIONS -A"
831 if [ -n "$CVSDATE" ]; then
832 OPTIONS="$OPTIONS -D $CVSDATE"
834 if [ -n "$CVSTAG" ]; then
835 OPTIONS="$OPTIONS -r $CVSTAG"
840 local retries_counter=0
842 update_shell_title "cvsup: $*"
844 update_shell_title "cvsup: $# files"
846 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
847 retries_counter=$(( $retries_counter + 1 ))
848 output=$(LC_ALL=C cvs $OPTIONS "$@" 2>&1)
850 [ -n "$output" ] && echo "$output"
851 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
852 echo "Trying again [$*]... ($retries_counter)"
853 update_shell_title "cvsup: retry #$retries_counter"
860 update_shell_title "cvsup: done!"
864 # returns true if "$1" is ftp, http or https protocol url
868 ftp://*|http://*|https://*)
877 if [ $# -eq 0 ]; then
881 update_shell_title "update md5"
882 if [ -n "$DEBUG" ]; then
889 # pass 1: check files to be fetched
893 local fp=$(nourl "$i")
894 local srcno=$(src_no "$i")
895 if [ -n "$ADD5" ]; then
896 [ "$fp" = "$i" ] && continue # FIXME what is this check doing?
897 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE && continue
898 grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE && continue
900 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE || continue
902 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
903 need_files="$need_files $i"
907 # pass 1a: get needed files
908 if [ "$need_files" ]; then
909 get_files $need_files
912 # pass 2: proceed with md5 adding or updating
914 local fp=$(nourl "$i")
915 local srcno=$(src_no "$i")
916 local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE )
917 if [ -z "$md5" ]; then
918 md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE )
920 if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
921 local tag="# Source$srcno-md5:\t"
922 if [[ "$md5" == *NoSource* ]]; then
923 tag="# NoSource$srcno-md5:\t"
924 elif [ -n "$USEDIGEST" ]; then
925 tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
927 md5=$(md5sum "$fp" | cut -f1 -d' ')
928 echo "Updating Source$srcno ($md5: $fp)."
930 print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
931 print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
940 update_shell_title "check md5"
943 if good_md5 "$i" && good_size "$i"; then
947 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
948 echo "or -5 to update md5 sums, if you're sure files are correct."
949 Exit_error err_no_source_in_repo $i
955 update_shell_title "get_files"
957 if [ -n "$DEBUG" ]; then
962 if [ $# -gt 0 ]; then
965 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
966 echo "Warning: No CVS access defined for SOURCES"
971 local get_files_cvs=""
975 SHELL_TITLE_PREFIX="get_files[$nc/$#]"
976 update_shell_title "$i"
977 local fp=`nourl "$i"`
978 if [ "$SKIP_EXISTING_FILES" = "yes" ] && [ -f "$fp" ]; then
983 local srcmd5=$(src_md5 "$i")
985 # we know if source/patch is present in cvs/distfiles
986 # - has md5 (in distfiles)
989 # CHECK: local file didn't exist or always cvs up (first) requested.
990 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
991 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
992 echo "Warning: no URL given for $i"
995 if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
996 if good_md5 "$i" && good_size "$i"; then
997 echo "$fp having proper md5sum already exists"
1002 # optionally prefer mirror over distfiles if there's mirror
1003 # TODO: build url list and then try each url from the list
1004 if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
1007 url=$(distfiles_url "$i")
1010 url_attic=$(distfiles_attic_url "$i")
1012 # is $url local file?
1013 if [[ "$url" = [./]* ]]; then
1014 update_shell_title "${GETLOCAL%% *}: $url"
1015 ${GETLOCAL} $url $target
1017 if [ -z "$NOMIRRORS" ]; then
1018 url=$(find_mirror "$url")
1022 # make shorter message for distfiles urls
1023 if [[ "$uri" = ${PROTOCOL}${DISTFILES_SERVER}* ]] || [[ "$uri" = ${PROTOCOL}${ATTICDISTFILES_SERVER}* ]]; then
1024 uri=${uri#${PROTOCOL}${DISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1025 uri=${uri#${PROTOCOL}${ATTICDISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1028 update_shell_title "${GETURI%% *}: $uri"
1029 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1030 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1031 update_shell_title "${GETURI2%% *}: $url"
1032 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1037 if [ ! -s "$target" ]; then
1039 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
1040 update_shell_title "${GETLOCAL%% *}: $url_attic"
1041 ${GETLOCAL} $url_attic $target
1043 if [ -z "$NOMIRRORS" ]; then
1044 url_attic="`find_mirror "$url_attic"`"
1046 update_shell_title "${GETURI%% *}: $url_attic"
1047 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1048 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1049 update_shell_title "${GETURI2%% *}: $url_attic"
1050 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1055 if [ -s "$target" ]; then
1056 cvsignore_df $target
1061 elif [ "$NOCVS" != "yes" -a -z "$srcmd5" ]; then
1062 if [ $# -gt 1 ]; then
1063 get_files_cvs="$get_files_cvs $fp"
1064 update_shell_title "$fp (will cvs up later)"
1071 if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
1072 if [ -z "$NOMIRRORS" ]; then
1073 im="`find_mirror "$i"`"
1077 update_shell_title "${GETURI%% *}: $im"
1078 ${GETURI} "$im" || \
1079 if [ "`echo $im | grep -E 'ftp://'`" ]; then
1080 update_shell_title "${GETURI2%% *}: $im"
1085 if [ "$cvsup" = 1 ]; then
1091 # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
1092 if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
1093 if [ -n "GREEDSRC" ]; then
1094 get_greed_sources $i
1096 Exit_error err_no_source_in_repo $i
1100 # we check md5 here just only to refetch immediately
1101 if good_md5 "$i" && good_size "$i"; then
1103 elif [ "$FROM_DISTFILES" = 1 ]; then
1104 # wrong md5 from distfiles: remove the file and try again
1106 echo "MD5 sum mismatch. Trying full fetch."
1109 update_shell_title "${GETURI%% *}: $url"
1110 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1111 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1112 update_shell_title "${GETURI2%% *}: $url"
1113 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1115 if [ ! -s "$target" ]; then
1117 update_shell_title "${GETURI%% *}: $url_attic"
1118 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1119 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1120 update_shell_title "${GETURI2%% *}: $url_attic"
1121 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1124 test -s "$target" || rm -f "$target"
1127 SHELL_TITLE_PREFIX=""
1129 if [ "$get_files_cvs" ]; then
1130 cvsup $get_files_cvs
1133 if [ "$CHMOD" = "yes" ]; then
1134 CHMOD_FILES="`nourl "$@"`"
1135 if [ -n "$CHMOD_FILES" ]; then
1136 chmod $CHMOD_MODE $CHMOD_FILES
1143 if [ -n "$DEBUG" ]; then
1148 # Check whether first character of PACKAGE_NAME is legal for tag name
1149 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
1153 # NOTE: CVS tags may must not contain the characters `$,.:;@'
1154 TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
1156 # Remove #kernel.version_release from TAGVER because tagging sources
1157 # could occur with different kernel-headers than kernel-headers used at build time.
1158 # besides, %{_kernel_ver_str} is not expanded.
1160 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
1161 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
1167 # bool is_tag_a_branch(tag)
1169 # returns 1 if a tag is a branch set on SPECFILE
1171 if [ -n "$DEBUG" ]; then
1176 if [ $# -ne 1 ]; then
1183 cvs status -v $SPECFILE | grep -Eiq "${TAG}.+(branch: [0-9.]+)"
1191 if [ -n "$DEBUG" ]; then
1196 echo "Version: $PACKAGE_VERSION"
1197 echo "Release: $PACKAGE_RELEASE"
1200 if [ "$TAG_VERSION" = "yes" ]; then
1201 TAGVER=`make_tagver`
1202 echo "CVS tag: $TAGVER"
1204 if [ -n "$TAG" ]; then
1205 echo "CVS tag: $TAG"
1208 local OPTIONS="tag $CVS_FORCE"
1209 if [ -n "$CVSROOT" ]; then
1210 OPTIONS="-d $CVSROOT $OPTIONS"
1213 # if a tagname we are about to set already exists
1214 # and happens to be a branch (common case with AC-branch)
1215 # pass -B (allows -F to disturb branch tag)
1217 if [ "$TAG_VERSION" = "yes" ]; then
1220 is_tag_a_branch $_tag
1221 if [ $? -eq 0 ]; then
1222 OPTIONS="$OPTIONS -B"
1227 for i in $TAG_FILES; do
1228 # don't tag files stored on distfiles
1229 [ -n "`src_md5 $i`" ] && continue
1230 local fp=`nourl "$i"`
1231 if [ -f "$fp" ]; then
1232 tag_files="$tag_files $fp"
1233 elif [ -n "GREEDSRC" ]; then
1234 get_greed_sources $i
1236 Exit_error err_no_source_in_repo $i
1240 if [ "$tag_files" ]; then
1241 if [ "$TAG_VERSION" = "yes" ]; then
1242 update_shell_title "tag sources: $TAGVER"
1243 printf "Tagging %d files\n" $(echo $tag_files | wc -w)
1244 cvs $OPTIONS $TAGVER $tag_files || exit
1246 if [ -n "$TAG" ]; then
1247 update_shell_title "tag sources: $TAG"
1249 while [ "$tag_files" ]; do
1250 local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
1251 printf "Tagging %d files\n" $(echo $chunk | wc -w)
1252 cvs $OPTIONS $TAG $chunk || exit
1253 tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
1259 if [ "$TAG_VERSION" = "yes" ]; then
1260 update_shell_title "tag spec: $TAGVER"
1261 cvs $OPTIONS $TAGVER $SPECFILE || exit
1263 if [ -n "$TAG" ]; then
1264 update_shell_title "tag spec: $TAG"
1265 cvs $OPTIONS $TAG $SPECFILE || exit
1272 echo "CVS branch tag: $TAG"
1277 if [ -n "$DEBUG" ]; then
1282 local OPTIONS="tag $CVS_FORCE -b"
1283 if [ -n "$CVSROOT" ]; then
1284 OPTIONS="-d $CVSROOT $OPTIONS"
1288 for i in $TAG_FILES; do
1289 local fp=`nourl "$i"`
1290 if [ -f "$fp" ]; then
1291 tag_files="$tag_files $fp"
1292 elif [ -n "GREEDSRC" ]; then
1293 get_greed_sources $i
1295 Exit_error err_no_source_in_repo $i
1298 if [ "$tag_files" ]; then
1299 cvs $OPTIONS $TAG $tag_files || exit
1303 cvs $OPTIONS $TAG $SPECFILE || exit
1307 # this function should exit early if package can't be built for this arch
1308 # this avoids unneccessary BR filling.
1311 out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
1313 if [ $ret -ne 0 ]; then
1322 update_shell_title "build_package"
1323 if [ -n "$DEBUG" ]; then
1330 if [ -n "$TRY_UPGRADE" ]; then
1331 update_shell_title "build_package: try_upgrade"
1332 if [ -n "$FLOAT_VERSION" ]; then
1333 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
1335 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
1338 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
1340 if [ -n "$TNEWVER" ]; then
1341 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
1342 echo "New version found, updating spec file to version " $TNEWVER
1343 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1344 cp -f $SPECFILE $SPECFILE.bak
1347 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
1348 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
1350 NODIST="yes" get_files $SOURCES $PATCHES
1353 unset TOLDVER TNEWVER TNOTIFY
1360 BUILD_SWITCH="-ba" ;;
1362 BUILD_SWITCH="-bb" ;;
1364 BUILD_SWITCH="-bs --nodeps" ;;
1366 BUILD_SWITCH="-bp --nodeps" ;;
1368 BUILD_SWITCH="-bc" ;;
1370 BUILD_SWITCH="-bi" ;;
1372 BUILD_SWITCH="-bl" ;;
1376 update_shell_title "build_package: $COMMAND"
1377 if [ -n "$LOGFILE" ]; then
1378 LOG=`eval echo $LOGFILE`
1379 if [ -d "$LOG" ]; then
1380 echo "Log file $LOG is a directory."
1381 echo "Parse error in the spec?"
1382 Exit_error err_build_fail
1384 if [ -n "$LASTLOG_FILE" ]; then
1385 echo "LASTLOG=$LOG" > $LASTLOG_FILE
1387 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
1388 (time eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
1389 RETVAL=`cat $RES_FILE`
1391 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
1392 if [ "$RETVAL" -eq "0" ]; then
1399 eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE
1402 if [ "$RETVAL" -ne "0" ]; then
1403 if [ -n "$TRY_UPGRADE" ]; then
1404 echo "\n!!! Package with new version cannot be built automagically\n"
1405 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1406 mv -f $SPECFILE.bak $SPECFILE
1409 Exit_error err_build_fail
1416 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1419 install_required_packages()
1426 # taken from find-spec-bcond, but with just getting the list
1428 # quick revert hint: '$RPMBUILD --bcond $SPEC'
1430 /^%changelog/ { exit }
1431 /_with(out)?_[_a-zA-Z0-9]+/{
1432 match($0, /_with(out)?_[_a-zA-Z0-9]+/);
1433 print substr($0, RSTART, RLENGTH);
1436 match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
1437 bcond = substr($0, RSTART +5 , RLENGTH -5);
1438 gsub(/[ \t]+/,"_",bcond);
1440 }' $SPEC | LC_ALL=C sort -u
1444 # expand bconds from ~/.bcondrc
1445 # The file structure is like gentoo's package.use:
1448 # samba -mysql -pgsql
1449 # w32codec-installer license_agreement
1452 if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
1458 SN=${SPECFILE%%\.spec}
1460 local bcondrc=$HOME/.bcondrc
1461 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
1463 local bcond_avail=$(find_spec_bcond $SPECFILE)
1465 while read pkg flags; do
1467 [[ "$pkg" == \#* ]] && continue
1469 # any package or current package?
1470 if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
1471 for flag in $flags; do
1472 local opt=${flag#[+-]}
1474 # use only flags which are in this package.
1475 if [[ $bcond_avail = *${opt}* ]]; then
1476 if [[ $flag = -* ]]; then
1477 if [[ $BCOND != *--with?${opt}* ]]; then
1478 BCOND="$BCOND --without $opt"
1481 if [[ $BCOND != *--without?${opt}* ]]; then
1482 BCOND="$BCOND --with $opt"
1489 update_shell_title "parse ~/.bcondrc: DONE!"
1494 update_shell_title "set bcond values"
1496 AVAIL_BCONDS_WITHOUT=""
1497 AVAIL_BCONDS_WITH=""
1498 if `grep -q ^%bcond ${SPECFILE}`; then
1500 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
1506 local bcond_avail=$(find_spec_bcond $SPECFILE)
1507 process_bcondrc "$SPECFILE"
1509 update_shell_title "parse bconds"
1510 case "${BCOND_VERSION}" in
1515 echo "Warning: This spec has old style bconds. Fix it || die."
1516 for opt in `echo "$bcond_avail" | grep ^_without_`
1518 AVAIL_BCOND_WITHOUT=${opt#_without_}
1519 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1520 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1522 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1526 for opt in `echo "$bcond_avail" | grep ^_with_`
1528 AVAIL_BCOND_WITH=${opt#_with_}
1529 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1530 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1532 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1537 local cond_type="" # with || without
1538 for opt in $bcond_avail; do
1547 AVAIL_BCOND_WITHOUT=${opt#_without_}
1548 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1549 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1551 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1555 AVAIL_BCOND_WITH=${opt#_with_}
1556 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1557 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1559 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1563 case "$cond_type" in
1566 AVAIL_BCOND_WITH="$opt"
1567 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1568 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1570 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1575 AVAIL_BCOND_WITHOUT="$opt"
1576 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1577 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1579 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1593 update_shell_title "run_sub_builder $package_name"
1595 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1596 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1597 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1598 # jakby nie bylo tego kawalka kodu.
1600 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1601 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1608 # Istnieje taki spec? ${package}.spec
1609 if [ -f "${SPEC_DIR}/${package}.spec" ]; then
1610 parent_spec_name=${package}.spec
1611 elif [ -f "${SPEC_DIR}/`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1612 parent_spec_name="`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1614 for provides_line in `grep ^Provides:.*$package ${SPEC_DIR} -R`
1620 if [ "${parent_spec_name}" != "" ]; then
1621 spawn_sub_builder $parent_spec_name
1623 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1629 update_shell_title "spawn_sub_builder $package_name"
1632 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1633 sub_builder_opts="${sub_builder_opts} -R"
1635 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1636 sub_builder_opts="${sub_builder_opts} -RB"
1637 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1638 sub_builder_opts="${sub_builder_opts} -FRB"
1640 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1641 sub_builder_opts="${sub_builder_opts} -Upi"
1645 ./builder ${sub_builder_opts} "$@"
1648 remove_build_requires()
1650 if [ "$INSTALLED_PACKAGES" != "" ]; then
1651 case "$REMOVE_BUILD_REQUIRES" in
1653 run_poldek --noask -ve $INSTALLED_PACKAGES
1656 run_poldek --ask -ve $INSTALLED_PACKAGES
1659 echo You may want to manually remove following BuildRequires fetched:
1660 echo $INSTALLED_PACKAGES
1661 echo "Try poldek -e \`cat $(pwd)/.${SPECFILE}_INSTALLED_PACKAGES\`"
1669 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1670 if [ "$BCOND" != "" ]; then
1671 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1674 echo -ne "\nNo conditional flags passed"
1676 echo -ne "\n\nfrom available:\n"
1677 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1683 if [ "$NOCVSSPEC" != "yes" ]; then
1684 echo -ne "Available branches: "
1685 cvs status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
1689 # checks a given list of packages/files/provides agains current rpmdb.
1690 # outputs all dependencies whcih current rpmdb doesn't satisfy.
1691 # input can be either STDIN or parameters
1696 if [ "$#" -gt 0 ]; then
1702 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
1705 echo "$DEPS" | awk '/^no package provides/ { print $NF }'
1707 # other deps (files)
1708 echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
1711 # checks if given package/files/provides exists in rpmdb.
1712 # inout can be either stdin or parameters
1713 # returns packages wchi hare present in the rpmdb
1718 if [ "$#" -gt 0 ]; then
1724 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
1727 fetch_build_requires()
1729 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1730 update_shell_title "fetch build requires"
1731 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ] || [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1732 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1733 # TODO: Conflicts list doesn't check versions
1734 local CNFL=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
1735 local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
1737 if [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1738 local CNFL=$(rpm -q --specsrpm --conflicts $BCOND $SPECFILE | awk '{print $1}' | _rpm_cnfl_check | xargs)
1739 local DEPS=$(rpm -q --specsrpm --requires $BCOND $SPECFILE | awk '{print $1}' | _rpm_prov_check | xargs)
1742 if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
1743 echo "fetch BuildRequires: install [$DEPS]; remove [$CNFL]"
1744 update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
1745 $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
1747 if [ -n "$CNFL" ]; then
1748 update_shell_title "uninstall conflicting packages: $CNFL"
1749 echo "Trying to uninstall conflicting packages ($CNFL):"
1750 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CNFL
1753 while [ "$DEPS" ]; do
1754 update_shell_title "install deps: $DEPS"
1755 echo "Trying to install dependencies ($DEPS):"
1756 local log=.${SPECFILE}_poldek.log
1757 $SU_SUDO /usr/bin/poldek --caplookup -uGqQ $DEPS | tee $log
1758 failed=$(awk '/^error:/{a=$2; sub(/^error: /, "", a); sub(/:$/, "", a); print a}' $log)
1761 if [ -n "$failed" ]; then
1762 for package in $failed; do
1763 spawn_sub_builder -bb $(depspecname $package) && ok="$ok $package"
1773 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1774 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1775 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1776 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1777 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1778 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`
1780 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`"
1782 package=`basename "$package_item"|sed -e "s/}$//g"`
1783 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1786 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1787 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1788 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
1793 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1796 if `echo $COND_TST|grep -q 'without_'`; then
1797 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1798 if `echo $COND_TST|grep -q !`; then
1803 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1804 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1805 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1811 elif `echo $COND_TST|grep -q 'with_'`; then
1812 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1813 if `echo $COND_TST|grep -q !`; then
1818 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1819 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1820 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1826 RESULT="${COND_STATE}-${COND_ARGV}"
1828 "with-wout" | "wout-with" )
1831 "wout-wout" | "with-with" )
1835 echo "Action '$RESULT' was not defined for package '$package_item'"
1841 if [ "$GO" = "yes" ]; then
1842 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1843 echo "Testing if $package has subrequirements..."
1844 run_poldek -t -i $package --dumpn=".$package-req.txt"
1845 if [ -f ".$package-req.txt" ]; then
1846 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1848 if [ "$package_name" = "$package" ]; then
1849 echo -ne "Installing BuildRequired package:\t$package_name\n"
1850 update_shell_title "Installing BuildRequired package: ${package_name}"
1851 install_required_packages $package
1853 echo -ne "Installing (sub)Required package:\t$package_name\n"
1854 update_shell_title "Installing (sub)Required package: ${package_name}"
1855 install_required_packages $package_name
1859 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1860 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1863 echo "Attempting to run spawn sub - builder..."
1864 echo -ne "Package installation failed:\t$package_name\n"
1865 run_sub_builder $package_name
1866 if [ $? -eq 0 ]; then
1867 install_required_packages $package_name
1870 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1871 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1874 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1881 rm -f ".$package-req.txt"
1883 echo "Attempting to run spawn sub - builder..."
1884 echo -ne "Package installation failed:\t$package\n"
1885 run_sub_builder $package
1886 if [ $? -eq 0 ]; then
1887 install_required_packages $package
1890 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1891 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1894 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1900 echo "Package $package is already installed. BuildRequirement satisfied."
1904 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1905 echo "Unable to install following packages and their dependencies:"
1906 for pkg in "$NOT_INSTALLED_PACKAGES"
1910 remove_build_requires
1918 TOP_DIR="`eval $RPM $RPMOPTS --eval '%{_topdir}'`"
1919 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1921 mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
1923 cvs -d $CVSROOT co SOURCES/{.cvsignore,dropin} SPECS/{mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
1927 echo "To checkout *all* .spec files:"
1928 echo "- remove $SPEC_DIR/CVS/Entries.Static"
1929 echo "- run cvs up in $SPEC_DIR dir"
1932 echo "To commit with your developer account:"
1933 echo "- edit $SPEC_DIR/CVS/Root"
1934 echo "- edit $SOURCE_DIR/CVS/Root"
1937 get_greed_sources() {
1938 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1939 if [ -n "BE_VERBOSE" ]; then
1940 echo "Try greed download: $1 from: $CVSROOT"
1942 cvs -d $CVSROOT get SOURCES/$1
1943 if [ $? != 0 ]; then
1944 Exit_error err_no_source_in_repo $1
1949 # remove entries from CVS/Entries
1950 cvs_entry_remove() {
1951 local cvsdir="$1"; shift
1952 if [ ! -d "$cvsdir" ]; then
1953 echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
1957 for file in "$@"; do
1958 rm -f $cvsdir/CVS/Entries.new || return 1
1959 awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
1960 mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
1968 DONT_PRINT_REVISION="yes"
1972 # remove from CVS/Entries
1973 cvs_entry_remove $SPEC_DIR $SPECFILE
1974 cvs_entry_remove $SOURCE_DIR $SOURCES $PATCHES
1976 # remove spec and sources
1977 $RPMBUILD --clean --rmsource --rmspec --nodeps $SPECFILE
1980 #---------------------------------------------
1988 while [ $# -gt 0 ]; do
1991 COMMAND="update_md5"
1996 COMMAND="update_md5"
2006 DEBUG="yes"; shift ;;
2008 COMMAND="version"; shift ;;
2010 COMMAND="short-version"; shift ;;
2012 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
2013 -b | -ba | --build )
2014 COMMAND="build"; shift ;;
2015 -bb | --build-binary )
2016 COMMAND="build-binary"; shift ;;
2018 COMMAND="build-build"; shift ;;
2020 COMMAND="build-install"; shift ;;
2022 COMMAND="build-list"; shift ;;
2023 -bp | --build-prep )
2024 COMMAND="build-prep"; shift ;;
2025 -bs | --build-source )
2026 COMMAND="build-source"; shift ;;
2028 COMMAND="branch"; shift; TAG="${1}"; shift;;
2030 CLEAN="--clean --rmspec --rmsource"; shift ;;
2032 CVS_FORCE="-F"; shift;;
2034 shift; CVSROOT="${1}"; shift ;;
2036 COMMAND="get"; shift ;;
2038 COMMAND="usage"; shift ;;
2040 PROTOCOL="http"; shift ;;
2042 shift; LOGFILE="${1}"; shift ;;
2044 shift; DEF_NICE_LEVEL=${1}; shift ;;
2045 -ske | --skip-existing-files)
2046 SKIP_EXISTING_FILES="yes"; shift ;;
2048 COMMAND="mr-proper"; shift ;;
2050 NOCVS="yes"; shift ;;
2051 -ncs | --no-cvs-specs )
2052 NOCVSSPEC="yes"; shift ;;
2053 -nd | --no-distfiles )
2054 NODIST="yes"; shift ;;
2055 -nm | --no-mirrors )
2056 NOMIRRORS="yes"; shift ;;
2058 NOURLS="yes"; shift ;;
2060 NOSRCS="yes"; shift ;;
2061 -ns0 | --no-source0 )
2062 NOSOURCE0="yes"; shift ;;
2072 -pm | --prefer-mirrors )
2079 shift; RPMOPTS="${RPMOPTS} ${1}"; shift ;;
2081 shift; RPMOPTS="${RPMOPTS} --define \"patch${1} : ignoring patch${1}; exit 1; \""; shift ;;
2082 --with | --without )
2083 case $GROUP_BCONDS in
2087 while ! `echo ${1}|grep -qE '(^-|spec)'`
2089 BCOND="$BCOND $COND $1"
2093 if [[ "$2" = *,* ]]; then
2094 for a in $(echo "$2" | tr , ' '); do
2095 BCOND="$BCOND $1 $a"
2098 BCOND="$BCOND $1 $2"
2104 shift; TARGET="${1}"; shift ;;
2106 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
2108 QUIET="--quiet"; shift ;;
2110 CVSDATE="${2}"; shift 2 ;;
2112 shift; CVSTAG="${1}"; shift ;;
2114 shift; CVSTAG="HEAD"; ;;
2115 -R | --fetch-build-requires)
2116 FETCH_BUILD_REQUIRES="yes"
2117 NOT_INSTALLED_PACKAGES=
2119 -RB | --remove-build-requires)
2120 REMOVE_BUILD_REQUIRES="nice"
2122 -FRB | --force-remove-build-requires)
2123 REMOVE_BUILD_REQUIRES="force"
2125 -sc | --sources-cvs)
2126 COMMAND="list-sources-cvs"
2128 -sd | --sources-distfiles)
2129 COMMAND="list-sources-distfiles"
2131 -sdp | --sources-distfiles-paths)
2132 COMMAND="list-sources-distfiles-paths"
2134 -sf | --sources-files)
2135 COMMAND="list-sources-files"
2137 -sp | --sources-paths)
2138 COMMAND="list-sources-local-paths"
2140 -su | --sources-urls)
2141 COMMAND="list-sources-urls"
2143 -Tvs | --tag-version-stable )
2148 -Ts | --tag-stable )
2153 -Tv | --tag-version )
2158 -Tp | --tag-prefix )
2170 -ir | --integer-release-only )
2171 INTEGER_RELEASE="yes"
2174 COMMAND="update_md5"
2179 -Upi | --update-poldek-indexes )
2180 UPDATE_POLDEK_INDEXES="yes"
2183 COMMAND="init_rpm_dir"
2185 --use-greed-sources )
2188 -u | --try-upgrade )
2189 TRY_UPGRADE="1"; shift ;;
2190 -un | --try-upgrade-with-float-version )
2191 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
2193 BE_VERBOSE="1"; shift ;;
2198 if echo "${MACRO}" | grep -q '\W'; then
2199 RPMOPTS="${RPMOPTS} --define \"${MACRO}\""
2203 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
2208 RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
2212 RPMBUILDOPTS="${RPMBUILDOPTS} --short-circuit"
2215 --show-bconds | -show-bconds | -print-bconds | --print-bconds | -display-bconds | --display-bconds )
2216 COMMAND="show_bconds"
2220 COMMAND="show_bcond_args"
2225 RPMOPTS="${RPMOPTS} --nodeps"
2228 RPMBUILDOPTS="${RPMBUILDOPTS} -debug"; shift
2231 Exit_error err_invalid_cmdline "$1"
2235 # check if specname was passed as specname:cvstag
2236 if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
2237 CVSTAG="${SPECFILE##*:}"
2238 SPECFILE="${SPECFILE%%:*}"
2240 ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
2245 if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then
2246 CVSTAG=$(awk -vSPECFILE=$(basename ${SPECFILE%.spec}.spec) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries)
2247 if [ "$CVSTAG" ]; then
2248 echo >&2 "builder: Stick tag $CVSTAG active. Use -r TAGNAME to override."
2250 elif [ "$CVSTAG" = "HEAD" ]; then
2251 # assume -r HEAD is same as -A
2255 if [ -n "$DEBUG" ]; then
2260 if [ -n "$TARGET" ]; then
2263 TARGET_SWITCH="--target $TARGET" ;;
2265 TARGET_SWITCH="--target=$TARGET" ;;
2269 if [ "$SCHEDTOOL" != "no" ]; then
2270 NICE_COMMAND="$SCHEDTOOL"
2272 NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
2275 update_shell_title "$COMMAND"
2279 if [ -n "$SPECFILE" ]; then
2280 get_spec > /dev/null
2288 if [ -n "$SPECFILE" ]; then
2289 get_spec > /dev/null
2295 "build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
2297 if [ -n "$SPECFILE" ]; then
2303 if [ "$COMMAND" != "build-source" ]; then
2306 fetch_build_requires
2307 if [ "$INTEGER_RELEASE" = "yes" ]; then
2308 echo "Checking release $PACKAGE_RELEASE..."
2309 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
2310 Exit_error err_fract_rel "$PACKAGE_RELEASE"
2314 # ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
2315 if [ -n "$TEST_TAG" ]; then
2316 local TAGVER=`make_tagver`
2317 echo "Searching for tag $TAGVER..."
2318 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
2319 if [ -n "$TAGREL" ]; then
2320 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
2323 # - do not allow to build from HEAD when XX-branch exists
2324 TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
2325 if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
2326 TAG_BRANCH="${TREE_PREFIX}-branch"
2327 TAG_STATUS=$(cvs status -v $SPECFILE | grep -Ei "${TAG_BRANCH}.+(branch: [0-9.]+)")
2328 if [ -n "$TAG_STATUS" -a "$CVSTAG" = "HEAD" ]; then
2329 Exit_error err_branch_exists "$TAG_STATUS"
2335 if [ -n "$NOSOURCE0" ] ; then
2336 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2338 get_files $SOURCES $PATCHES
2341 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
2342 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
2344 remove_build_requires
2346 Exit_error err_no_spec_in_cmdl
2351 if [ -n "$SPECFILE" ]; then
2354 # don't fetch sources from remote locations
2356 for file in $SOURCES; do
2357 [ -n "`src_md5 $file`" ] && continue
2358 new_SOURCES="$new_SOURCES $file"
2360 SOURCES="$new_SOURCES"
2361 get_files $SOURCES $PATCHES
2363 branch_files $TAG $SOURCES $PATCHES $ICONS
2365 Exit_error err_no_spec_in_cmdl
2370 if [ -n "$SPECFILE" ]; then
2374 if [ -n "$NOSOURCE0" ] ; then
2375 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2377 get_files $SOURCES $PATCHES
2380 Exit_error err_no_spec_in_cmdl
2385 if [ -n "$SPECFILE" ]; then
2389 if [ -n "$NOSOURCE0" ] ; then
2390 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2394 Exit_error err_no_spec_in_cmdl
2401 if [ -n "$SPECFILE" ]; then
2405 # don't fetch sources from remote locations
2407 for file in $SOURCES; do
2408 [ -n "`src_md5 $file`" ] && continue
2409 new_SOURCES="$new_SOURCES $file"
2411 SOURCES="$new_SOURCES"
2412 get_files $SOURCES $PATCHES
2414 tag_files $SOURCES $PATCHES $ICONS
2416 Exit_error err_no_spec_in_cmdl
2422 "list-sources-files" )
2425 DONT_PRINT_REVISION="yes"
2428 for SAP in $SOURCES $PATCHES; do
2429 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2432 "list-sources-urls" )
2435 DONT_PRINT_REVISION="yes"
2438 SAPS="$SOURCES $PATCHES"
2439 for SAP in $SAPS ; do
2443 "list-sources-local-paths" )
2446 DONT_PRINT_REVISION="yes"
2449 for SAP in $SOURCES $PATCHES; do
2450 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
2453 "list-sources-distfiles-paths" )
2456 DONT_PRINT_REVISION="yes"
2459 for SAP in $SOURCES $PATCHES; do
2460 if [ -n "$(src_md5 "$SAP")" ]; then
2461 distfiles_path "$SAP"
2465 "list-sources-distfiles" )
2468 DONT_PRINT_REVISION="yes"
2471 for SAP in $SOURCES $PATCHES; do
2472 if [ -n "$(src_md5 "$SAP")" ]; then
2473 distfiles_url "$SAP"
2477 "list-sources-cvs" )
2480 DONT_PRINT_REVISION="yes"
2483 for SAP in $SOURCES $PATCHES; do
2484 if [ -z "$(src_md5 "$SAP")" ]; then
2485 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2499 echo "$VERSIONSTRING"
2502 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
2503 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
2507 # vi:syntax=sh:ts=4:sw=4:noet