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 ?
199 cvs --version 2>&1 | grep -q 'CVS-nserver'
200 [ $? -eq 0 ] && CVS_NSERVER=1
202 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
203 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
207 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
208 if [ -n "$LOGFILE" ]; then
209 LOG=`eval echo $LOGFILE`
210 if [ -n "$LASTLOG_FILE" ]; then
211 echo "LASTLOG=$LOG" > $LASTLOG_FILE
213 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
216 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
217 return `cat ${RES_FILE}`
222 #---------------------------------------------
227 if [ -n "$DEBUG" ]; then set -xv; fi
229 Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
230 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
231 [{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
232 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
233 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
234 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
235 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
236 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
237 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
238 <package>[.spec][:cvstag]
240 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
241 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
242 -n5, --no-md5 - ignore md5 comments in spec
243 -D, --debug - enable builder script debugging mode,
244 -debug - produce rpm debug package (same as --opts -debug)
245 -V, --version - output builder version string
246 --short-version - output builder short version
247 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
248 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
250 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
251 only package from <package>.spec,
252 -bp, --build-prep - execute the %prep phase of <package>.spec,
253 -bc - execute the %build phase of <package>.spec,
254 -bi - execute the %install phase of <package>.spec
255 -bl - execute the %files phase of <package>.spec
256 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
258 --short-circuit - short-circuit build
259 -B, --branch - add branch
260 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
261 SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
262 -m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
263 SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
265 -cf, --cvs-force - use -F when tagging (useful when moving branches)
266 -d <cvsroot>, --cvsroot <cvsroot>
268 --define <macro> <value>
269 - define a macro <macro> with value <value>,
270 --alt_kernel <kernel>
271 - same as --define 'alt_kernel <kernel>'
272 --nodeps - rpm won't check any dependences
273 -g, --get - get <package>.spec and all related files from CVS repo
275 -h, --help - this message,
276 --http - use http instead of ftp,
277 -l <logfile>, --logtofile <logfile>
279 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
281 - don't check specs in CVS
282 -nd, --no-distfiles - don't download from distfiles
283 -nm, --no-mirrors - don't download from mirror, if source URL is given,
284 -nu, --no-urls - don't try to download from FTP/HTTP location,
285 -ns, --no-srcs - don't download Sources
286 -ns0, --no-source0 - don't download Source0
287 -nn, --no-net - don't download anything from the net
288 -pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
289 --no-init - don't initialize builder paths (SPECS and SOURCES)
291 --skip-existing-files - skip existing files in get_files
292 --opts <rpm opts> - additional options for rpm
293 -q, --quiet - be quiet,
294 --date yyyy-mm-dd - build package using resources from specified CVS date,
295 -r <cvstag>, --cvstag <cvstag>
296 - build package using resources from specified CVS tag,
297 -A - build package using CVS resources as any sticky tags/date/kopts being reset.
298 -R, --fetch-build-requires
299 - fetch what is BuildRequired,
300 -RB, --remove-build-requires
301 - remove all you fetched with -R or --fetch-build-requires
302 remember, this option requires confirmation,
303 -FRB, --force-remove-build-requires
304 - remove all you fetched with -R or --fetch-build-requires
305 remember, this option works without confirmation,
306 -sd, --source-distfiles - list sources available from distfiles (intended for offline
307 operations; does not work when Icon field is present
308 but icon file is absent),
309 -sc, --source-cvs - list sources available from CVS
310 -sdp, --source-distfiles-paths - list sources available from distfiles -
311 paths relative to distfiles directory (intended for offline
312 operations; does not work when Icon field is present
313 but icon file is absent),
314 -sf, --source-files - list sources - bare filenames (intended for offline
315 operations; does not work when Icon field is present
316 but icon file is absent),
317 -sp, --source-paths - list sources - filenames with full local paths (intended for
318 offline operations; does not work when Icon field is present
319 but icon file is absent),
320 -su, --source-urls - list urls - urls to sources and patches
321 intended for copying urls with spec with lots of macros in urls
322 -T <cvstag> , --tag <cvstag>
323 - add cvs tag <cvstag> for files,
324 -Tvs, --tag-version-stable
325 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
327 - add cvs tag STABLE for files,
329 - add cvs tag NAME-VERSION-RELEASE for files,
330 -Tp, --tag-prefix <prefix>
331 - add <prefix> to NAME-VERSION-RELEASE tags,
332 -tt, --test-tag <prefix>
333 - fail if tag is already present,
334 -ir, --integer-release-only
335 - allow only integer and snapshot releases
336 -v, --verbose - be verbose,
337 -u, --try-upgrade - check version, and try to upgrade package
338 -un, --try-upgrade-with-float-version
339 - as above, but allow float version
341 - try download source from tag head if don't find it in
343 -U, --update - refetch sources, don't use distfiles, and update md5 comments
344 -Upi, --update-poldek-indexes
345 - refresh or make poldek package index files.
346 -np, --nopatch <patchnumber>
347 - don't apply <patchnumber>
348 --show-bconds - show available conditional builds, which can be used
349 - with --with and/or --without switches.
350 --show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
351 ./repackage.sh script. in other words, the output is
352 parseable by scripts.
353 --with/--without <feature>
354 - conditional build package depending on %_with_<feature>/
355 %_without_<feature> macro switch. You may now use
356 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
357 constructions. Set GROUP_BCONDS to yes to make use of it.
358 --target <platform>, --target=<platform>
359 - build for platform <platform>.
360 --init-rpm-dir - initialize ~/rpm directory structure
364 # change dependency to specname
366 # - perl(Package::Name) -> perl-Package-Name
370 package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g}')
374 update_shell_title() {
376 local len=${COLUMNS:-80}
377 local msg=$(echo "$*" | cut -c-$len)
379 if [ -n "$BE_VERBOSE" ]; then
380 echo >&2 "$(date +%s.%N) $*"
383 if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
385 if [ -n "$PACKAGE_NAME" ]; then
386 pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
391 msg="$pkg: ${SHELL_TITLE_PREFIX:+$SHELL_TITLE_PREFIX }$msg"
392 msg="$(echo $msg | tr -d '\n\r')"
395 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
398 echo >&2 -ne "\033]0;$msg\007"
404 # set TARGET from BuildArch: from SPECFILE
406 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
407 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
409 target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
413 TARGET_SWITCH="--target ${TARGET}-${target_platform}" ;;
415 TARGET_SWITCH="--target=$TARGET" ;;
421 # runs rpm with minimal macroset
423 # we reset macros not to contain macros.build as all the %() macros are
424 # executed here, while none of them are actually needed.
425 # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
426 safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
428 # TODO: move these to /usr/lib/rpm/macros
429 cat > $BUILDER_MACROS <<'EOF'
430 %x8664 x86_64 amd64 ia32e
433 %requires_releq_kernel_up %{nil}
434 %requires_releq_kernel_smp %{nil}
435 %requires_releq_kernel %{nil}
436 %requires_releq() %{nil}
437 %pyrequires_eq() %{nil}
438 %requires_eq() %{nil}
439 %requires_eq_to() %{nil}
440 %releq_kernel_up ERROR
441 %releq_kernel_smp ERROR
446 %ruby_ver_requires_eq() %{nil}
447 %ruby_mod_ver_requires_eq() %{nil}
448 %__php_api_requires() %{nil}
449 %php_major_version ERROR
450 %php_api_version ERROR
451 %requires_xorg_xserver_extension %{nil}
452 %requires_xorg_xserver_xinput %{nil}
453 %requires_xorg_xserver_font %{nil}
454 %requires_xorg_xserver_videodrv %{nil}
456 %perl_vendorarch ERROR
457 %perl_vendorlib ERROR
458 # damn. need it here! - copied from /usr/lib/rpm/macros.build
459 %tmpdir %(echo "${TMPDIR:-/tmp}")
460 %patchset_source(f:b:) %(
461 base=%{-b*}%{!-b*:10000};
462 start=$(expr $base + %1);
463 end=$(expr $base + %{?2}%{!?2:%{1}});
464 # we need to call seq twice as it doesn't allow two formats
465 seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
466 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
467 paste %{tmpdir}/__ps{1,2};
468 rm -f %{tmpdir}/__ps{1,2};
472 if [ "$NOINIT" = "yes" ] ; then
473 cat >> $BUILDER_MACROS <<'EOF'
478 eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
482 if [ -n "$DEBUG" ]; then
487 update_shell_title "cache_rpm_dump"
488 if [ -x /usr/bin/rpm-specdump ]; then
489 rpm_dump_cache=`rpm-specdump $BCOND $TARGET_SWITCH $SPECFILE`
493 # what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
494 dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
500 ARGS='--nodigest --nosignature --nobuild'
503 minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
505 if [ $? -gt 0 ]; then
506 error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
508 Exit_error err_build_fail
511 # make small dump cache
512 rpm_dump_cache=`echo "$rpm_dump" | awk '
513 $2 ~ /^SOURCEURL/ {print}
514 $2 ~ /^PATCHURL/ {print}
515 $2 ~ /^nosource/ {print}
516 $2 ~ /^PACKAGE_/ {print}
520 update_shell_title "cache_rpm_dump: OK!"
524 if [ -z "$rpm_dump_cache" ] ; then
525 echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
527 echo "$rpm_dump_cache"
532 update_shell_title "get icons"
533 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
534 if [ -z "$ICONS" ]; then
538 rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
543 update_shell_title "parsing specfile"
544 if [ -n "$DEBUG" ]; then
549 # icons are needed for successful spec parse
555 if [ "$NOSRCS" != "yes" ]; then
556 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
559 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
560 FAIL_IF_NO_SOURCES="no"
563 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
564 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
565 PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}')
566 PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
567 PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
569 if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
570 echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
573 if [ -n "$BE_VERBOSE" ]; then
574 echo "- Sources : `nourl $SOURCES`"
575 if [ -n "$PATCHES" ]; then
576 echo "- Patches : `nourl $PATCHES`"
578 echo "- Patches : *no patches needed*"
580 if [ -n "$ICONS" ]; then
581 echo "- Icon : `nourl $ICONS`"
583 echo "- Icon : *no package icon*"
585 echo "- Name : $PACKAGE_NAME"
586 echo "- Version : $PACKAGE_VERSION"
587 echo "- Release : $PACKAGE_RELEASE"
590 update_shell_title "parse_spec: OK!"
595 if [ -n "$DEBUG" ]; then
603 "err_no_spec_in_cmdl" )
604 remove_build_requires
605 echo "ERROR: spec file name not specified."
607 "err_invalid_cmdline" )
608 echo "ERROR: invalid command line arg ($2)."
610 "err_no_spec_in_repo" )
611 remove_build_requires
612 echo "Error: spec file not stored in CVS repo."
614 "err_no_source_in_repo" )
615 remove_build_requires
616 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"
619 remove_build_requires
620 echo "Error: package build failed. (${2:-no more info})"
622 "err_no_package_data" )
623 remove_build_requires
624 echo "Error: couldn't get out package name/version/release from spec file."
627 remove_build_requires
628 echo "Tag ${2} already exists (spec release: ${3})."
631 remove_build_requires
632 echo "Release ${2} not integer and not a snapshot."
634 "err_branch_exists" )
635 remove_build_requires
636 echo "Tree branch already exists (${2})."
639 remove_build_requires
640 echo "Error: conditions reject building this spec (${2})."
643 echo "Unknown error."
649 if [ -n "$DEBUG" ]; then
654 if [ "$NOINIT" != "yes" ] ; then
656 if [ "$ASSUMED_NAME" ]; then
657 extra="--define 'name $ASSUMED_NAME'"
659 SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
660 SPEC_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
672 update_shell_title "get_spec"
674 if [ -n "$DEBUG" ]; then
680 if [ ! -f "$SPECFILE" ]; then
681 SPECFILE="`basename $SPECFILE .spec`.spec"
683 if [ "$NOCVSSPEC" != "yes" ]; then
685 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
686 echo "Warning: No CVS access defined - using local .spec file"
690 cvsup "$SPECFILE" || Exit_error err_no_spec_in_repo
693 if [ ! -f "$SPECFILE" ]; then
694 Exit_error err_no_spec_in_repo
697 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
698 chmod $CHMOD_MODE $SPECFILE
701 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
710 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
711 cvs update mirrors >&2
715 local origin mirror name rest ol prefix
716 while read origin mirror name rest; do
717 # skip comments and empty lines
718 if [ -z "$origin" ] || [[ $origin == \#* ]]; then
721 ol=`echo -n "$origin"|wc -c`
722 prefix="`echo -n "$url" | head -c $ol`"
723 if [ "$prefix" = "$origin" ] ; then
724 suffix="`echo "$url"|cut -b $((ol+1))-`"
725 echo -n "$mirror$suffix"
732 # Warning: unpredictable results if same URL used twice
737 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
738 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
744 [ "$NO5" = "yes" ] && return
746 [ -z "$no" ] && return
750 if [ -f additional-md5sums ]; then
751 local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
752 if [ -z "$spec_rev" ]; then
753 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
755 local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
756 md5=$(grep -s -v '^#' additional-md5sums | \
757 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
758 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
759 grep -E '^[0-9a-f]{32}$')
762 if [ $(echo "$md5" | wc -l) != 1 ] ; then
763 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
765 echo "$md5" | tail -n 1
770 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
771 if [ -n "$source_md5" ]; then
774 source_md5=`grep -i "BuildRequires:[ ]*digest(%SOURCE$no)[ ]*=" $SPECFILE | sed -e 's/.*=//'`
775 if [ -n "$source_md5" ]; then
778 # we have empty SourceX-md5, but it is still possible
779 # that we have NoSourceX-md5 AND NoSource: X
780 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
781 if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
790 echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
795 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
798 distfiles_attic_url ()
800 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
807 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
812 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
813 [ -n "$size" -a "$size" -gt 0 ]
818 if [ "$CVSIGNORE_DF" != "yes" ]; then
821 cvsignore=${SOURCE_DIR}/.cvsignore
822 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
823 echo "$1" >> $cvsignore
829 update_shell_title "cvsup"
831 if [ -n "$CVSROOT" ]; then
832 OPTIONS="-d $CVSROOT $OPTIONS"
835 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
836 OPTIONS="$OPTIONS -A"
838 if [ -n "$CVSDATE" ]; then
839 OPTIONS="$OPTIONS -D $CVSDATE"
841 if [ -n "$CVSTAG" ]; then
842 OPTIONS="$OPTIONS -r $CVSTAG"
847 local retries_counter=0
849 update_shell_title "cvsup: $*"
851 update_shell_title "cvsup: $# files"
853 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
854 retries_counter=$(( $retries_counter + 1 ))
855 output=$(LC_ALL=C cvs $OPTIONS "$@" 2>&1)
857 [ -n "$output" ] && echo "$output"
858 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
859 echo "Trying again [$*]... ($retries_counter)"
860 update_shell_title "cvsup: retry #$retries_counter"
867 update_shell_title "cvsup: done!"
871 # returns true if "$1" is ftp, http or https protocol url
875 ftp://*|http://*|https://*)
884 if [ $# -eq 0 ]; then
888 update_shell_title "update md5"
889 if [ -n "$DEBUG" ]; then
896 # pass 1: check files to be fetched
900 local fp=$(nourl "$i")
901 local srcno=$(src_no "$i")
902 if [ -n "$ADD5" ]; then
903 [ "$fp" = "$i" ] && continue # FIXME what is this check doing?
904 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE && continue
905 grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE && continue
907 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE || continue
909 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
910 need_files="$need_files $i"
914 # pass 1a: get needed files
915 if [ "$need_files" ]; then
916 get_files $need_files
919 # pass 2: proceed with md5 adding or updating
921 local fp=$(nourl "$i")
922 local srcno=$(src_no "$i")
923 local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE )
924 if [ -z "$md5" ]; then
925 md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE )
927 if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
928 local tag="# Source$srcno-md5:\t"
929 if [[ "$md5" == *NoSource* ]]; then
930 tag="# NoSource$srcno-md5:\t"
931 elif [ -n "$USEDIGEST" ]; then
932 tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
934 md5=$(md5sum "$fp" | cut -f1 -d' ')
935 echo "Updating Source$srcno ($md5: $fp)."
937 print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
938 print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
947 update_shell_title "check md5"
950 if good_md5 "$i" && good_size "$i"; then
954 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
955 echo "or -5 to update md5 sums, if you're sure files are correct."
956 Exit_error err_no_source_in_repo $i
962 update_shell_title "get_files"
964 if [ -n "$DEBUG" ]; then
969 if [ $# -gt 0 ]; then
972 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
973 echo "Warning: No CVS access defined for SOURCES"
978 local get_files_cvs=""
982 SHELL_TITLE_PREFIX="get_files[$nc/$#]"
983 update_shell_title "$i"
984 local fp=`nourl "$i"`
985 if [ "$SKIP_EXISTING_FILES" = "yes" ] && [ -f "$fp" ]; then
990 local srcmd5=$(src_md5 "$i")
992 # we know if source/patch is present in cvs/distfiles
993 # - has md5 (in distfiles)
996 # CHECK: local file didn't exist or always cvs up (first) requested.
997 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
998 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
999 echo "Warning: no URL given for $i"
1002 if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
1003 if good_md5 "$i" && good_size "$i"; then
1004 echo "$fp having proper md5sum already exists"
1009 # optionally prefer mirror over distfiles if there's mirror
1010 # TODO: build url list and then try each url from the list
1011 if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
1014 url=$(distfiles_url "$i")
1017 url_attic=$(distfiles_attic_url "$i")
1019 # is $url local file?
1020 if [[ "$url" = [./]* ]]; then
1021 update_shell_title "${GETLOCAL%% *}: $url"
1022 ${GETLOCAL} $url $target
1024 if [ -z "$NOMIRRORS" ]; then
1025 url=$(find_mirror "$url")
1029 # make shorter message for distfiles urls
1030 if [[ "$uri" = ${PROTOCOL}${DISTFILES_SERVER}* ]] || [[ "$uri" = ${PROTOCOL}${ATTICDISTFILES_SERVER}* ]]; then
1031 uri=${uri#${PROTOCOL}${DISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1032 uri=${uri#${PROTOCOL}${ATTICDISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1035 update_shell_title "${GETURI%% *}: $uri"
1036 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1037 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1038 update_shell_title "${GETURI2%% *}: $url"
1039 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1044 if [ ! -s "$target" ]; then
1046 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
1047 update_shell_title "${GETLOCAL%% *}: $url_attic"
1048 ${GETLOCAL} $url_attic $target
1050 if [ -z "$NOMIRRORS" ]; then
1051 url_attic="`find_mirror "$url_attic"`"
1053 update_shell_title "${GETURI%% *}: $url_attic"
1054 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1055 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1056 update_shell_title "${GETURI2%% *}: $url_attic"
1057 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1062 if [ -s "$target" ]; then
1063 cvsignore_df $target
1068 elif [ "$NOCVS" != "yes" -a -z "$srcmd5" ]; then
1069 if [ $# -gt 1 ]; then
1070 get_files_cvs="$get_files_cvs $fp"
1071 update_shell_title "$fp (will cvs up later)"
1078 if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
1079 if [ -z "$NOMIRRORS" ]; then
1080 im="`find_mirror "$i"`"
1084 update_shell_title "${GETURI%% *}: $im"
1085 ${GETURI} "$im" || \
1086 if [ "`echo $im | grep -E 'ftp://'`" ]; then
1087 update_shell_title "${GETURI2%% *}: $im"
1092 if [ "$cvsup" = 1 ]; then
1098 # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
1099 if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
1100 if [ -n "GREEDSRC" ]; then
1101 get_greed_sources $i
1103 Exit_error err_no_source_in_repo $i
1107 # we check md5 here just only to refetch immediately
1108 if good_md5 "$i" && good_size "$i"; then
1110 elif [ "$FROM_DISTFILES" = 1 ]; then
1111 # wrong md5 from distfiles: remove the file and try again
1113 echo "MD5 sum mismatch. Trying full fetch."
1116 update_shell_title "${GETURI%% *}: $url"
1117 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1118 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1119 update_shell_title "${GETURI2%% *}: $url"
1120 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1122 if [ ! -s "$target" ]; then
1124 update_shell_title "${GETURI%% *}: $url_attic"
1125 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1126 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1127 update_shell_title "${GETURI2%% *}: $url_attic"
1128 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1131 test -s "$target" || rm -f "$target"
1134 SHELL_TITLE_PREFIX=""
1136 if [ "$get_files_cvs" ]; then
1137 cvsup $get_files_cvs
1140 if [ "$CHMOD" = "yes" ]; then
1141 CHMOD_FILES="`nourl "$@"`"
1142 if [ -n "$CHMOD_FILES" ]; then
1143 chmod $CHMOD_MODE $CHMOD_FILES
1150 if [ -n "$DEBUG" ]; then
1155 # Check whether first character of PACKAGE_NAME is legal for tag name
1156 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
1160 # NOTE: CVS tags may must not contain the characters `$,.:;@'
1161 TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
1163 # Remove #kernel.version_release from TAGVER because tagging sources
1164 # could occur with different kernel-headers than kernel-headers used at build time.
1165 # besides, %{_kernel_ver_str} is not expanded.
1167 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
1168 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
1174 # bool is_tag_a_branch(tag)
1176 # returns 1 if a tag is a branch set on SPECFILE
1178 if [ -n "$DEBUG" ]; then
1183 if [ $# -ne 1 ]; then
1190 cvs status -v $SPECFILE | grep -Eiq "${TAG}.+(branch: [0-9.]+)"
1198 if [ -n "$DEBUG" ]; then
1203 echo "Version: $PACKAGE_VERSION"
1204 echo "Release: $PACKAGE_RELEASE"
1207 if [ "$TAG_VERSION" = "yes" ]; then
1208 TAGVER=`make_tagver`
1209 echo "CVS tag: $TAGVER"
1211 if [ -n "$TAG" ]; then
1212 echo "CVS tag: $TAG"
1215 local OPTIONS="tag $CVS_FORCE"
1216 if [ -n "$CVSROOT" ]; then
1217 OPTIONS="-d $CVSROOT $OPTIONS"
1220 # if a tagname we are about to set already exists
1221 # and happens to be a branch (common case with AC-branch)
1222 # pass -B (allows -F to disturb branch tag)
1224 if [ "$TAG_VERSION" = "yes" ]; then
1227 is_tag_a_branch $_tag
1228 if [ $? -eq 0 -a $CVS_NSERVER -eq 0 ]; then
1229 OPTIONS="$OPTIONS -B"
1234 for i in $TAG_FILES; do
1235 # don't tag files stored on distfiles
1236 [ -n "`src_md5 $i`" ] && continue
1237 local fp=`nourl "$i"`
1238 if [ -f "$fp" ]; then
1239 tag_files="$tag_files $fp"
1240 elif [ -n "GREEDSRC" ]; then
1241 get_greed_sources $i
1243 Exit_error err_no_source_in_repo $i
1247 if [ "$tag_files" ]; then
1248 if [ "$TAG_VERSION" = "yes" ]; then
1249 update_shell_title "tag sources: $TAGVER"
1250 printf "Tagging %d files\n" $(echo $tag_files | wc -w)
1251 cvs $OPTIONS $TAGVER $tag_files || exit
1253 if [ -n "$TAG" ]; then
1254 update_shell_title "tag sources: $TAG"
1256 while [ "$tag_files" ]; do
1257 local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
1258 printf "Tagging %d files\n" $(echo $chunk | wc -w)
1259 cvs $OPTIONS $TAG $chunk || exit
1260 tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
1266 if [ "$TAG_VERSION" = "yes" ]; then
1267 update_shell_title "tag spec: $TAGVER"
1268 cvs $OPTIONS $TAGVER $SPECFILE || exit
1270 if [ -n "$TAG" ]; then
1271 update_shell_title "tag spec: $TAG"
1272 cvs $OPTIONS $TAG $SPECFILE || exit
1279 echo "CVS branch tag: $TAG"
1284 if [ -n "$DEBUG" ]; then
1289 local OPTIONS="tag $CVS_FORCE -b"
1290 if [ -n "$CVSROOT" ]; then
1291 OPTIONS="-d $CVSROOT $OPTIONS"
1295 for i in $TAG_FILES; do
1296 local fp=`nourl "$i"`
1297 if [ -f "$fp" ]; then
1298 tag_files="$tag_files $fp"
1299 elif [ -n "GREEDSRC" ]; then
1300 get_greed_sources $i
1302 Exit_error err_no_source_in_repo $i
1305 if [ "$tag_files" ]; then
1306 cvs $OPTIONS $TAG $tag_files || exit
1310 cvs $OPTIONS $TAG $SPECFILE || exit
1314 # this function should exit early if package can't be built for this arch
1315 # this avoids unneccessary BR filling.
1318 out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
1320 if [ $ret -ne 0 ]; then
1329 update_shell_title "build_package"
1330 if [ -n "$DEBUG" ]; then
1337 if [ -n "$TRY_UPGRADE" ]; then
1338 update_shell_title "build_package: try_upgrade"
1339 if [ -n "$FLOAT_VERSION" ]; then
1340 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
1342 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
1345 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
1347 if [ -n "$TNEWVER" ]; then
1348 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
1349 echo "New version found, updating spec file to version " $TNEWVER
1350 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1351 cp -f $SPECFILE $SPECFILE.bak
1354 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
1355 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
1357 NODIST="yes" get_files $SOURCES $PATCHES
1360 unset TOLDVER TNEWVER TNOTIFY
1367 BUILD_SWITCH="-ba" ;;
1369 BUILD_SWITCH="-bb" ;;
1371 BUILD_SWITCH="-bs --nodeps" ;;
1373 BUILD_SWITCH="-bp --nodeps" ;;
1375 BUILD_SWITCH="-bc" ;;
1377 BUILD_SWITCH="-bi" ;;
1379 BUILD_SWITCH="-bl" ;;
1383 update_shell_title "build_package: $COMMAND"
1384 if [ -n "$LOGFILE" ]; then
1385 LOG=`eval echo $LOGFILE`
1386 if [ -d "$LOG" ]; then
1387 echo "Log file $LOG is a directory."
1388 echo "Parse error in the spec?"
1389 Exit_error err_build_fail
1391 if [ -n "$LASTLOG_FILE" ]; then
1392 echo "LASTLOG=$LOG" > $LASTLOG_FILE
1394 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
1395 (time eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
1396 RETVAL=`cat $RES_FILE`
1398 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
1399 if [ "$RETVAL" -eq "0" ]; then
1406 eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE
1409 if [ "$RETVAL" -ne "0" ]; then
1410 if [ -n "$TRY_UPGRADE" ]; then
1411 echo "\n!!! Package with new version cannot be built automagically\n"
1412 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1413 mv -f $SPECFILE.bak $SPECFILE
1416 Exit_error err_build_fail
1423 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1426 install_required_packages()
1433 # taken from find-spec-bcond, but with just getting the list
1435 # quick revert hint: '$RPMBUILD --bcond $SPEC'
1437 /^%changelog/ { exit }
1438 /_with(out)?_[_a-zA-Z0-9]+/{
1439 match($0, /_with(out)?_[_a-zA-Z0-9]+/);
1440 print substr($0, RSTART, RLENGTH);
1443 match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
1444 bcond = substr($0, RSTART +5 , RLENGTH -5);
1445 gsub(/[ \t]+/,"_",bcond);
1447 }' $SPEC | LC_ALL=C sort -u
1451 # expand bconds from ~/.bcondrc
1452 # The file structure is like gentoo's package.use:
1455 # samba -mysql -pgsql
1456 # w32codec-installer license_agreement
1459 if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
1465 SN=${SPECFILE%%\.spec}
1467 local bcondrc=$HOME/.bcondrc
1468 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
1470 local bcond_avail=$(find_spec_bcond $SPECFILE)
1472 while read pkg flags; do
1474 [[ "$pkg" == \#* ]] && continue
1476 # any package or current package?
1477 if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
1478 for flag in $flags; do
1479 local opt=${flag#[+-]}
1481 # use only flags which are in this package.
1482 if [[ $bcond_avail = *${opt}* ]]; then
1483 if [[ $flag = -* ]]; then
1484 if [[ $BCOND != *--with?${opt}* ]]; then
1485 BCOND="$BCOND --without $opt"
1488 if [[ $BCOND != *--without?${opt}* ]]; then
1489 BCOND="$BCOND --with $opt"
1496 update_shell_title "parse ~/.bcondrc: DONE!"
1501 update_shell_title "set bcond values"
1503 AVAIL_BCONDS_WITHOUT=""
1504 AVAIL_BCONDS_WITH=""
1505 if `grep -q ^%bcond ${SPECFILE}`; then
1507 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
1513 local bcond_avail=$(find_spec_bcond $SPECFILE)
1514 process_bcondrc "$SPECFILE"
1516 update_shell_title "parse bconds"
1517 case "${BCOND_VERSION}" in
1522 echo "Warning: This spec has old style bconds. Fix it || die."
1523 for opt in `echo "$bcond_avail" | grep ^_without_`
1525 AVAIL_BCOND_WITHOUT=${opt#_without_}
1526 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1527 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1529 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1533 for opt in `echo "$bcond_avail" | grep ^_with_`
1535 AVAIL_BCOND_WITH=${opt#_with_}
1536 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1537 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1539 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1544 local cond_type="" # with || without
1545 for opt in $bcond_avail; do
1554 AVAIL_BCOND_WITHOUT=${opt#_without_}
1555 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1556 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1558 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1562 AVAIL_BCOND_WITH=${opt#_with_}
1563 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1564 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1566 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1570 case "$cond_type" in
1573 AVAIL_BCOND_WITH="$opt"
1574 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1575 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1577 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1582 AVAIL_BCOND_WITHOUT="$opt"
1583 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1584 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1586 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1600 update_shell_title "run_sub_builder $package_name"
1602 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1603 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1604 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1605 # jakby nie bylo tego kawalka kodu.
1607 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1608 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1615 # Istnieje taki spec? ${package}.spec
1616 if [ -f "${SPEC_DIR}/${package}.spec" ]; then
1617 parent_spec_name=${package}.spec
1618 elif [ -f "${SPEC_DIR}/`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1619 parent_spec_name="`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1621 for provides_line in `grep ^Provides:.*$package ${SPEC_DIR} -R`
1627 if [ "${parent_spec_name}" != "" ]; then
1628 spawn_sub_builder $parent_spec_name
1630 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1636 update_shell_title "spawn_sub_builder $package_name"
1639 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1640 sub_builder_opts="${sub_builder_opts} -R"
1642 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1643 sub_builder_opts="${sub_builder_opts} -RB"
1644 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1645 sub_builder_opts="${sub_builder_opts} -FRB"
1647 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1648 sub_builder_opts="${sub_builder_opts} -Upi"
1652 ./builder ${sub_builder_opts} "$@"
1655 remove_build_requires()
1657 if [ "$INSTALLED_PACKAGES" != "" ]; then
1658 case "$REMOVE_BUILD_REQUIRES" in
1660 run_poldek --noask -ve $INSTALLED_PACKAGES
1663 run_poldek --ask -ve $INSTALLED_PACKAGES
1666 echo You may want to manually remove following BuildRequires fetched:
1667 echo $INSTALLED_PACKAGES
1668 echo "Try poldek -e \`cat $(pwd)/.${SPECFILE}_INSTALLED_PACKAGES\`"
1676 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1677 if [ "$BCOND" != "" ]; then
1678 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1681 echo -ne "\nNo conditional flags passed"
1683 echo -ne "\n\nfrom available:\n"
1684 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1690 if [ "$NOCVSSPEC" != "yes" ]; then
1691 echo -ne "Available branches: "
1692 cvs status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
1696 # checks a given list of packages/files/provides agains current rpmdb.
1697 # outputs all dependencies which current rpmdb doesn't satisfy.
1698 # input can be either STDIN or parameters
1703 if [ $# -gt 0 ]; then
1709 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
1712 echo "$DEPS" | awk '/^no package provides/ { print $NF }'
1714 # other deps (files)
1715 echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
1718 # checks if given package/files/provides exists in rpmdb.
1719 # input can be either stdin or parameters
1720 # returns packages which are present in the rpmdb
1725 if [ $# -gt 0 ]; then
1731 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
1734 fetch_build_requires()
1736 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1737 update_shell_title "fetch build requires"
1738 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ] || [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1739 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1740 # TODO: Conflicts list doesn't check versions
1741 local CNFL=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
1742 local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
1744 if [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1745 local CNFL=$(rpm -q --specsrpm --conflicts $BCOND $SPECFILE | awk '{print $1}' | _rpm_cnfl_check | xargs)
1746 local DEPS=$(rpm -q --specsrpm --requires $BCOND $SPECFILE | awk '{print $1}' | _rpm_prov_check | xargs)
1749 if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
1750 echo "fetch BuildRequires: install [$DEPS]; remove [$CNFL]"
1751 update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
1752 $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
1754 if [ -n "$CNFL" ]; then
1755 update_shell_title "uninstall conflicting packages: $CNFL"
1756 echo "Trying to uninstall conflicting packages ($CNFL):"
1757 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CNFL
1760 while [ "$DEPS" ]; do
1761 update_shell_title "install deps: $DEPS"
1762 echo "Trying to install dependencies ($DEPS):"
1763 local log=.${SPECFILE}_poldek.log
1764 $SU_SUDO /usr/bin/poldek --caplookup -uGqQ $DEPS | tee $log
1765 failed=$(awk '/^error:/{a=$2; sub(/^error: /, "", a); sub(/:$/, "", a); print a}' $log)
1768 if [ -n "$failed" ]; then
1769 for package in $failed; do
1770 spawn_sub_builder -bb $(depspecname $package) && ok="$ok $package"
1780 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1781 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1782 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1783 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1784 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1785 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`
1787 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`"
1789 package=`basename "$package_item"|sed -e "s/}$//g"`
1790 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1793 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1794 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1795 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
1800 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1803 if `echo $COND_TST|grep -q 'without_'`; then
1804 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1805 if `echo $COND_TST|grep -q !`; then
1810 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1811 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1812 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1818 elif `echo $COND_TST|grep -q 'with_'`; then
1819 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1820 if `echo $COND_TST|grep -q !`; then
1825 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1826 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1827 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1833 RESULT="${COND_STATE}-${COND_ARGV}"
1835 "with-wout" | "wout-with" )
1838 "wout-wout" | "with-with" )
1842 echo "Action '$RESULT' was not defined for package '$package_item'"
1848 if [ "$GO" = "yes" ]; then
1849 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1850 echo "Testing if $package has subrequirements..."
1851 run_poldek -t -i $package --dumpn=".$package-req.txt"
1852 if [ -f ".$package-req.txt" ]; then
1853 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1855 if [ "$package_name" = "$package" ]; then
1856 echo -ne "Installing BuildRequired package:\t$package_name\n"
1857 update_shell_title "Installing BuildRequired package: ${package_name}"
1858 install_required_packages $package
1860 echo -ne "Installing (sub)Required package:\t$package_name\n"
1861 update_shell_title "Installing (sub)Required package: ${package_name}"
1862 install_required_packages $package_name
1866 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1867 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1870 echo "Attempting to run spawn sub - builder..."
1871 echo -ne "Package installation failed:\t$package_name\n"
1872 run_sub_builder $package_name
1873 if [ $? -eq 0 ]; then
1874 install_required_packages $package_name
1877 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1878 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1881 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1888 rm -f ".$package-req.txt"
1890 echo "Attempting to run spawn sub - builder..."
1891 echo -ne "Package installation failed:\t$package\n"
1892 run_sub_builder $package
1893 if [ $? -eq 0 ]; then
1894 install_required_packages $package
1897 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1898 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1901 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1907 echo "Package $package is already installed. BuildRequirement satisfied."
1911 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1912 echo "Unable to install following packages and their dependencies:"
1913 for pkg in "$NOT_INSTALLED_PACKAGES"
1917 remove_build_requires
1925 TOP_DIR="`eval $RPM $RPMOPTS --eval '%{_topdir}'`"
1926 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1928 mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
1930 cvs -d $CVSROOT co SOURCES/{.cvsignore,dropin} SPECS/{mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
1934 echo "To checkout *all* .spec files:"
1935 echo "- remove $SPEC_DIR/CVS/Entries.Static"
1936 echo "- run cvs up in $SPEC_DIR dir"
1939 echo "To commit with your developer account:"
1940 echo "- edit $SPEC_DIR/CVS/Root"
1941 echo "- edit $SOURCE_DIR/CVS/Root"
1944 get_greed_sources() {
1945 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1946 if [ -n "BE_VERBOSE" ]; then
1947 echo "Try greed download: $1 from: $CVSROOT"
1949 cvs -d $CVSROOT get SOURCES/$1
1950 if [ $? != 0 ]; then
1951 Exit_error err_no_source_in_repo $1
1956 # remove entries from CVS/Entries
1957 cvs_entry_remove() {
1958 local cvsdir="$1"; shift
1959 if [ ! -d "$cvsdir" ]; then
1960 echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
1964 for file in "$@"; do
1965 rm -f $cvsdir/CVS/Entries.new || return 1
1966 awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
1967 mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
1975 DONT_PRINT_REVISION="yes"
1979 # remove from CVS/Entries
1980 cvs_entry_remove $SPEC_DIR $SPECFILE
1981 cvs_entry_remove $SOURCE_DIR $SOURCES $PATCHES
1983 # remove spec and sources
1984 $RPMBUILD --clean --rmsource --rmspec --nodeps $SPECFILE
1987 #---------------------------------------------
1995 while [ $# -gt 0 ]; do
1998 COMMAND="update_md5"
2003 COMMAND="update_md5"
2013 DEBUG="yes"; shift ;;
2015 COMMAND="version"; shift ;;
2017 COMMAND="short-version"; shift ;;
2019 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
2020 -b | -ba | --build )
2021 COMMAND="build"; shift ;;
2022 -bb | --build-binary )
2023 COMMAND="build-binary"; shift ;;
2025 COMMAND="build-build"; shift ;;
2027 COMMAND="build-install"; shift ;;
2029 COMMAND="build-list"; shift ;;
2030 -bp | --build-prep )
2031 COMMAND="build-prep"; shift ;;
2032 -bs | --build-source )
2033 COMMAND="build-source"; shift ;;
2035 COMMAND="branch"; shift; TAG="${1}"; shift;;
2037 CLEAN="--clean --rmspec --rmsource"; shift ;;
2039 CVS_FORCE="-F"; shift;;
2041 shift; CVSROOT="${1}"; shift ;;
2043 COMMAND="get"; shift ;;
2045 COMMAND="usage"; shift ;;
2047 PROTOCOL="http"; shift ;;
2049 shift; LOGFILE="${1}"; shift ;;
2051 shift; DEF_NICE_LEVEL=${1}; shift ;;
2052 -ske | --skip-existing-files)
2053 SKIP_EXISTING_FILES="yes"; shift ;;
2055 COMMAND="mr-proper"; shift ;;
2057 NOCVS="yes"; shift ;;
2058 -ncs | --no-cvs-specs )
2059 NOCVSSPEC="yes"; shift ;;
2060 -nd | --no-distfiles )
2061 NODIST="yes"; shift ;;
2062 -nm | --no-mirrors )
2063 NOMIRRORS="yes"; shift ;;
2065 NOURLS="yes"; shift ;;
2067 NOSRCS="yes"; shift ;;
2068 -ns0 | --no-source0 )
2069 NOSOURCE0="yes"; shift ;;
2079 -pm | --prefer-mirrors )
2086 shift; RPMOPTS="${RPMOPTS} ${1}"; shift ;;
2088 shift; RPMOPTS="${RPMOPTS} --define \"patch${1} : ignoring patch${1}; exit 1; \""; shift ;;
2089 --with | --without )
2090 case $GROUP_BCONDS in
2094 while ! `echo ${1}|grep -qE '(^-|spec)'`
2096 BCOND="$BCOND $COND $1"
2100 if [[ "$2" = *,* ]]; then
2101 for a in $(echo "$2" | tr , ' '); do
2102 BCOND="$BCOND $1 $a"
2105 BCOND="$BCOND $1 $2"
2111 shift; TARGET="${1}"; shift ;;
2113 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
2115 QUIET="--quiet"; shift ;;
2117 CVSDATE="${2}"; shift 2 ;;
2119 shift; CVSTAG="${1}"; shift ;;
2121 shift; CVSTAG="HEAD"; ;;
2122 -R | --fetch-build-requires)
2123 FETCH_BUILD_REQUIRES="yes"
2124 NOT_INSTALLED_PACKAGES=
2126 -RB | --remove-build-requires)
2127 REMOVE_BUILD_REQUIRES="nice"
2129 -FRB | --force-remove-build-requires)
2130 REMOVE_BUILD_REQUIRES="force"
2132 -sc | --sources-cvs)
2133 COMMAND="list-sources-cvs"
2135 -sd | --sources-distfiles)
2136 COMMAND="list-sources-distfiles"
2138 -sdp | --sources-distfiles-paths)
2139 COMMAND="list-sources-distfiles-paths"
2141 -sf | --sources-files)
2142 COMMAND="list-sources-files"
2144 -sp | --sources-paths)
2145 COMMAND="list-sources-local-paths"
2147 -su | --sources-urls)
2148 COMMAND="list-sources-urls"
2150 -Tvs | --tag-version-stable )
2155 -Ts | --tag-stable )
2160 -Tv | --tag-version )
2165 -Tp | --tag-prefix )
2177 -ir | --integer-release-only )
2178 INTEGER_RELEASE="yes"
2181 COMMAND="update_md5"
2186 -Upi | --update-poldek-indexes )
2187 UPDATE_POLDEK_INDEXES="yes"
2190 COMMAND="init_rpm_dir"
2192 --use-greed-sources )
2195 -u | --try-upgrade )
2196 TRY_UPGRADE="1"; shift ;;
2197 -un | --try-upgrade-with-float-version )
2198 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
2200 BE_VERBOSE="1"; shift ;;
2205 if echo "${MACRO}" | grep -q '\W'; then
2206 RPMOPTS="${RPMOPTS} --define \"${MACRO}\""
2210 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
2215 RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
2219 RPMBUILDOPTS="${RPMBUILDOPTS} --short-circuit"
2222 --show-bconds | -show-bconds | -print-bconds | --print-bconds | -display-bconds | --display-bconds )
2223 COMMAND="show_bconds"
2227 COMMAND="show_bcond_args"
2232 RPMOPTS="${RPMOPTS} --nodeps"
2235 RPMBUILDOPTS="${RPMBUILDOPTS} -debug"; shift
2238 Exit_error err_invalid_cmdline "$1"
2242 # check if specname was passed as specname:cvstag
2243 if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
2244 CVSTAG="${SPECFILE##*:}"
2245 SPECFILE="${SPECFILE%%:*}"
2247 ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
2252 if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then
2253 CVSTAG=$(awk -vSPECFILE=$(basename ${SPECFILE%.spec}.spec) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries)
2254 if [ "$CVSTAG" ]; then
2255 echo >&2 "builder: Stick tag $CVSTAG active. Use -r TAGNAME to override."
2257 elif [ "$CVSTAG" = "HEAD" ]; then
2258 # assume -r HEAD is same as -A
2262 if [ -n "$DEBUG" ]; then
2267 if [ -n "$TARGET" ]; then
2270 TARGET_SWITCH="--target $TARGET" ;;
2272 TARGET_SWITCH="--target=$TARGET" ;;
2276 if [ "$SCHEDTOOL" != "no" ]; then
2277 NICE_COMMAND="$SCHEDTOOL"
2279 NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
2282 update_shell_title "$COMMAND"
2286 if [ -n "$SPECFILE" ]; then
2287 get_spec > /dev/null
2295 if [ -n "$SPECFILE" ]; then
2296 get_spec > /dev/null
2302 "build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
2304 if [ -n "$SPECFILE" ]; then
2310 if [ "$COMMAND" != "build-source" ]; then
2313 fetch_build_requires
2314 if [ "$INTEGER_RELEASE" = "yes" ]; then
2315 echo "Checking release $PACKAGE_RELEASE..."
2316 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
2317 Exit_error err_fract_rel "$PACKAGE_RELEASE"
2321 # ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
2322 if [ -n "$TEST_TAG" ]; then
2323 local TAGVER=`make_tagver`
2324 echo "Searching for tag $TAGVER..."
2325 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
2326 if [ -n "$TAGREL" ]; then
2327 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
2330 # - do not allow to build from HEAD when XX-branch exists
2331 TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
2332 if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
2333 TAG_BRANCH="${TREE_PREFIX}-branch"
2334 TAG_STATUS=$(cvs status -v $SPECFILE | grep -Ei "${TAG_BRANCH}.+(branch: [0-9.]+)")
2335 if [ -n "$TAG_STATUS" -a "$CVSTAG" = "HEAD" ]; then
2336 Exit_error err_branch_exists "$TAG_STATUS"
2342 if [ -n "$NOSOURCE0" ] ; then
2343 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2345 get_files $SOURCES $PATCHES
2348 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
2349 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
2351 remove_build_requires
2353 Exit_error err_no_spec_in_cmdl
2358 if [ -n "$SPECFILE" ]; then
2361 # don't fetch sources from remote locations
2363 for file in $SOURCES; do
2364 [ -n "`src_md5 $file`" ] && continue
2365 new_SOURCES="$new_SOURCES $file"
2367 SOURCES="$new_SOURCES"
2368 get_files $SOURCES $PATCHES
2370 branch_files $TAG $SOURCES $PATCHES $ICONS
2372 Exit_error err_no_spec_in_cmdl
2377 if [ -n "$SPECFILE" ]; then
2381 if [ -n "$NOSOURCE0" ] ; then
2382 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2384 get_files $SOURCES $PATCHES
2387 Exit_error err_no_spec_in_cmdl
2392 if [ -n "$SPECFILE" ]; then
2396 if [ -n "$NOSOURCE0" ] ; then
2397 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2401 Exit_error err_no_spec_in_cmdl
2408 if [ -n "$SPECFILE" ]; then
2412 # don't fetch sources from remote locations
2414 for file in $SOURCES; do
2415 [ -n "`src_md5 $file`" ] && continue
2416 new_SOURCES="$new_SOURCES $file"
2418 SOURCES="$new_SOURCES"
2419 get_files $SOURCES $PATCHES
2421 tag_files $SOURCES $PATCHES $ICONS
2423 Exit_error err_no_spec_in_cmdl
2429 "list-sources-files" )
2432 DONT_PRINT_REVISION="yes"
2435 for SAP in $SOURCES $PATCHES; do
2436 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2439 "list-sources-urls" )
2442 DONT_PRINT_REVISION="yes"
2445 SAPS="$SOURCES $PATCHES"
2446 for SAP in $SAPS ; do
2450 "list-sources-local-paths" )
2453 DONT_PRINT_REVISION="yes"
2456 for SAP in $SOURCES $PATCHES; do
2457 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
2460 "list-sources-distfiles-paths" )
2463 DONT_PRINT_REVISION="yes"
2466 for SAP in $SOURCES $PATCHES; do
2467 if [ -n "$(src_md5 "$SAP")" ]; then
2468 distfiles_path "$SAP"
2472 "list-sources-distfiles" )
2475 DONT_PRINT_REVISION="yes"
2478 for SAP in $SOURCES $PATCHES; do
2479 if [ -n "$(src_md5 "$SAP")" ]; then
2480 distfiles_url "$SAP"
2484 "list-sources-cvs" )
2487 DONT_PRINT_REVISION="yes"
2490 for SAP in $SOURCES $PATCHES; do
2491 if [ -z "$(src_md5 "$SAP")" ]; then
2492 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2506 echo "$VERSIONSTRING"
2509 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
2510 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
2514 # vi:syntax=sh:ts=4:sw=4:noet