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
196 # are we using cvs-nserver ?
198 cvs --version 2>&1 | grep -qv 'CVS-nserver'
201 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
202 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
206 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
207 if [ -n "$LOGFILE" ]; then
208 LOG=`eval echo $LOGFILE`
209 if [ -n "$LASTLOG_FILE" ]; then
210 echo "LASTLOG=$LOG" > $LASTLOG_FILE
212 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
215 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
216 return `cat ${RES_FILE}`
221 #---------------------------------------------
226 if [ -n "$DEBUG" ]; then set -xv; fi
228 Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
229 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
230 [{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
231 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
232 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
233 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
234 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
235 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
236 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
237 <package>[.spec][:cvstag]
239 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
240 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
241 -n5, --no-md5 - ignore md5 comments in spec
242 -D, --debug - enable builder script debugging mode,
243 -debug - produce rpm debug package (same as --opts -debug)
244 -V, --version - output builder version string
245 --short-version - output builder short version
246 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
247 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
249 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
250 only package from <package>.spec,
251 -bp, --build-prep - execute the %prep phase of <package>.spec,
252 -bc - execute the %build phase of <package>.spec,
253 -bi - execute the %install phase of <package>.spec
254 -bl - execute the %files phase of <package>.spec
255 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
257 --short-circuit - short-circuit build
258 -B, --branch - add branch
259 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
260 SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
261 -m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
262 SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
264 -cf, --cvs-force - use -F when tagging (useful when moving branches)
265 -d <cvsroot>, --cvsroot <cvsroot>
267 --define <macro> <value>
268 - define a macro <macro> with value <value>,
269 --alt_kernel <kernel>
270 - same as --define 'alt_kernel <kernel>'
271 --nodeps - rpm won't check any dependences
272 -g, --get - get <package>.spec and all related files from CVS repo
274 -h, --help - this message,
275 --http - use http instead of ftp,
276 -l <logfile>, --logtofile <logfile>
278 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
280 - don't check specs in CVS
281 -nd, --no-distfiles - don't download from distfiles
282 -nm, --no-mirrors - don't download from mirror, if source URL is given,
283 -nu, --no-urls - don't try to download from FTP/HTTP location,
284 -ns, --no-srcs - don't download Sources
285 -ns0, --no-source0 - don't download Source0
286 -nn, --no-net - don't download anything from the net
287 -pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
288 --no-init - don't initialize builder paths (SPECS and SOURCES)
290 --skip-existing-files - skip existing files in get_files
291 --opts <rpm opts> - additional options for rpm
292 -q, --quiet - be quiet,
293 --date yyyy-mm-dd - build package using resources from specified CVS date,
294 -r <cvstag>, --cvstag <cvstag>
295 - build package using resources from specified CVS tag,
296 -A - build package using CVS resources as any sticky tags/date/kopts being reset.
297 -R, --fetch-build-requires
298 - fetch what is BuildRequired,
299 -RB, --remove-build-requires
300 - remove all you fetched with -R or --fetch-build-requires
301 remember, this option requires confirmation,
302 -FRB, --force-remove-build-requires
303 - remove all you fetched with -R or --fetch-build-requires
304 remember, this option works without confirmation,
305 -sd, --source-distfiles - list sources available from distfiles (intended for offline
306 operations; does not work when Icon field is present
307 but icon file is absent),
308 -sc, --source-cvs - list sources available from CVS
309 -sdp, --source-distfiles-paths - list sources available from distfiles -
310 paths relative to distfiles directory (intended for offline
311 operations; does not work when Icon field is present
312 but icon file is absent),
313 -sf, --source-files - list sources - bare filenames (intended for offline
314 operations; does not work when Icon field is present
315 but icon file is absent),
316 -sp, --source-paths - list sources - filenames with full local paths (intended for
317 offline operations; does not work when Icon field is present
318 but icon file is absent),
319 -su, --source-urls - list urls - urls to sources and patches
320 intended for copying urls with spec with lots of macros in urls
321 -T <cvstag> , --tag <cvstag>
322 - add cvs tag <cvstag> for files,
323 -Tvs, --tag-version-stable
324 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
326 - add cvs tag STABLE for files,
328 - add cvs tag NAME-VERSION-RELEASE for files,
329 -Tp, --tag-prefix <prefix>
330 - add <prefix> to NAME-VERSION-RELEASE tags,
331 -tt, --test-tag <prefix>
332 - fail if tag is already present,
333 -ir, --integer-release-only
334 - allow only integer and snapshot releases
335 -v, --verbose - be verbose,
336 -u, --try-upgrade - check version, and try to upgrade package
337 -un, --try-upgrade-with-float-version
338 - as above, but allow float version
340 - try download source from tag head if don't find it in
342 -U, --update - refetch sources, don't use distfiles, and update md5 comments
343 -Upi, --update-poldek-indexes
344 - refresh or make poldek package index files.
345 -np, --nopatch <patchnumber>
346 - don't apply <patchnumber>
347 --show-bconds - show available conditional builds, which can be used
348 - with --with and/or --without switches.
349 --show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
350 ./repackage.sh script. in other words, the output is
351 parseable by scripts.
352 --with/--without <feature>
353 - conditional build package depending on %_with_<feature>/
354 %_without_<feature> macro switch. You may now use
355 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
356 constructions. Set GROUP_BCONDS to yes to make use of it.
357 --target <platform>, --target=<platform>
358 - build for platform <platform>.
359 --init-rpm-dir - initialize ~/rpm directory structure
363 # change dependency to specname
365 # - perl(Package::Name) -> perl-Package-Name
369 package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g}')
373 update_shell_title() {
375 local len=${COLUMNS:-80}
376 local msg=$(echo "$*" | cut -c-$len)
378 if [ -n "$BE_VERBOSE" ]; then
379 echo >&2 "$(date +%s.%N) $*"
382 if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
384 if [ -n "$PACKAGE_NAME" ]; then
385 pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
390 msg="$pkg: ${SHELL_TITLE_PREFIX:+$SHELL_TITLE_PREFIX }$msg"
391 msg="$(echo $msg | tr -d '\n\r')"
394 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
397 echo >&2 -ne "\033]0;$msg\007"
403 # set TARGET from BuildArch: from SPECFILE
405 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
406 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
408 target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
412 TARGET_SWITCH="--target ${TARGET}-${target_platform}" ;;
414 TARGET_SWITCH="--target=$TARGET" ;;
420 # runs rpm with minimal macroset
422 # we reset macros not to contain macros.build as all the %() macros are
423 # executed here, while none of them are actually needed.
424 # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
425 safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
427 # TODO: move these to /usr/lib/rpm/macros
428 cat > $BUILDER_MACROS <<'EOF'
429 %x8664 x86_64 amd64 ia32e
432 %requires_releq_kernel_up %{nil}
433 %requires_releq_kernel_smp %{nil}
434 %requires_releq_kernel %{nil}
435 %requires_releq() %{nil}
436 %pyrequires_eq() %{nil}
437 %requires_eq() %{nil}
438 %requires_eq_to() %{nil}
439 %releq_kernel_up ERROR
440 %releq_kernel_smp ERROR
445 %ruby_ver_requires_eq() %{nil}
446 %ruby_mod_ver_requires_eq() %{nil}
447 %__php_api_requires() %{nil}
448 %php_major_version ERROR
449 %php_api_version ERROR
450 %requires_xorg_xserver_extension %{nil}
451 %requires_xorg_xserver_xinput %{nil}
452 %requires_xorg_xserver_font %{nil}
453 %requires_xorg_xserver_videodrv %{nil}
455 %perl_vendorarch ERROR
456 %perl_vendorlib ERROR
457 # damn. need it here! - copied from /usr/lib/rpm/macros.build
458 %tmpdir %(echo "${TMPDIR:-/tmp}")
459 %patchset_source(f:b:) %(
460 base=%{-b*}%{!-b*:10000};
461 start=$(expr $base + %1);
462 end=$(expr $base + %{?2}%{!?2:%{1}});
463 # we need to call seq twice as it doesn't allow two formats
464 seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
465 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
466 paste %{tmpdir}/__ps{1,2};
467 rm -f %{tmpdir}/__ps{1,2};
471 if [ "$NOINIT" = "yes" ] ; then
472 cat >> $BUILDER_MACROS <<'EOF'
477 eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
481 if [ -n "$DEBUG" ]; then
486 update_shell_title "cache_rpm_dump"
487 if [ -x /usr/bin/rpm-specdump ]; then
488 rpm_dump_cache=`rpm-specdump $BCOND $TARGET_SWITCH $SPECFILE`
492 # what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
493 dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
499 ARGS='--nodigest --nosignature --nobuild'
502 minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
504 if [ $? -gt 0 ]; then
505 error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
507 Exit_error err_build_fail
510 # make small dump cache
511 rpm_dump_cache=`echo "$rpm_dump" | awk '
512 $2 ~ /^SOURCEURL/ {print}
513 $2 ~ /^PATCHURL/ {print}
514 $2 ~ /^nosource/ {print}
515 $2 ~ /^PACKAGE_/ {print}
519 update_shell_title "cache_rpm_dump: OK!"
523 if [ -z "$rpm_dump_cache" ] ; then
524 echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
526 echo "$rpm_dump_cache"
531 update_shell_title "get icons"
532 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
533 if [ -z "$ICONS" ]; then
537 rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
542 update_shell_title "parsing specfile"
543 if [ -n "$DEBUG" ]; then
548 # icons are needed for successful spec parse
554 if [ "$NOSRCS" != "yes" ]; then
555 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
558 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
559 FAIL_IF_NO_SOURCES="no"
562 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
563 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
564 PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}')
565 PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
566 PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
568 if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
569 echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
572 if [ -n "$BE_VERBOSE" ]; then
573 echo "- Sources : `nourl $SOURCES`"
574 if [ -n "$PATCHES" ]; then
575 echo "- Patches : `nourl $PATCHES`"
577 echo "- Patches : *no patches needed*"
579 if [ -n "$ICONS" ]; then
580 echo "- Icon : `nourl $ICONS`"
582 echo "- Icon : *no package icon*"
584 echo "- Name : $PACKAGE_NAME"
585 echo "- Version : $PACKAGE_VERSION"
586 echo "- Release : $PACKAGE_RELEASE"
589 update_shell_title "parse_spec: OK!"
594 if [ -n "$DEBUG" ]; then
602 "err_no_spec_in_cmdl" )
603 remove_build_requires
604 echo "ERROR: spec file name not specified."
606 "err_invalid_cmdline" )
607 echo "ERROR: invalid command line arg ($2)."
609 "err_no_spec_in_repo" )
610 remove_build_requires
611 echo "Error: spec file not stored in CVS repo."
613 "err_no_source_in_repo" )
614 remove_build_requires
615 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"
618 remove_build_requires
619 echo "Error: package build failed. (${2:-no more info})"
621 "err_no_package_data" )
622 remove_build_requires
623 echo "Error: couldn't get out package name/version/release from spec file."
626 remove_build_requires
627 echo "Tag ${2} already exists (spec release: ${3})."
630 remove_build_requires
631 echo "Release ${2} not integer and not a snapshot."
633 "err_branch_exists" )
634 remove_build_requires
635 echo "Tree branch already exists (${2})."
638 remove_build_requires
639 echo "Error: conditions reject building this spec (${2})."
642 echo "Unknown error."
648 if [ -n "$DEBUG" ]; then
653 if [ "$NOINIT" != "yes" ] ; then
655 if [ "$ASSUMED_NAME" ]; then
656 extra="--define 'name $ASSUMED_NAME'"
658 SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
659 SPEC_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
671 update_shell_title "get_spec"
673 if [ -n "$DEBUG" ]; then
679 if [ ! -f "$SPECFILE" ]; then
680 SPECFILE="`basename $SPECFILE .spec`.spec"
682 if [ "$NOCVSSPEC" != "yes" ]; then
684 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
685 echo "Warning: No CVS access defined - using local .spec file"
689 cvsup "$SPECFILE" || Exit_error err_no_spec_in_repo
692 if [ ! -f "$SPECFILE" ]; then
693 Exit_error err_no_spec_in_repo
696 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
697 chmod $CHMOD_MODE $SPECFILE
700 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
709 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
710 cvs update mirrors >&2
714 local origin mirror name rest ol prefix
715 while read origin mirror name rest; do
716 # skip comments and empty lines
717 if [ -z "$origin" ] || [[ $origin == \#* ]]; then
720 ol=`echo -n "$origin"|wc -c`
721 prefix="`echo -n "$url" | head -c $ol`"
722 if [ "$prefix" = "$origin" ] ; then
723 suffix="`echo "$url"|cut -b $((ol+1))-`"
724 echo -n "$mirror$suffix"
731 # Warning: unpredictable results if same URL used twice
736 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
737 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
743 [ "$NO5" = "yes" ] && return
745 [ -z "$no" ] && return
749 if [ -f additional-md5sums ]; then
750 local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
751 if [ -z "$spec_rev" ]; then
752 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
754 local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
755 md5=$(grep -s -v '^#' additional-md5sums | \
756 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
757 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
758 grep -E '^[0-9a-f]{32}$')
761 if [ $(echo "$md5" | wc -l) != 1 ] ; then
762 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
764 echo "$md5" | tail -n 1
769 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
770 if [ -n "$source_md5" ]; then
773 source_md5=`grep -i "BuildRequires:[ ]*digest(%SOURCE$no)[ ]*=" $SPECFILE | sed -e 's/.*=//'`
774 if [ -n "$source_md5" ]; then
777 # we have empty SourceX-md5, but it is still possible
778 # that we have NoSourceX-md5 AND NoSource: X
779 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
780 if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
789 echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
794 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
797 distfiles_attic_url ()
799 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
806 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
811 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
812 [ -n "$size" -a "$size" -gt 0 ]
817 if [ "$CVSIGNORE_DF" != "yes" ]; then
820 cvsignore=${SOURCE_DIR}/.cvsignore
821 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
822 echo "$1" >> $cvsignore
828 update_shell_title "cvsup"
830 if [ -n "$CVSROOT" ]; then
831 OPTIONS="-d $CVSROOT $OPTIONS"
834 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
835 OPTIONS="$OPTIONS -A"
837 if [ -n "$CVSDATE" ]; then
838 OPTIONS="$OPTIONS -D $CVSDATE"
840 if [ -n "$CVSTAG" ]; then
841 OPTIONS="$OPTIONS -r $CVSTAG"
846 local retries_counter=0
848 update_shell_title "cvsup: $*"
850 update_shell_title "cvsup: $# files"
852 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
853 retries_counter=$(( $retries_counter + 1 ))
854 output=$(LC_ALL=C cvs $OPTIONS "$@" 2>&1)
856 [ -n "$output" ] && echo "$output"
857 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
858 echo "Trying again [$*]... ($retries_counter)"
859 update_shell_title "cvsup: retry #$retries_counter"
866 update_shell_title "cvsup: done!"
870 # returns true if "$1" is ftp, http or https protocol url
874 ftp://*|http://*|https://*)
883 if [ $# -eq 0 ]; then
887 update_shell_title "update md5"
888 if [ -n "$DEBUG" ]; then
895 # pass 1: check files to be fetched
899 local fp=$(nourl "$i")
900 local srcno=$(src_no "$i")
901 if [ -n "$ADD5" ]; then
902 [ "$fp" = "$i" ] && continue # FIXME what is this check doing?
903 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE && continue
904 grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE && continue
906 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE || continue
908 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
909 need_files="$need_files $i"
913 # pass 1a: get needed files
914 if [ "$need_files" ]; then
915 get_files $need_files
918 # pass 2: proceed with md5 adding or updating
920 local fp=$(nourl "$i")
921 local srcno=$(src_no "$i")
922 local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE )
923 if [ -z "$md5" ]; then
924 md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE )
926 if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
927 local tag="# Source$srcno-md5:\t"
928 if [[ "$md5" == *NoSource* ]]; then
929 tag="# NoSource$srcno-md5:\t"
930 elif [ -n "$USEDIGEST" ]; then
931 tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
933 md5=$(md5sum "$fp" | cut -f1 -d' ')
934 echo "Updating Source$srcno ($md5: $fp)."
936 print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
937 print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
946 update_shell_title "check md5"
949 if good_md5 "$i" && good_size "$i"; then
953 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
954 echo "or -5 to update md5 sums, if you're sure files are correct."
955 Exit_error err_no_source_in_repo $i
961 update_shell_title "get_files"
963 if [ -n "$DEBUG" ]; then
968 if [ $# -gt 0 ]; then
971 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
972 echo "Warning: No CVS access defined for SOURCES"
977 local get_files_cvs=""
981 SHELL_TITLE_PREFIX="get_files[$nc/$#]"
982 update_shell_title "$i"
983 local fp=`nourl "$i"`
984 if [ "$SKIP_EXISTING_FILES" = "yes" ] && [ -f "$fp" ]; then
989 local srcmd5=$(src_md5 "$i")
991 # we know if source/patch is present in cvs/distfiles
992 # - has md5 (in distfiles)
995 # CHECK: local file didn't exist or always cvs up (first) requested.
996 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
997 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
998 echo "Warning: no URL given for $i"
1001 if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
1002 if good_md5 "$i" && good_size "$i"; then
1003 echo "$fp having proper md5sum already exists"
1008 # optionally prefer mirror over distfiles if there's mirror
1009 # TODO: build url list and then try each url from the list
1010 if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
1013 url=$(distfiles_url "$i")
1016 url_attic=$(distfiles_attic_url "$i")
1018 # is $url local file?
1019 if [[ "$url" = [./]* ]]; then
1020 update_shell_title "${GETLOCAL%% *}: $url"
1021 ${GETLOCAL} $url $target
1023 if [ -z "$NOMIRRORS" ]; then
1024 url=$(find_mirror "$url")
1028 # make shorter message for distfiles urls
1029 if [[ "$uri" = ${PROTOCOL}${DISTFILES_SERVER}* ]] || [[ "$uri" = ${PROTOCOL}${ATTICDISTFILES_SERVER}* ]]; then
1030 uri=${uri#${PROTOCOL}${DISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1031 uri=${uri#${PROTOCOL}${ATTICDISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1034 update_shell_title "${GETURI%% *}: $uri"
1035 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1036 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1037 update_shell_title "${GETURI2%% *}: $url"
1038 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1043 if [ ! -s "$target" ]; then
1045 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
1046 update_shell_title "${GETLOCAL%% *}: $url_attic"
1047 ${GETLOCAL} $url_attic $target
1049 if [ -z "$NOMIRRORS" ]; then
1050 url_attic="`find_mirror "$url_attic"`"
1052 update_shell_title "${GETURI%% *}: $url_attic"
1053 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1054 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1055 update_shell_title "${GETURI2%% *}: $url_attic"
1056 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1061 if [ -s "$target" ]; then
1062 cvsignore_df $target
1067 elif [ "$NOCVS" != "yes" -a -z "$srcmd5" ]; then
1068 if [ $# -gt 1 ]; then
1069 get_files_cvs="$get_files_cvs $fp"
1070 update_shell_title "$fp (will cvs up later)"
1077 if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
1078 if [ -z "$NOMIRRORS" ]; then
1079 im="`find_mirror "$i"`"
1083 update_shell_title "${GETURI%% *}: $im"
1084 ${GETURI} "$im" || \
1085 if [ "`echo $im | grep -E 'ftp://'`" ]; then
1086 update_shell_title "${GETURI2%% *}: $im"
1091 if [ "$cvsup" = 1 ]; then
1097 # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
1098 if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
1099 if [ -n "GREEDSRC" ]; then
1100 get_greed_sources $i
1102 Exit_error err_no_source_in_repo $i
1106 # we check md5 here just only to refetch immediately
1107 if good_md5 "$i" && good_size "$i"; then
1109 elif [ "$FROM_DISTFILES" = 1 ]; then
1110 # wrong md5 from distfiles: remove the file and try again
1112 echo "MD5 sum mismatch. Trying full fetch."
1115 update_shell_title "${GETURI%% *}: $url"
1116 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1117 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1118 update_shell_title "${GETURI2%% *}: $url"
1119 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1121 if [ ! -s "$target" ]; then
1123 update_shell_title "${GETURI%% *}: $url_attic"
1124 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1125 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1126 update_shell_title "${GETURI2%% *}: $url_attic"
1127 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1130 test -s "$target" || rm -f "$target"
1133 SHELL_TITLE_PREFIX=""
1135 if [ "$get_files_cvs" ]; then
1136 cvsup $get_files_cvs
1139 if [ "$CHMOD" = "yes" ]; then
1140 CHMOD_FILES="`nourl "$@"`"
1141 if [ -n "$CHMOD_FILES" ]; then
1142 chmod $CHMOD_MODE $CHMOD_FILES
1149 if [ -n "$DEBUG" ]; then
1154 # Check whether first character of PACKAGE_NAME is legal for tag name
1155 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
1159 # NOTE: CVS tags may must not contain the characters `$,.:;@'
1160 TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
1162 # Remove #kernel.version_release from TAGVER because tagging sources
1163 # could occur with different kernel-headers than kernel-headers used at build time.
1164 # besides, %{_kernel_ver_str} is not expanded.
1166 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
1167 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
1173 # bool is_tag_a_branch(tag)
1175 # returns 1 if a tag is a branch set on SPECFILE
1177 if [ -n "$DEBUG" ]; then
1182 if [ $# -ne 1 ]; then
1189 cvs status -v $SPECFILE | grep -Eiq "${TAG}.+(branch: [0-9.]+)"
1197 if [ -n "$DEBUG" ]; then
1202 echo "Version: $PACKAGE_VERSION"
1203 echo "Release: $PACKAGE_RELEASE"
1206 if [ "$TAG_VERSION" = "yes" ]; then
1207 TAGVER=`make_tagver`
1208 echo "CVS tag: $TAGVER"
1210 if [ -n "$TAG" ]; then
1211 echo "CVS tag: $TAG"
1214 local OPTIONS="tag $CVS_FORCE"
1215 if [ -n "$CVSROOT" ]; then
1216 OPTIONS="-d $CVSROOT $OPTIONS"
1219 # if a tagname we are about to set already exists
1220 # and happens to be a branch (common case with AC-branch)
1221 # pass -B (allows -F to disturb branch tag)
1223 if [ "$TAG_VERSION" = "yes" ]; then
1226 is_tag_a_branch $_tag
1227 if [ $? -eq 0 -a $CVS_NSERVER -eq 0 ]; then
1228 OPTIONS="$OPTIONS -B"
1233 for i in $TAG_FILES; do
1234 # don't tag files stored on distfiles
1235 [ -n "`src_md5 $i`" ] && continue
1236 local fp=`nourl "$i"`
1237 if [ -f "$fp" ]; then
1238 tag_files="$tag_files $fp"
1239 elif [ -n "GREEDSRC" ]; then
1240 get_greed_sources $i
1242 Exit_error err_no_source_in_repo $i
1246 if [ "$tag_files" ]; then
1247 if [ "$TAG_VERSION" = "yes" ]; then
1248 update_shell_title "tag sources: $TAGVER"
1249 printf "Tagging %d files\n" $(echo $tag_files | wc -w)
1250 cvs $OPTIONS $TAGVER $tag_files || exit
1252 if [ -n "$TAG" ]; then
1253 update_shell_title "tag sources: $TAG"
1255 while [ "$tag_files" ]; do
1256 local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
1257 printf "Tagging %d files\n" $(echo $chunk | wc -w)
1258 cvs $OPTIONS $TAG $chunk || exit
1259 tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
1265 if [ "$TAG_VERSION" = "yes" ]; then
1266 update_shell_title "tag spec: $TAGVER"
1267 cvs $OPTIONS $TAGVER $SPECFILE || exit
1269 if [ -n "$TAG" ]; then
1270 update_shell_title "tag spec: $TAG"
1271 cvs $OPTIONS $TAG $SPECFILE || exit
1278 echo "CVS branch tag: $TAG"
1283 if [ -n "$DEBUG" ]; then
1288 local OPTIONS="tag $CVS_FORCE -b"
1289 if [ -n "$CVSROOT" ]; then
1290 OPTIONS="-d $CVSROOT $OPTIONS"
1294 for i in $TAG_FILES; do
1295 local fp=`nourl "$i"`
1296 if [ -f "$fp" ]; then
1297 tag_files="$tag_files $fp"
1298 elif [ -n "GREEDSRC" ]; then
1299 get_greed_sources $i
1301 Exit_error err_no_source_in_repo $i
1304 if [ "$tag_files" ]; then
1305 cvs $OPTIONS $TAG $tag_files || exit
1309 cvs $OPTIONS $TAG $SPECFILE || exit
1313 # this function should exit early if package can't be built for this arch
1314 # this avoids unneccessary BR filling.
1317 out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
1319 if [ $ret -ne 0 ]; then
1328 update_shell_title "build_package"
1329 if [ -n "$DEBUG" ]; then
1336 if [ -n "$TRY_UPGRADE" ]; then
1337 update_shell_title "build_package: try_upgrade"
1338 if [ -n "$FLOAT_VERSION" ]; then
1339 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
1341 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
1344 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
1346 if [ -n "$TNEWVER" ]; then
1347 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
1348 echo "New version found, updating spec file to version " $TNEWVER
1349 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1350 cp -f $SPECFILE $SPECFILE.bak
1353 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
1354 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
1356 NODIST="yes" get_files $SOURCES $PATCHES
1359 unset TOLDVER TNEWVER TNOTIFY
1366 BUILD_SWITCH="-ba" ;;
1368 BUILD_SWITCH="-bb" ;;
1370 BUILD_SWITCH="-bs --nodeps" ;;
1372 BUILD_SWITCH="-bp --nodeps" ;;
1374 BUILD_SWITCH="-bc" ;;
1376 BUILD_SWITCH="-bi" ;;
1378 BUILD_SWITCH="-bl" ;;
1382 update_shell_title "build_package: $COMMAND"
1383 if [ -n "$LOGFILE" ]; then
1384 LOG=`eval echo $LOGFILE`
1385 if [ -d "$LOG" ]; then
1386 echo "Log file $LOG is a directory."
1387 echo "Parse error in the spec?"
1388 Exit_error err_build_fail
1390 if [ -n "$LASTLOG_FILE" ]; then
1391 echo "LASTLOG=$LOG" > $LASTLOG_FILE
1393 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
1394 (time eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
1395 RETVAL=`cat $RES_FILE`
1397 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
1398 if [ "$RETVAL" -eq "0" ]; then
1405 eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE
1408 if [ "$RETVAL" -ne "0" ]; then
1409 if [ -n "$TRY_UPGRADE" ]; then
1410 echo "\n!!! Package with new version cannot be built automagically\n"
1411 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1412 mv -f $SPECFILE.bak $SPECFILE
1415 Exit_error err_build_fail
1422 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1425 install_required_packages()
1432 # taken from find-spec-bcond, but with just getting the list
1434 # quick revert hint: '$RPMBUILD --bcond $SPEC'
1436 /^%changelog/ { exit }
1437 /_with(out)?_[_a-zA-Z0-9]+/{
1438 match($0, /_with(out)?_[_a-zA-Z0-9]+/);
1439 print substr($0, RSTART, RLENGTH);
1442 match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
1443 bcond = substr($0, RSTART +5 , RLENGTH -5);
1444 gsub(/[ \t]+/,"_",bcond);
1446 }' $SPEC | LC_ALL=C sort -u
1450 # expand bconds from ~/.bcondrc
1451 # The file structure is like gentoo's package.use:
1454 # samba -mysql -pgsql
1455 # w32codec-installer license_agreement
1458 if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
1464 SN=${SPECFILE%%\.spec}
1466 local bcondrc=$HOME/.bcondrc
1467 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
1469 local bcond_avail=$(find_spec_bcond $SPECFILE)
1471 while read pkg flags; do
1473 [[ "$pkg" == \#* ]] && continue
1475 # any package or current package?
1476 if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
1477 for flag in $flags; do
1478 local opt=${flag#[+-]}
1480 # use only flags which are in this package.
1481 if [[ $bcond_avail = *${opt}* ]]; then
1482 if [[ $flag = -* ]]; then
1483 if [[ $BCOND != *--with?${opt}* ]]; then
1484 BCOND="$BCOND --without $opt"
1487 if [[ $BCOND != *--without?${opt}* ]]; then
1488 BCOND="$BCOND --with $opt"
1495 update_shell_title "parse ~/.bcondrc: DONE!"
1500 update_shell_title "set bcond values"
1502 AVAIL_BCONDS_WITHOUT=""
1503 AVAIL_BCONDS_WITH=""
1504 if `grep -q ^%bcond ${SPECFILE}`; then
1506 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
1512 local bcond_avail=$(find_spec_bcond $SPECFILE)
1513 process_bcondrc "$SPECFILE"
1515 update_shell_title "parse bconds"
1516 case "${BCOND_VERSION}" in
1521 echo "Warning: This spec has old style bconds. Fix it || die."
1522 for opt in `echo "$bcond_avail" | grep ^_without_`
1524 AVAIL_BCOND_WITHOUT=${opt#_without_}
1525 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1526 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1528 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1532 for opt in `echo "$bcond_avail" | grep ^_with_`
1534 AVAIL_BCOND_WITH=${opt#_with_}
1535 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1536 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1538 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1543 local cond_type="" # with || without
1544 for opt in $bcond_avail; do
1553 AVAIL_BCOND_WITHOUT=${opt#_without_}
1554 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1555 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1557 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1561 AVAIL_BCOND_WITH=${opt#_with_}
1562 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1563 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1565 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1569 case "$cond_type" in
1572 AVAIL_BCOND_WITH="$opt"
1573 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1574 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1576 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1581 AVAIL_BCOND_WITHOUT="$opt"
1582 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1583 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1585 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1599 update_shell_title "run_sub_builder $package_name"
1601 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1602 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1603 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1604 # jakby nie bylo tego kawalka kodu.
1606 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1607 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1614 # Istnieje taki spec? ${package}.spec
1615 if [ -f "${SPEC_DIR}/${package}.spec" ]; then
1616 parent_spec_name=${package}.spec
1617 elif [ -f "${SPEC_DIR}/`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1618 parent_spec_name="`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1620 for provides_line in `grep ^Provides:.*$package ${SPEC_DIR} -R`
1626 if [ "${parent_spec_name}" != "" ]; then
1627 spawn_sub_builder $parent_spec_name
1629 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1635 update_shell_title "spawn_sub_builder $package_name"
1638 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1639 sub_builder_opts="${sub_builder_opts} -R"
1641 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1642 sub_builder_opts="${sub_builder_opts} -RB"
1643 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1644 sub_builder_opts="${sub_builder_opts} -FRB"
1646 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1647 sub_builder_opts="${sub_builder_opts} -Upi"
1651 ./builder ${sub_builder_opts} "$@"
1654 remove_build_requires()
1656 if [ "$INSTALLED_PACKAGES" != "" ]; then
1657 case "$REMOVE_BUILD_REQUIRES" in
1659 run_poldek --noask -ve $INSTALLED_PACKAGES
1662 run_poldek --ask -ve $INSTALLED_PACKAGES
1665 echo You may want to manually remove following BuildRequires fetched:
1666 echo $INSTALLED_PACKAGES
1667 echo "Try poldek -e \`cat $(pwd)/.${SPECFILE}_INSTALLED_PACKAGES\`"
1675 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1676 if [ "$BCOND" != "" ]; then
1677 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1680 echo -ne "\nNo conditional flags passed"
1682 echo -ne "\n\nfrom available:\n"
1683 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1689 if [ "$NOCVSSPEC" != "yes" ]; then
1690 echo -ne "Available branches: "
1691 cvs status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
1695 # checks a given list of packages/files/provides agains current rpmdb.
1696 # outputs all dependencies whcih current rpmdb doesn't satisfy.
1697 # input can be either STDIN or parameters
1702 if [ "$#" -gt 0 ]; then
1708 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
1711 echo "$DEPS" | awk '/^no package provides/ { print $NF }'
1713 # other deps (files)
1714 echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
1717 # checks if given package/files/provides exists in rpmdb.
1718 # inout can be either stdin or parameters
1719 # returns packages wchi hare present in the rpmdb
1724 if [ "$#" -gt 0 ]; then
1730 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
1733 fetch_build_requires()
1735 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1736 update_shell_title "fetch build requires"
1737 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ] || [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1738 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1739 # TODO: Conflicts list doesn't check versions
1740 local CNFL=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
1741 local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
1743 if [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1744 local CNFL=$(rpm -q --specsrpm --conflicts $BCOND $SPECFILE | awk '{print $1}' | _rpm_cnfl_check | xargs)
1745 local DEPS=$(rpm -q --specsrpm --requires $BCOND $SPECFILE | awk '{print $1}' | _rpm_prov_check | xargs)
1748 if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
1749 echo "fetch BuildRequires: install [$DEPS]; remove [$CNFL]"
1750 update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
1751 $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
1753 if [ -n "$CNFL" ]; then
1754 update_shell_title "uninstall conflicting packages: $CNFL"
1755 echo "Trying to uninstall conflicting packages ($CNFL):"
1756 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CNFL
1759 while [ "$DEPS" ]; do
1760 update_shell_title "install deps: $DEPS"
1761 echo "Trying to install dependencies ($DEPS):"
1762 local log=.${SPECFILE}_poldek.log
1763 $SU_SUDO /usr/bin/poldek --caplookup -uGqQ $DEPS | tee $log
1764 failed=$(awk '/^error:/{a=$2; sub(/^error: /, "", a); sub(/:$/, "", a); print a}' $log)
1767 if [ -n "$failed" ]; then
1768 for package in $failed; do
1769 spawn_sub_builder -bb $(depspecname $package) && ok="$ok $package"
1779 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1780 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1781 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1782 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1783 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1784 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`
1786 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`"
1788 package=`basename "$package_item"|sed -e "s/}$//g"`
1789 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1792 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1793 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1794 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
1799 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1802 if `echo $COND_TST|grep -q 'without_'`; then
1803 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1804 if `echo $COND_TST|grep -q !`; then
1809 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1810 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1811 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1817 elif `echo $COND_TST|grep -q 'with_'`; then
1818 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1819 if `echo $COND_TST|grep -q !`; then
1824 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1825 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1826 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1832 RESULT="${COND_STATE}-${COND_ARGV}"
1834 "with-wout" | "wout-with" )
1837 "wout-wout" | "with-with" )
1841 echo "Action '$RESULT' was not defined for package '$package_item'"
1847 if [ "$GO" = "yes" ]; then
1848 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1849 echo "Testing if $package has subrequirements..."
1850 run_poldek -t -i $package --dumpn=".$package-req.txt"
1851 if [ -f ".$package-req.txt" ]; then
1852 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1854 if [ "$package_name" = "$package" ]; then
1855 echo -ne "Installing BuildRequired package:\t$package_name\n"
1856 update_shell_title "Installing BuildRequired package: ${package_name}"
1857 install_required_packages $package
1859 echo -ne "Installing (sub)Required package:\t$package_name\n"
1860 update_shell_title "Installing (sub)Required package: ${package_name}"
1861 install_required_packages $package_name
1865 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1866 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1869 echo "Attempting to run spawn sub - builder..."
1870 echo -ne "Package installation failed:\t$package_name\n"
1871 run_sub_builder $package_name
1872 if [ $? -eq 0 ]; then
1873 install_required_packages $package_name
1876 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1877 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1880 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1887 rm -f ".$package-req.txt"
1889 echo "Attempting to run spawn sub - builder..."
1890 echo -ne "Package installation failed:\t$package\n"
1891 run_sub_builder $package
1892 if [ $? -eq 0 ]; then
1893 install_required_packages $package
1896 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1897 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1900 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1906 echo "Package $package is already installed. BuildRequirement satisfied."
1910 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1911 echo "Unable to install following packages and their dependencies:"
1912 for pkg in "$NOT_INSTALLED_PACKAGES"
1916 remove_build_requires
1924 TOP_DIR="`eval $RPM $RPMOPTS --eval '%{_topdir}'`"
1925 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1927 mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
1929 cvs -d $CVSROOT co SOURCES/{.cvsignore,dropin} SPECS/{mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
1933 echo "To checkout *all* .spec files:"
1934 echo "- remove $SPEC_DIR/CVS/Entries.Static"
1935 echo "- run cvs up in $SPEC_DIR dir"
1938 echo "To commit with your developer account:"
1939 echo "- edit $SPEC_DIR/CVS/Root"
1940 echo "- edit $SOURCE_DIR/CVS/Root"
1943 get_greed_sources() {
1944 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1945 if [ -n "BE_VERBOSE" ]; then
1946 echo "Try greed download: $1 from: $CVSROOT"
1948 cvs -d $CVSROOT get SOURCES/$1
1949 if [ $? != 0 ]; then
1950 Exit_error err_no_source_in_repo $1
1955 # remove entries from CVS/Entries
1956 cvs_entry_remove() {
1957 local cvsdir="$1"; shift
1958 if [ ! -d "$cvsdir" ]; then
1959 echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
1963 for file in "$@"; do
1964 rm -f $cvsdir/CVS/Entries.new || return 1
1965 awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
1966 mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
1974 DONT_PRINT_REVISION="yes"
1978 # remove from CVS/Entries
1979 cvs_entry_remove $SPEC_DIR $SPECFILE
1980 cvs_entry_remove $SOURCE_DIR $SOURCES $PATCHES
1982 # remove spec and sources
1983 $RPMBUILD --clean --rmsource --rmspec --nodeps $SPECFILE
1986 #---------------------------------------------
1994 while [ $# -gt 0 ]; do
1997 COMMAND="update_md5"
2002 COMMAND="update_md5"
2012 DEBUG="yes"; shift ;;
2014 COMMAND="version"; shift ;;
2016 COMMAND="short-version"; shift ;;
2018 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
2019 -b | -ba | --build )
2020 COMMAND="build"; shift ;;
2021 -bb | --build-binary )
2022 COMMAND="build-binary"; shift ;;
2024 COMMAND="build-build"; shift ;;
2026 COMMAND="build-install"; shift ;;
2028 COMMAND="build-list"; shift ;;
2029 -bp | --build-prep )
2030 COMMAND="build-prep"; shift ;;
2031 -bs | --build-source )
2032 COMMAND="build-source"; shift ;;
2034 COMMAND="branch"; shift; TAG="${1}"; shift;;
2036 CLEAN="--clean --rmspec --rmsource"; shift ;;
2038 CVS_FORCE="-F"; shift;;
2040 shift; CVSROOT="${1}"; shift ;;
2042 COMMAND="get"; shift ;;
2044 COMMAND="usage"; shift ;;
2046 PROTOCOL="http"; shift ;;
2048 shift; LOGFILE="${1}"; shift ;;
2050 shift; DEF_NICE_LEVEL=${1}; shift ;;
2051 -ske | --skip-existing-files)
2052 SKIP_EXISTING_FILES="yes"; shift ;;
2054 COMMAND="mr-proper"; shift ;;
2056 NOCVS="yes"; shift ;;
2057 -ncs | --no-cvs-specs )
2058 NOCVSSPEC="yes"; shift ;;
2059 -nd | --no-distfiles )
2060 NODIST="yes"; shift ;;
2061 -nm | --no-mirrors )
2062 NOMIRRORS="yes"; shift ;;
2064 NOURLS="yes"; shift ;;
2066 NOSRCS="yes"; shift ;;
2067 -ns0 | --no-source0 )
2068 NOSOURCE0="yes"; shift ;;
2078 -pm | --prefer-mirrors )
2085 shift; RPMOPTS="${RPMOPTS} ${1}"; shift ;;
2087 shift; RPMOPTS="${RPMOPTS} --define \"patch${1} : ignoring patch${1}; exit 1; \""; shift ;;
2088 --with | --without )
2089 case $GROUP_BCONDS in
2093 while ! `echo ${1}|grep -qE '(^-|spec)'`
2095 BCOND="$BCOND $COND $1"
2099 if [[ "$2" = *,* ]]; then
2100 for a in $(echo "$2" | tr , ' '); do
2101 BCOND="$BCOND $1 $a"
2104 BCOND="$BCOND $1 $2"
2110 shift; TARGET="${1}"; shift ;;
2112 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
2114 QUIET="--quiet"; shift ;;
2116 CVSDATE="${2}"; shift 2 ;;
2118 shift; CVSTAG="${1}"; shift ;;
2120 shift; CVSTAG="HEAD"; ;;
2121 -R | --fetch-build-requires)
2122 FETCH_BUILD_REQUIRES="yes"
2123 NOT_INSTALLED_PACKAGES=
2125 -RB | --remove-build-requires)
2126 REMOVE_BUILD_REQUIRES="nice"
2128 -FRB | --force-remove-build-requires)
2129 REMOVE_BUILD_REQUIRES="force"
2131 -sc | --sources-cvs)
2132 COMMAND="list-sources-cvs"
2134 -sd | --sources-distfiles)
2135 COMMAND="list-sources-distfiles"
2137 -sdp | --sources-distfiles-paths)
2138 COMMAND="list-sources-distfiles-paths"
2140 -sf | --sources-files)
2141 COMMAND="list-sources-files"
2143 -sp | --sources-paths)
2144 COMMAND="list-sources-local-paths"
2146 -su | --sources-urls)
2147 COMMAND="list-sources-urls"
2149 -Tvs | --tag-version-stable )
2154 -Ts | --tag-stable )
2159 -Tv | --tag-version )
2164 -Tp | --tag-prefix )
2176 -ir | --integer-release-only )
2177 INTEGER_RELEASE="yes"
2180 COMMAND="update_md5"
2185 -Upi | --update-poldek-indexes )
2186 UPDATE_POLDEK_INDEXES="yes"
2189 COMMAND="init_rpm_dir"
2191 --use-greed-sources )
2194 -u | --try-upgrade )
2195 TRY_UPGRADE="1"; shift ;;
2196 -un | --try-upgrade-with-float-version )
2197 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
2199 BE_VERBOSE="1"; shift ;;
2204 if echo "${MACRO}" | grep -q '\W'; then
2205 RPMOPTS="${RPMOPTS} --define \"${MACRO}\""
2209 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
2214 RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
2218 RPMBUILDOPTS="${RPMBUILDOPTS} --short-circuit"
2221 --show-bconds | -show-bconds | -print-bconds | --print-bconds | -display-bconds | --display-bconds )
2222 COMMAND="show_bconds"
2226 COMMAND="show_bcond_args"
2231 RPMOPTS="${RPMOPTS} --nodeps"
2234 RPMBUILDOPTS="${RPMBUILDOPTS} -debug"; shift
2237 Exit_error err_invalid_cmdline "$1"
2241 # check if specname was passed as specname:cvstag
2242 if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
2243 CVSTAG="${SPECFILE##*:}"
2244 SPECFILE="${SPECFILE%%:*}"
2246 ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
2251 if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then
2252 CVSTAG=$(awk -vSPECFILE=$(basename ${SPECFILE%.spec}.spec) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries)
2253 if [ "$CVSTAG" ]; then
2254 echo >&2 "builder: Stick tag $CVSTAG active. Use -r TAGNAME to override."
2256 elif [ "$CVSTAG" = "HEAD" ]; then
2257 # assume -r HEAD is same as -A
2261 if [ -n "$DEBUG" ]; then
2266 if [ -n "$TARGET" ]; then
2269 TARGET_SWITCH="--target $TARGET" ;;
2271 TARGET_SWITCH="--target=$TARGET" ;;
2275 if [ "$SCHEDTOOL" != "no" ]; then
2276 NICE_COMMAND="$SCHEDTOOL"
2278 NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
2281 update_shell_title "$COMMAND"
2285 if [ -n "$SPECFILE" ]; then
2286 get_spec > /dev/null
2294 if [ -n "$SPECFILE" ]; then
2295 get_spec > /dev/null
2301 "build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
2303 if [ -n "$SPECFILE" ]; then
2309 if [ "$COMMAND" != "build-source" ]; then
2312 fetch_build_requires
2313 if [ "$INTEGER_RELEASE" = "yes" ]; then
2314 echo "Checking release $PACKAGE_RELEASE..."
2315 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
2316 Exit_error err_fract_rel "$PACKAGE_RELEASE"
2320 # ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
2321 if [ -n "$TEST_TAG" ]; then
2322 local TAGVER=`make_tagver`
2323 echo "Searching for tag $TAGVER..."
2324 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
2325 if [ -n "$TAGREL" ]; then
2326 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
2329 # - do not allow to build from HEAD when XX-branch exists
2330 TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
2331 if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
2332 TAG_BRANCH="${TREE_PREFIX}-branch"
2333 TAG_STATUS=$(cvs status -v $SPECFILE | grep -Ei "${TAG_BRANCH}.+(branch: [0-9.]+)")
2334 if [ -n "$TAG_STATUS" -a "$CVSTAG" = "HEAD" ]; then
2335 Exit_error err_branch_exists "$TAG_STATUS"
2341 if [ -n "$NOSOURCE0" ] ; then
2342 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2344 get_files $SOURCES $PATCHES
2347 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
2348 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
2350 remove_build_requires
2352 Exit_error err_no_spec_in_cmdl
2357 if [ -n "$SPECFILE" ]; then
2360 # don't fetch sources from remote locations
2362 for file in $SOURCES; do
2363 [ -n "`src_md5 $file`" ] && continue
2364 new_SOURCES="$new_SOURCES $file"
2366 SOURCES="$new_SOURCES"
2367 get_files $SOURCES $PATCHES
2369 branch_files $TAG $SOURCES $PATCHES $ICONS
2371 Exit_error err_no_spec_in_cmdl
2376 if [ -n "$SPECFILE" ]; then
2380 if [ -n "$NOSOURCE0" ] ; then
2381 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2383 get_files $SOURCES $PATCHES
2386 Exit_error err_no_spec_in_cmdl
2391 if [ -n "$SPECFILE" ]; then
2395 if [ -n "$NOSOURCE0" ] ; then
2396 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2400 Exit_error err_no_spec_in_cmdl
2407 if [ -n "$SPECFILE" ]; then
2411 # don't fetch sources from remote locations
2413 for file in $SOURCES; do
2414 [ -n "`src_md5 $file`" ] && continue
2415 new_SOURCES="$new_SOURCES $file"
2417 SOURCES="$new_SOURCES"
2418 get_files $SOURCES $PATCHES
2420 tag_files $SOURCES $PATCHES $ICONS
2422 Exit_error err_no_spec_in_cmdl
2428 "list-sources-files" )
2431 DONT_PRINT_REVISION="yes"
2434 for SAP in $SOURCES $PATCHES; do
2435 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2438 "list-sources-urls" )
2441 DONT_PRINT_REVISION="yes"
2444 SAPS="$SOURCES $PATCHES"
2445 for SAP in $SAPS ; do
2449 "list-sources-local-paths" )
2452 DONT_PRINT_REVISION="yes"
2455 for SAP in $SOURCES $PATCHES; do
2456 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
2459 "list-sources-distfiles-paths" )
2462 DONT_PRINT_REVISION="yes"
2465 for SAP in $SOURCES $PATCHES; do
2466 if [ -n "$(src_md5 "$SAP")" ]; then
2467 distfiles_path "$SAP"
2471 "list-sources-distfiles" )
2474 DONT_PRINT_REVISION="yes"
2477 for SAP in $SOURCES $PATCHES; do
2478 if [ -n "$(src_md5 "$SAP")" ]; then
2479 distfiles_url "$SAP"
2483 "list-sources-cvs" )
2486 DONT_PRINT_REVISION="yes"
2489 for SAP in $SOURCES $PATCHES; do
2490 if [ -z "$(src_md5 "$SAP")" ]; then
2491 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2505 echo "$VERSIONSTRING"
2508 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
2509 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
2513 # vi:syntax=sh:ts=4:sw=4:noet