3 # This program is free software, distributed under the terms of
4 # the GNU General Public License Version 2.
10 # 2 - no spec file name in cmdl parameters
11 # 3 - spec file not stored in repo
12 # 4 - some source, patch or icon files not stored in repo
13 # 5 - package build failed
14 # 6 - spec file with errors
15 # 7 - wrong source in /etc/poldek.conf
16 # 8 - Failed installing buildrequirements and subrequirements
17 # 9 - Requested tag already exist
18 # 10 - Refused to build fractional release
19 # 100 - Unknown error (should not happen)
22 # - builder -u fetches current version first (well that's okay, how you compare versions if you have no old spec?)
23 # - when Icon: field is present, -5 and -a5 doesn't work
24 # - builder -R skips installing BR if spec is not present before builder invocation (need to run builder twice)
31 Build package utility from PLD Linux CVS repository
32 $VERSION (C) 1999-2007 Free Penguins".
34 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
53 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
57 # use rpm 4.4.6+ digest format instead of comments if non-zero
60 # user agent when fetching files
61 USER_AGENT="PLD/Builder($VERSION)"
63 # It can be used i.e. in log file naming.
64 # See LOGFILE example.
65 DATE=`date +%Y-%m-%d_%H-%M-%S`
67 # Example: LOGFILE='../log.$PACKAGE_NAME'
68 # Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
69 # Yes, you can use variable name! Note _single_ quotes!
93 WGET_RETRIES=${MAX_WGET_RETRIES:-0}
94 CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
100 CVS_SERVER="cvs.pld-linux.org"
101 DISTFILES_SERVER="://distfiles.pld-linux.org"
102 ATTICDISTFILES_SERVER="://attic-distfiles.pld-linux.org"
107 FAIL_IF_NO_SOURCES="yes"
109 # let get_files skip over files which are present to get those damn files fetched
110 SKIP_EXISTING_FILES="no"
113 # should the specfile be restored if upgrade failed?
114 REVERT_BROKEN_UPGRADE="yes"
116 if rpm --specsrpm 2>/dev/null; then
117 FETCH_BUILD_REQUIRES_RPMSPECSRPM="yes"
118 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
120 FETCH_BUILD_REQUIRES_RPMSPECSRPM="no"
121 if [ -x /usr/bin/rpm-getdeps ]; then
122 FETCH_BUILD_REQUIRES_RPMGETDEPS="yes"
124 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
129 # Here we load saved user environment used to
130 # predefine options set above, or passed to builder
132 # This one reads global system environment settings:
133 if [ -f ~/etc/builderrc ]; then
136 # And this one cascades settings using user personal
138 # Example of ~/.builderrc:
140 #UPDATE_POLDEK_INDEXES="yes"
141 #FETCH_BUILD_REQUIRES="yes"
142 #REMOVE_BUILD_REQUIRES="force"
144 #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
148 if [ -n "$HOME_ETC" ]; then
149 USER_CFG="$HOME_ETC/.builderrc"
150 BUILDER_MACROS="$HOME_ETC/.builder-rpmmacros"
152 USER_CFG=~/.builderrc
153 BUILDER_MACROS=~/.builder-rpmmacros
156 [ -f "$USER_CFG" ] && . "$USER_CFG"
158 if [ "$SCHEDTOOL" = "auto" ]; then
159 if [ -x /usr/bin/schedtool ] && schedtool -B -e echo >/dev/null; then
160 SCHEDTOOL="schedtool -B -e"
166 if [ -n "$USE_PROZILLA" ]; then
167 GETURI="proz --no-getch -r -P ./ -t$WGET_RETRIES $PROZILLA_OPTS"
170 elif [ -n "$USE_AXEL" ]; then
171 GETURI="axel -a $AXEL_OPTS"
175 wget --help 2>&1 | grep -q -- ' --no-check-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
176 wget --help 2>&1 | grep -q -- ' --inet ' && WGET_OPTS="$WGET_OPTS --inet"
177 wget --help 2>&1 | grep -q -- ' --retry-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
178 WGET_OPTS="$WGET_OPTS --user-agent=$USER_AGENT"
180 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
181 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
187 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
195 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
196 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
200 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
201 if [ -n "$LOGFILE" ]; then
202 LOG=`eval echo $LOGFILE`
203 if [ -n "$LASTLOG_FILE" ]; then
204 echo "LASTLOG=$LOG" > $LASTLOG_FILE
206 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
209 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
210 return `cat ${RES_FILE}`
215 #---------------------------------------------
220 if [ -n "$DEBUG" ]; then set -xv; fi
222 Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
223 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
224 [{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
225 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
226 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
227 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
228 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
229 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
230 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
231 <package>[.spec][:cvstag]
233 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
234 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
235 -n5, --no-md5 - ignore md5 comments in spec
236 -D, --debug - enable builder script debugging mode,
237 -debug - produce rpm debug package (same as --opts -debug)
238 -V, --version - output builder version string
239 --short-version - output builder short version
240 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
241 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
243 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
244 only package from <package>.spec,
245 -bp, --build-prep - execute the %prep phase of <package>.spec,
246 -bc - execute the %build phase of <package>.spec,
247 -bi - execute the %install phase of <package>.spec
248 -bl - execute the %files phase of <package>.spec
249 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
251 --short-circuit - short-circuit build
252 -B, --branch - add branch
253 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
254 SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
255 -m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
256 SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
258 -cf, --cvs-force - use -F when tagging (useful when moving branches)
259 -d <cvsroot>, --cvsroot <cvsroot>
261 --define <macro> <value>
262 - define a macro <macro> with value <value>,
263 --alt_kernel <kernel>
264 - same as --define 'alt_kernel <kernel>'
265 --nodeps - rpm won't check any dependences
266 -g, --get - get <package>.spec and all related files from CVS repo
268 -h, --help - this message,
269 --http - use http instead of ftp,
270 -l <logfile>, --logtofile <logfile>
272 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
274 - don't check specs in CVS
275 -nd, --no-distfiles - don't download from distfiles
276 -nm, --no-mirrors - don't download from mirror, if source URL is given,
277 -nu, --no-urls - don't try to download from FTP/HTTP location,
278 -ns, --no-srcs - don't download Sources
279 -ns0, --no-source0 - don't download Source0
280 -nn, --no-net - don't download anything from the net
281 -pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
282 --no-init - don't initialize builder paths (SPECS and SOURCES)
284 --skip-existing-files - skip existing files in get_files
285 --opts <rpm opts> - additional options for rpm
286 -q, --quiet - be quiet,
287 --date yyyy-mm-dd - build package using resources from specified CVS date,
288 -r <cvstag>, --cvstag <cvstag>
289 - build package using resources from specified CVS tag,
290 -A - build package using CVS resources as any sticky tags/date/kopts being reset.
291 -R, --fetch-build-requires
292 - fetch what is BuildRequired,
293 -RB, --remove-build-requires
294 - remove all you fetched with -R or --fetch-build-requires
295 remember, this option requires confirmation,
296 -FRB, --force-remove-build-requires
297 - remove all you fetched with -R or --fetch-build-requires
298 remember, this option works without confirmation,
299 -sd, --source-distfiles - list sources available from distfiles (intended for offline
300 operations; does not work when Icon field is present
301 but icon file is absent),
302 -sc, --source-cvs - list sources available from CVS
303 -sdp, --source-distfiles-paths - list sources available from distfiles -
304 paths relative to distfiles directory (intended for offline
305 operations; does not work when Icon field is present
306 but icon file is absent),
307 -sf, --source-files - list sources - bare filenames (intended for offline
308 operations; does not work when Icon field is present
309 but icon file is absent),
310 -sp, --source-paths - list sources - filenames with full local paths (intended for
311 offline operations; does not work when Icon field is present
312 but icon file is absent),
313 -su, --source-urls - list urls - urls to sources and patches
314 intended for copying urls with spec with lots of macros in urls
315 -T <cvstag> , --tag <cvstag>
316 - add cvs tag <cvstag> for files,
317 -Tvs, --tag-version-stable
318 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
320 - add cvs tag STABLE for files,
322 - add cvs tag NAME-VERSION-RELEASE for files,
323 -Tp, --tag-prefix <prefix>
324 - add <prefix> to NAME-VERSION-RELEASE tags,
325 -tt, --test-tag <prefix>
326 - fail if tag is already present,
327 -ir, --integer-release-only
328 - allow only integer and snapshot releases
329 -v, --verbose - be verbose,
330 -u, --try-upgrade - check version, and try to upgrade package
331 -un, --try-upgrade-with-float-version
332 - as above, but allow float version
334 - try download source from tag head if don't find it in
336 -U, --update - refetch sources, don't use distfiles, and update md5 comments
337 -Upi, --update-poldek-indexes
338 - refresh or make poldek package index files.
339 -np, --nopatch <patchnumber>
340 - don't apply <patchnumber>
341 --show-bconds - show available conditional builds, which can be used
342 - with --with and/or --without switches.
343 --show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
344 ./repackage.sh script. in other words, the output is
345 parseable by scripts.
346 --with/--without <feature>
347 - conditional build package depending on %_with_<feature>/
348 %_without_<feature> macro switch. You may now use
349 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
350 constructions. Set GROUP_BCONDS to yes to make use of it.
351 --target <platform>, --target=<platform>
352 - build for platform <platform>.
353 --init-rpm-dir - initialize ~/rpm directory structure
357 update_shell_title() {
359 local len=${COLUMNS:-80}
360 local msg=$(echo "$*" | cut -c-$len)
362 if [ -n "$BE_VERBOSE" ]; then
363 echo >&2 "$(date +%s.%N) $*"
366 if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
368 if [ -n "$PACKAGE_NAME" ]; then
369 pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
374 msg="$pkg: ${SHELL_TITLE_PREFIX:+$SHELL_TITLE_PREFIX }$msg"
375 msg="$(echo $msg | tr -d '\n\r')"
378 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
381 echo >&2 -ne "\033]0;$msg\007"
387 # set TARGET from BuildArch: from SPECFILE
389 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
390 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
392 target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
396 TARGET_SWITCH="--target ${TARGET}-${target_platform}" ;;
398 TARGET_SWITCH="--target=$TARGET" ;;
404 # runs rpm with minimal macroset
406 # we reset macros not to contain macros.build as all the %() macros are
407 # executed here, while none of them are actually needed.
408 # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
409 safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
411 # TODO: move these to /usr/lib/rpm/macros
412 cat > $BUILDER_MACROS <<'EOF'
413 %x8664 x86_64 amd64 ia32e
416 %requires_releq_kernel_up %{nil}
417 %requires_releq_kernel_smp %{nil}
418 %requires_releq_kernel %{nil}
419 %requires_releq() %{nil}
420 %pyrequires_eq() %{nil}
421 %requires_eq() %{nil}
422 %requires_eq_to() %{nil}
423 %releq_kernel_up ERROR
424 %releq_kernel_smp ERROR
429 %ruby_ver_requires_eq() %{nil}
430 %ruby_mod_ver_requires_eq() %{nil}
431 %__php_api_requires() %{nil}
432 %php_major_version ERROR
433 %php_api_version ERROR
434 %requires_xorg_xserver_extension %{nil}
435 %requires_xorg_xserver_xinput %{nil}
436 %requires_xorg_xserver_font %{nil}
437 %requires_xorg_xserver_videodrv %{nil}
439 %perl_vendorarch ERROR
440 %perl_vendorlib ERROR
441 # damn. need it here! - copied from /usr/lib/rpm/macros.build
442 %tmpdir %(echo "${TMPDIR:-/tmp}")
443 %patchset_source(f:b:) %(
444 base=%{-b*}%{!-b*:10000};
445 start=$(expr $base + %1);
446 end=$(expr $base + %{?2}%{!?2:%{1}});
447 # we need to call seq twice as it doesn't allow two formats
448 seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
449 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
450 paste %{tmpdir}/__ps{1,2};
451 rm -f %{tmpdir}/__ps{1,2};
455 if [ "$NOINIT" = "yes" ] ; then
456 cat >> $BUILDER_MACROS <<'EOF'
461 eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
465 if [ -n "$DEBUG" ]; then
470 update_shell_title "cache_rpm_dump"
473 # what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
474 dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
480 ARGS='--nodigest --nosignature --nobuild'
483 minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
485 if [ $? -gt 0 ]; then
486 error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
488 Exit_error err_build_fail
491 # make small dump cache
492 rpm_dump_cache=`echo "$rpm_dump" | awk '
493 $2 ~ /^SOURCEURL/ {print}
494 $2 ~ /^PATCHURL/ {print}
495 $2 ~ /^nosource/ {print}
496 $2 ~ /^PACKAGE_/ {print}
499 update_shell_title "cache_rpm_dump: OK!"
503 if [ -z "$rpm_dump_cache" ] ; then
504 echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
506 echo "$rpm_dump_cache"
511 update_shell_title "get icons"
512 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
513 if [ -z "$ICONS" ]; then
517 rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
522 update_shell_title "parsing specfile"
523 if [ -n "$DEBUG" ]; then
528 # icons are needed for successful spec parse
534 if [ "$NOSRCS" != "yes" ]; then
535 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
538 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
539 FAIL_IF_NO_SOURCES="no"
542 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
543 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
544 PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}')
545 PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
546 PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
548 if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
549 echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
552 if [ -n "$BE_VERBOSE" ]; then
553 echo "- Sources : `nourl $SOURCES`"
554 if [ -n "$PATCHES" ]; then
555 echo "- Patches : `nourl $PATCHES`"
557 echo "- Patches : *no patches needed*"
559 if [ -n "$ICONS" ]; then
560 echo "- Icon : `nourl $ICONS`"
562 echo "- Icon : *no package icon*"
564 echo "- Name : $PACKAGE_NAME"
565 echo "- Version : $PACKAGE_VERSION"
566 echo "- Release : $PACKAGE_RELEASE"
569 update_shell_title "parse_spec: OK!"
574 if [ -n "$DEBUG" ]; then
582 "err_no_spec_in_cmdl" )
583 remove_build_requires
584 echo "ERROR: spec file name not specified."
586 "err_invalid_cmdline" )
587 echo "ERROR: invalid command line arg ($2)."
589 "err_no_spec_in_repo" )
590 remove_build_requires
591 echo "Error: spec file not stored in CVS repo."
593 "err_no_source_in_repo" )
594 remove_build_requires
595 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"
598 remove_build_requires
599 echo "Error: package build failed. (${2:-no more info})"
601 "err_no_package_data" )
602 remove_build_requires
603 echo "Error: couldn't get out package name/version/release from spec file."
606 remove_build_requires
607 echo "Tag ${2} already exists (spec release: ${3})."
610 remove_build_requires
611 echo "Release ${2} not integer and not a snapshot."
613 "err_branch_exists" )
614 remove_build_requires
615 echo "Tree branch already exists (${2})."
618 remove_build_requires
619 echo "Error: conditions reject building this spec (${2})."
622 echo "Unknown error."
628 if [ -n "$DEBUG" ]; then
633 if [ "$NOINIT" != "yes" ] ; then
635 if [ "$ASSUMED_NAME" ]; then
636 extra="--define 'name $ASSUMED_NAME'"
638 SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
639 SPEC_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
651 update_shell_title "get_spec"
653 if [ -n "$DEBUG" ]; then
659 if [ ! -f "$SPECFILE" ]; then
660 SPECFILE="`basename $SPECFILE .spec`.spec"
662 if [ "$NOCVSSPEC" != "yes" ]; then
664 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
665 echo "Warning: No CVS access defined - using local .spec file"
669 cvsup "$SPECFILE" || Exit_error err_no_spec_in_repo
672 if [ ! -f "$SPECFILE" ]; then
673 Exit_error err_no_spec_in_repo
676 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
677 chmod $CHMOD_MODE $SPECFILE
680 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
689 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
690 cvs update mirrors >&2
694 local origin mirror name rest ol prefix
695 while read origin mirror name rest; do
696 # skip comments and empty lines
697 if [ -z "$origin" ] || [[ $origin == \#* ]]; then
700 ol=`echo -n "$origin"|wc -c`
701 prefix="`echo -n "$url" | head -c $ol`"
702 if [ "$prefix" = "$origin" ] ; then
703 suffix="`echo "$url"|cut -b $((ol+1))-`"
704 echo -n "$mirror$suffix"
711 # Warning: unpredictable results if same URL used twice
716 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
717 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
723 [ "$NO5" = "yes" ] && return
725 [ -z "$no" ] && return
729 if [ -f additional-md5sums ]; then
730 local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
731 if [ -z "$spec_rev" ]; then
732 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
734 local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
735 md5=$(grep -s -v '^#' additional-md5sums | \
736 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
737 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
738 grep -E '^[0-9a-f]{32}$')
741 if [ $(echo "$md5" | wc -l) != 1 ] ; then
742 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
744 echo "$md5" | tail -n 1
749 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
750 if [ -n "$source_md5" ]; then
753 source_md5=`grep -i "BuildRequires:[ ]*digest(%SOURCE$no)[ ]*=" $SPECFILE | sed -e 's/.*=//'`
754 if [ -n "$source_md5" ]; then
757 # we have empty SourceX-md5, but it is still possible
758 # that we have NoSourceX-md5 AND NoSource: X
759 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
760 if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
769 echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
774 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
777 distfiles_attic_url ()
779 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
786 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
791 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
792 [ -n "$size" -a "$size" -gt 0 ]
797 if [ "$CVSIGNORE_DF" != "yes" ]; then
800 cvsignore=${SOURCE_DIR}/.cvsignore
801 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
802 echo "$1" >> $cvsignore
808 update_shell_title "cvsup"
810 if [ -n "$CVSROOT" ]; then
811 OPTIONS="-d $CVSROOT $OPTIONS"
814 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
815 OPTIONS="$OPTIONS -A"
817 if [ -n "$CVSDATE" ]; then
818 OPTIONS="$OPTIONS -D $CVSDATE"
820 if [ -n "$CVSTAG" ]; then
821 OPTIONS="$OPTIONS -r $CVSTAG"
826 local retries_counter=0
828 update_shell_title "cvsup: $*"
830 update_shell_title "cvsup: $# files"
832 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
833 retries_counter=$(( $retries_counter + 1 ))
834 output=$(LC_ALL=C cvs $OPTIONS "$@" 2>&1)
836 [ -n "$output" ] && echo "$output"
837 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
838 echo "Trying again [$*]... ($retries_counter)"
839 update_shell_title "cvsup: retry #$retries_counter"
846 update_shell_title "cvsup: done!"
850 # returns true if "$1" is ftp, http or https protocol url
854 ftp://*|http://*|https://*)
863 if [ $# -eq 0 ]; then
867 update_shell_title "update md5"
868 if [ -n "$DEBUG" ]; then
875 # pass 1: check files to be fetched
879 local fp=$(nourl "$i")
880 local srcno=$(src_no "$i")
881 if [ -n "$ADD5" ]; then
882 [ "$fp" = "$i" ] && continue # FIXME what is this check doing?
883 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE && continue
884 grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE && continue
886 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE || continue
888 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
889 need_files="$need_files $i"
893 # pass 1a: get needed files
894 if [ "$need_files" ]; then
895 get_files $need_files
898 # pass 2: proceed with md5 adding or updating
900 local fp=$(nourl "$i")
901 local srcno=$(src_no "$i")
902 local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE )
903 if [ -z "$md5" ]; then
904 md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE )
906 if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
907 local tag="# Source$srcno-md5:\t"
908 if [[ "$md5" == *NoSource* ]]; then
909 tag="# NoSource$srcno-md5:\t"
910 elif [ -n "$USEDIGEST" ]; then
911 tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
913 md5=$(md5sum "$fp" | cut -f1 -d' ')
914 echo "Updating $tag ($md5: $fp)."
916 print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
917 print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
926 update_shell_title "check md5"
929 if good_md5 "$i" && good_size "$i"; then
933 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
934 echo "or -5 to update md5 sums, if you're sure files are correct."
935 Exit_error err_no_source_in_repo $i
941 update_shell_title "get_files"
943 if [ -n "$DEBUG" ]; then
948 if [ $# -gt 0 ]; then
951 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
952 echo "Warning: No CVS access defined for SOURCES"
957 local get_files_cvs=""
961 SHELL_TITLE_PREFIX="get_files[$nc/$#]"
962 update_shell_title "$i"
963 local fp=`nourl "$i"`
964 if [ "$SKIP_EXISTING_FILES" = "yes" ] && [ -f "$fp" ]; then
969 local srcmd5=$(src_md5 "$i")
971 # we know if source/patch is present in cvs/distfiles
972 # - has md5 (in distfiles)
975 # CHECK: local file didn't exist or always cvs up (first) requested.
976 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
977 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
978 echo "Warning: no URL given for $i"
981 if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
982 if good_md5 "$i" && good_size "$i"; then
983 echo "$fp having proper md5sum already exists"
988 # optionally prefer mirror over distfiles if there's mirror
989 # TODO: build url list and then try each url from the list
990 if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
993 url=$(distfiles_url "$i")
996 url_attic=$(distfiles_attic_url "$i")
998 # is $url local file?
999 if [[ "$url" = [./]* ]]; then
1000 update_shell_title "${GETLOCAL%% *}: $url"
1001 ${GETLOCAL} $url $target
1003 if [ -z "$NOMIRRORS" ]; then
1004 url=$(find_mirror "$url")
1008 # make shorter message for distfiles urls
1009 if [[ "$uri" = ${PROTOCOL}${DISTFILES_SERVER}* ]] || [[ "$uri" = ${PROTOCOL}${ATTICDISTFILES_SERVER}* ]]; then
1010 uri=${uri#${PROTOCOL}${DISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1011 uri=${uri#${PROTOCOL}${ATTICDISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1014 update_shell_title "${GETURI%% *}: $uri"
1015 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1016 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1017 update_shell_title "${GETURI2%% *}: $url"
1018 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1023 if [ ! -s "$target" ]; then
1025 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
1026 update_shell_title "${GETLOCAL%% *}: $url_attic"
1027 ${GETLOCAL} $url_attic $target
1029 if [ -z "$NOMIRRORS" ]; then
1030 url_attic="`find_mirror "$url_attic"`"
1032 update_shell_title "${GETURI%% *}: $url_attic"
1033 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1034 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1035 update_shell_title "${GETURI2%% *}: $url_attic"
1036 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1041 if [ -s "$target" ]; then
1042 cvsignore_df $target
1047 elif [ "$NOCVS" != "yes" -a -z "$srcmd5" ]; then
1048 if [ $# -gt 1 ]; then
1049 get_files_cvs="$get_files_cvs $fp"
1050 update_shell_title "$fp (will cvs up later)"
1057 if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
1058 if [ -z "$NOMIRRORS" ]; then
1059 im="`find_mirror "$i"`"
1063 update_shell_title "${GETURI%% *}: $im"
1064 ${GETURI} "$im" || \
1065 if [ "`echo $im | grep -E 'ftp://'`" ]; then
1066 update_shell_title "${GETURI2%% *}: $im"
1071 if [ "$cvsup" = 1 ]; then
1077 # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
1078 if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
1079 if [ -n "GREEDSRC" ]; then
1080 get_greed_sources $i
1082 Exit_error err_no_source_in_repo $i
1086 # we check md5 here just only to refetch immediately
1087 if good_md5 "$i" && good_size "$i"; then
1089 elif [ "$FROM_DISTFILES" = 1 ]; then
1090 # wrong md5 from distfiles: remove the file and try again
1092 echo "MD5 sum mismatch. Trying full fetch."
1095 update_shell_title "${GETURI%% *}: $url"
1096 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1097 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1098 update_shell_title "${GETURI2%% *}: $url"
1099 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1101 if [ ! -s "$target" ]; then
1103 update_shell_title "${GETURI%% *}: $url_attic"
1104 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1105 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1106 update_shell_title "${GETURI2%% *}: $url_attic"
1107 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1110 test -s "$target" || rm -f "$target"
1113 SHELL_TITLE_PREFIX=""
1115 if [ "$get_files_cvs" ]; then
1116 cvsup $get_files_cvs
1119 if [ "$CHMOD" = "yes" ]; then
1120 CHMOD_FILES="`nourl "$@"`"
1121 if [ -n "$CHMOD_FILES" ]; then
1122 chmod $CHMOD_MODE $CHMOD_FILES
1129 if [ -n "$DEBUG" ]; then
1134 # Check whether first character of PACKAGE_NAME is legal for tag name
1135 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
1139 # NOTE: CVS tags may must not contain the characters `$,.:;@'
1140 TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
1142 # Remove #kernel.version_release from TAGVER because tagging sources
1143 # could occur with different kernel-headers than kernel-headers used at build time.
1144 # besides, %{_kernel_ver_str} is not expanded.
1146 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
1147 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
1157 if [ -n "$DEBUG" ]; then
1162 echo "Version: $PACKAGE_VERSION"
1163 echo "Release: $PACKAGE_RELEASE"
1166 if [ "$TAG_VERSION" = "yes" ]; then
1167 TAGVER=`make_tagver`
1168 echo "CVS tag: $TAGVER"
1170 if [ -n "$TAG" ]; then
1171 echo "CVS tag: $TAG"
1174 local OPTIONS="tag $CVS_FORCE"
1175 if [ -n "$CVSROOT" ]; then
1176 OPTIONS="-d $CVSROOT $OPTIONS"
1181 for i in $TAG_FILES; do
1182 # don't tag files stored on distfiles
1183 [ -n "`src_md5 $i`" ] && continue
1184 local fp=`nourl "$i"`
1185 if [ -f "$fp" ]; then
1186 tag_files="$tag_files $fp"
1187 elif [ -n "GREEDSRC" ]; then
1188 get_greed_sources $i
1190 Exit_error err_no_source_in_repo $i
1194 if [ "$tag_files" ]; then
1195 if [ "$TAG_VERSION" = "yes" ]; then
1196 update_shell_title "tag sources: $TAGVER"
1197 printf "Tagging %d files\n" $(echo $tag_files | wc -w)
1198 cvs $OPTIONS $TAGVER $tag_files || exit
1200 if [ -n "$TAG" ]; then
1201 update_shell_title "tag sources: $TAG"
1203 while [ "$tag_files" ]; do
1204 local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
1205 printf "Tagging %d files\n" $(echo $chunk | wc -w)
1206 cvs $OPTIONS $TAG $chunk || exit
1207 tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
1213 if [ "$TAG_VERSION" = "yes" ]; then
1214 update_shell_title "tag spec: $TAGVER"
1215 cvs $OPTIONS $TAGVER $SPECFILE || exit
1217 if [ -n "$TAG" ]; then
1218 update_shell_title "tag spec: $TAG"
1219 cvs $OPTIONS $TAG $SPECFILE || exit
1226 echo "CVS branch tag: $TAG"
1231 if [ -n "$DEBUG" ]; then
1236 local OPTIONS="tag $CVS_FORCE -b"
1237 if [ -n "$CVSROOT" ]; then
1238 OPTIONS="-d $CVSROOT $OPTIONS"
1242 for i in $TAG_FILES; do
1243 local fp=`nourl "$i"`
1244 if [ -f "$fp" ]; then
1245 tag_files="$tag_files $fp"
1246 elif [ -n "GREEDSRC" ]; then
1247 get_greed_sources $i
1249 Exit_error err_no_source_in_repo $i
1252 if [ "$tag_files" ]; then
1253 cvs $OPTIONS $TAG $tag_files || exit
1257 cvs $OPTIONS $TAG $SPECFILE || exit
1261 # this function should exit early if package can't be built for this arch
1262 # this avoids unneccessary BR filling.
1265 out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
1267 if [ $ret -ne 0 ]; then
1276 update_shell_title "build_package"
1277 if [ -n "$DEBUG" ]; then
1284 if [ -n "$TRY_UPGRADE" ]; then
1285 update_shell_title "build_package: try_upgrade"
1286 if [ -n "$FLOAT_VERSION" ]; then
1287 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
1289 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
1292 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
1294 if [ -n "$TNEWVER" ]; then
1295 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
1296 echo "New version found, updating spec file to version " $TNEWVER
1297 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1298 cp -f $SPECFILE $SPECFILE.bak
1301 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
1302 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
1304 NODIST="yes" get_files $SOURCES $PATCHES
1307 unset TOLDVER TNEWVER TNOTIFY
1314 BUILD_SWITCH="-ba" ;;
1316 BUILD_SWITCH="-bb" ;;
1318 BUILD_SWITCH="-bs --nodeps" ;;
1320 BUILD_SWITCH="-bp --nodeps" ;;
1322 BUILD_SWITCH="-bc" ;;
1324 BUILD_SWITCH="-bi" ;;
1326 BUILD_SWITCH="-bl" ;;
1330 update_shell_title "build_package: $COMMAND"
1331 if [ -n "$LOGFILE" ]; then
1332 LOG=`eval echo $LOGFILE`
1333 if [ -d "$LOG" ]; then
1334 echo "Log file $LOG is a directory."
1335 echo "Parse error in the spec?"
1336 Exit_error err_build_fail
1338 if [ -n "$LASTLOG_FILE" ]; then
1339 echo "LASTLOG=$LOG" > $LASTLOG_FILE
1341 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
1342 (time eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
1343 RETVAL=`cat $RES_FILE`
1345 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
1346 if [ "$RETVAL" -eq "0" ]; then
1353 eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE
1356 if [ "$RETVAL" -ne "0" ]; then
1357 if [ -n "$TRY_UPGRADE" ]; then
1358 echo "\n!!! Package with new version cannot be built automagically\n"
1359 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1360 mv -f $SPECFILE.bak $SPECFILE
1363 Exit_error err_build_fail
1370 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1373 install_required_packages()
1380 # taken from find-spec-bcond, but with just getting the list
1382 # quick revert hint: '$RPMBUILD --bcond $SPEC'
1384 /^%changelog/ { exit }
1385 /_with(out)?_[_a-zA-Z0-9]+/{
1386 match($0, /_with(out)?_[_a-zA-Z0-9]+/);
1387 print substr($0, RSTART, RLENGTH);
1390 match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
1391 bcond = substr($0, RSTART +5 , RLENGTH -5);
1392 gsub(/[ \t]+/,"_",bcond);
1394 }' $SPEC | LC_ALL=C sort -u
1398 # expand bconds from ~/.bcondrc
1399 # The file structure is like gentoo's package.use:
1402 # samba -mysql -pgsql
1403 # w32codec-installer license_agreement
1406 if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
1412 SN=${SPECFILE%%\.spec}
1414 local bcondrc=$HOME/.bcondrc
1415 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
1417 local bcond_avail=$(find_spec_bcond $SPECFILE)
1419 while read pkg flags; do
1421 [[ "$pkg" == \#* ]] && continue
1423 # any package or current package?
1424 if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
1425 for flag in $flags; do
1426 local opt=${flag#[+-]}
1428 # use only flags which are in this package.
1429 if [[ $bcond_avail = *${opt}* ]]; then
1430 if [[ $flag = -* ]]; then
1431 if [[ $BCOND != *--with?${opt}* ]]; then
1432 BCOND="$BCOND --without $opt"
1435 if [[ $BCOND != *--without?${opt}* ]]; then
1436 BCOND="$BCOND --with $opt"
1443 update_shell_title "parse ~/.bcondrc: DONE!"
1448 update_shell_title "set bcond values"
1450 AVAIL_BCONDS_WITHOUT=""
1451 AVAIL_BCONDS_WITH=""
1452 if `grep -q ^%bcond ${SPECFILE}`; then
1454 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
1460 local bcond_avail=$(find_spec_bcond $SPECFILE)
1461 process_bcondrc "$SPECFILE"
1463 update_shell_title "parse bconds"
1464 case "${BCOND_VERSION}" in
1469 echo "Warning: This spec has old style bconds. Fix it || die."
1470 for opt in `echo "$bcond_avail" | grep ^_without_`
1472 AVAIL_BCOND_WITHOUT=${opt#_without_}
1473 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1474 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1476 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1480 for opt in `echo "$bcond_avail" | grep ^_with_`
1482 AVAIL_BCOND_WITH=${opt#_with_}
1483 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1484 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1486 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1491 local cond_type="" # with || without
1492 for opt in $bcond_avail; do
1501 AVAIL_BCOND_WITHOUT=${opt#_without_}
1502 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1503 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1505 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1509 AVAIL_BCOND_WITH=${opt#_with_}
1510 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1511 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1513 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1517 case "$cond_type" in
1520 AVAIL_BCOND_WITH="$opt"
1521 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1522 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1524 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1529 AVAIL_BCOND_WITHOUT="$opt"
1530 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1531 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1533 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1547 update_shell_title "run_sub_builder $package_name"
1549 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1550 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1551 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1552 # jakby nie bylo tego kawalka kodu.
1554 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1555 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1562 # Istnieje taki spec? ${package}.spec
1563 if [ -f "${SPEC_DIR}/${package}.spec" ]; then
1564 parent_spec_name=${package}.spec
1565 elif [ -f "${SPEC_DIR}/`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1566 parent_spec_name="`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1568 for provides_line in `grep ^Provides:.*$package ${SPEC_DIR} -R`
1574 if [ "${parent_spec_name}" != "" ]; then
1575 spawn_sub_builder $parent_spec_name
1577 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1583 update_shell_title "spawn_sub_builder $package_name"
1586 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1587 sub_builder_opts="${sub_builder_opts} -R"
1589 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1590 sub_builder_opts="${sub_builder_opts} -RB"
1591 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1592 sub_builder_opts="${sub_builder_opts} -FRB"
1594 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1595 sub_builder_opts="${sub_builder_opts} -Upi"
1599 ./builder ${sub_builder_opts} "$@"
1602 remove_build_requires()
1604 if [ "$INSTALLED_PACKAGES" != "" ]; then
1605 case "$REMOVE_BUILD_REQUIRES" in
1607 run_poldek --noask -ve $INSTALLED_PACKAGES
1610 run_poldek --ask -ve $INSTALLED_PACKAGES
1613 echo You may want to manually remove following BuildRequires fetched:
1614 echo $INSTALLED_PACKAGES
1615 echo "Try poldek -e \`cat $(pwd)/.${SPECFILE}_INSTALLED_PACKAGES\`"
1623 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1624 if [ "$BCOND" != "" ]; then
1625 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1628 echo -ne "\nNo conditional flags passed"
1630 echo -ne "\n\nfrom available:\n"
1631 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1637 if [ "$NOCVSSPEC" != "yes" ]; then
1638 echo -ne "Available branches: "
1639 cvs status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
1643 # checks a given list of packages/files/provides agains current rpmdb.
1644 # outputs all dependencies whcih current rpmdb doesn't satisfy.
1645 # input can be either STDIN or parameters
1650 if [ "$#" -gt 0 ]; then
1656 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
1659 echo "$DEPS" | awk '/^no package provides/ { print $NF }'
1661 # other deps (files)
1662 echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
1665 # checks if given package/files/provides exists in rpmdb.
1666 # inout can be either stdin or parameters
1667 # returns packages wchi hare present in the rpmdb
1672 if [ "$#" -gt 0 ]; then
1678 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
1681 fetch_build_requires()
1683 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1684 update_shell_title "fetch build requires"
1685 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ] || [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1686 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1687 # TODO: Conflicts list doesn't check versions
1688 local CNFL=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
1689 local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
1691 if [ "$FETCH_BUILD_REQUIRES_RPMSPECSRPM" = "yes" ]; then
1692 local CNFL=$(rpm -q --specsrpm --conflicts $BCOND $SPECFILE | awk '{print $1}' | _rpm_cnfl_check | xargs)
1693 local DEPS=$(rpm -q --specsrpm --requires $BCOND $SPECFILE | awk '{print $1}' | _rpm_prov_check | xargs)
1696 if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
1697 echo "fetch builderequires: install [$DEPS]; remove [$CNFL]"
1698 update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
1699 $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
1701 if [ -n "$CNFL" ]; then
1702 update_shell_title "uninstall conflicting packages: $CNFL"
1703 echo "Trying to uninstall conflicting packages ($CNFL):"
1704 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CNFL
1707 while [ "$DEPS" ]; do
1708 update_shell_title "install deps: $DEPS"
1709 echo "Trying to install dependencies ($DEPS):"
1710 local log=.${SPECFILE}_poldek.log
1711 $SU_SUDO /usr/bin/poldek --caplookup -uGq $DEPS | tee $log
1712 failed=$(awk -F: '/^error:/{print $2}' $log)
1715 if [ -n "$failed" ]; then
1716 for package in $failed; do
1717 # FIXME: sanitise, deps could be not .spec files
1718 spawn_sub_builder -bb $package && ok="$ok $package"
1728 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1729 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1730 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1731 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1732 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1733 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`
1735 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`"
1737 package=`basename "$package_item"|sed -e "s/}$//g"`
1738 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1741 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1742 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1743 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
1748 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1751 if `echo $COND_TST|grep -q 'without_'`; then
1752 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1753 if `echo $COND_TST|grep -q !`; then
1758 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1759 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1760 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1766 elif `echo $COND_TST|grep -q 'with_'`; then
1767 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1768 if `echo $COND_TST|grep -q !`; then
1773 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1774 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1775 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1781 RESULT="${COND_STATE}-${COND_ARGV}"
1783 "with-wout" | "wout-with" )
1786 "wout-wout" | "with-with" )
1790 echo "Action '$RESULT' was not defined for package '$package_item'"
1796 if [ "$GO" = "yes" ]; then
1797 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1798 echo "Testing if $package has subrequirements..."
1799 run_poldek -t -i $package --dumpn=".$package-req.txt"
1800 if [ -f ".$package-req.txt" ]; then
1801 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1803 if [ "$package_name" = "$package" ]; then
1804 echo -ne "Installing BuildRequired package:\t$package_name\n"
1805 update_shell_title "Installing BuildRequired package: ${package_name}"
1806 install_required_packages $package
1808 echo -ne "Installing (sub)Required package:\t$package_name\n"
1809 update_shell_title "Installing (sub)Required package: ${package_name}"
1810 install_required_packages $package_name
1814 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1815 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1818 echo "Attempting to run spawn sub - builder..."
1819 echo -ne "Package installation failed:\t$package_name\n"
1820 run_sub_builder $package_name
1821 if [ $? -eq 0 ]; then
1822 install_required_packages $package_name
1825 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1826 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1829 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1836 rm -f ".$package-req.txt"
1838 echo "Attempting to run spawn sub - builder..."
1839 echo -ne "Package installation failed:\t$package\n"
1840 run_sub_builder $package
1841 if [ $? -eq 0 ]; then
1842 install_required_packages $package
1845 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1846 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1849 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1855 echo "Package $package is already installed. BuildRequirement satisfied."
1859 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1860 echo "Unable to install following packages and their dependencies:"
1861 for pkg in "$NOT_INSTALLED_PACKAGES"
1865 remove_build_requires
1873 TOP_DIR="`eval $RPM $RPMOPTS --eval '%{_topdir}'`"
1874 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1876 mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
1878 cvs -d $CVSROOT co SOURCES/.cvsignore SPECS/{mirrors,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
1882 echo "To checkout *all* .spec files:"
1883 echo "- remove $SPEC_DIR/CVS/Entries.Static"
1884 echo "- run cvs up in $SPEC_DIR dir"
1887 echo "To commit with your developer account:"
1888 echo "- edit $SPEC_DIR/CVS/Root"
1889 echo "- edit $SOURCE_DIR/CVS/Root"
1892 get_greed_sources() {
1893 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1894 if [ -n "BE_VERBOSE" ]; then
1895 echo "Try greed download: $1 from: $CVSROOT"
1897 cvs -d $CVSROOT get SOURCES/$1
1898 if [ $? != 0 ]; then
1899 Exit_error err_no_source_in_repo $1
1904 # remove entries from CVS/Entries
1905 cvs_entry_remove() {
1906 local cvsdir="$1"; shift
1907 if [ ! -d "$cvsdir" ]; then
1908 echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
1912 for file in "$@"; do
1913 rm -f $cvsdir/CVS/Entries.new || return 1
1914 awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
1915 mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
1923 DONT_PRINT_REVISION="yes"
1927 # remove from CVS/Entries
1928 cvs_entry_remove $SPEC_DIR $SPECFILE
1929 cvs_entry_remove $SOURCE_DIR $SOURCES $PATCHES
1931 # remove spec and sources
1932 $RPMBUILD --clean --rmsource --rmspec --nodeps $SPECFILE
1935 #---------------------------------------------
1943 while [ $# -gt 0 ]; do
1946 COMMAND="update_md5"
1951 COMMAND="update_md5"
1961 DEBUG="yes"; shift ;;
1963 COMMAND="version"; shift ;;
1965 COMMAND="short-version"; shift ;;
1967 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
1968 -b | -ba | --build )
1969 COMMAND="build"; shift ;;
1970 -bb | --build-binary )
1971 COMMAND="build-binary"; shift ;;
1973 COMMAND="build-build"; shift ;;
1975 COMMAND="build-install"; shift ;;
1977 COMMAND="build-list"; shift ;;
1978 -bp | --build-prep )
1979 COMMAND="build-prep"; shift ;;
1980 -bs | --build-source )
1981 COMMAND="build-source"; shift ;;
1983 COMMAND="branch"; shift; TAG="${1}"; shift;;
1985 CLEAN="--clean --rmspec --rmsource"; shift ;;
1987 CVS_FORCE="-F"; shift;;
1989 shift; CVSROOT="${1}"; shift ;;
1991 COMMAND="get"; shift ;;
1993 COMMAND="usage"; shift ;;
1995 PROTOCOL="http"; shift ;;
1997 shift; LOGFILE="${1}"; shift ;;
1999 shift; DEF_NICE_LEVEL=${1}; shift ;;
2000 -ske | --skip-existing-files)
2001 SKIP_EXISTING_FILES="yes"; shift ;;
2003 COMMAND="mr-proper"; shift ;;
2005 NOCVS="yes"; shift ;;
2006 -ncs | --no-cvs-specs )
2007 NOCVSSPEC="yes"; shift ;;
2008 -nd | --no-distfiles )
2009 NODIST="yes"; shift ;;
2010 -nm | --no-mirrors )
2011 NOMIRRORS="yes"; shift ;;
2013 NOURLS="yes"; shift ;;
2015 NOSRCS="yes"; shift ;;
2016 -ns0 | --no-source0 )
2017 NOSOURCE0="yes"; shift ;;
2027 -pm | --prefer-mirrors )
2034 shift; RPMOPTS="${RPMOPTS} ${1}"; shift ;;
2036 shift; RPMOPTS="${RPMOPTS} --define \"patch${1} : ignoring patch${1}; exit 1; \""; shift ;;
2037 --with | --without )
2038 case $GROUP_BCONDS in
2042 while ! `echo ${1}|grep -qE '(^-|spec)'`
2044 BCOND="$BCOND $COND $1"
2048 if [[ "$2" = *,* ]]; then
2049 for a in $(echo "$2" | tr , ' '); do
2050 BCOND="$BCOND $1 $a"
2053 BCOND="$BCOND $1 $2"
2059 shift; TARGET="${1}"; shift ;;
2061 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
2063 QUIET="--quiet"; shift ;;
2065 CVSDATE="${2}"; shift 2 ;;
2067 shift; CVSTAG="${1}"; shift ;;
2069 shift; CVSTAG="HEAD"; ;;
2070 -R | --fetch-build-requires)
2071 FETCH_BUILD_REQUIRES="yes"
2072 NOT_INSTALLED_PACKAGES=
2074 -RB | --remove-build-requires)
2075 REMOVE_BUILD_REQUIRES="nice"
2077 -FRB | --force-remove-build-requires)
2078 REMOVE_BUILD_REQUIRES="force"
2080 -sc | --sources-cvs)
2081 COMMAND="list-sources-cvs"
2083 -sd | --sources-distfiles)
2084 COMMAND="list-sources-distfiles"
2086 -sdp | --sources-distfiles-paths)
2087 COMMAND="list-sources-distfiles-paths"
2089 -sf | --sources-files)
2090 COMMAND="list-sources-files"
2092 -sp | --sources-paths)
2093 COMMAND="list-sources-local-paths"
2095 -su | --sources-urls)
2096 COMMAND="list-sources-urls"
2098 -Tvs | --tag-version-stable )
2103 -Ts | --tag-stable )
2108 -Tv | --tag-version )
2113 -Tp | --tag-prefix )
2125 -ir | --integer-release-only )
2126 INTEGER_RELEASE="yes"
2129 COMMAND="update_md5"
2134 -Upi | --update-poldek-indexes )
2135 UPDATE_POLDEK_INDEXES="yes"
2138 COMMAND="init_rpm_dir"
2140 --use-greed-sources )
2143 -u | --try-upgrade )
2144 TRY_UPGRADE="1"; shift ;;
2145 -un | --try-upgrade-with-float-version )
2146 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
2148 BE_VERBOSE="1"; shift ;;
2153 if echo "${MACRO}" | grep -q '\W'; then
2154 RPMOPTS="${RPMOPTS} --define \"${MACRO}\""
2158 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
2163 RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
2167 RPMBUILDOPTS="${RPMBUILDOPTS} --short-circuit"
2170 --show-bconds | -show-bconds | -print-bconds | --print-bconds | -display-bconds | --display-bconds )
2171 COMMAND="show_bconds"
2175 COMMAND="show_bcond_args"
2180 RPMOPTS="${RPMOPTS} --nodeps"
2183 RPMBUILDOPTS="${RPMBUILDOPTS} -debug"; shift
2186 Exit_error err_invalid_cmdline "$1"
2190 # check if specname was passed as specname:cvstag
2191 if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
2192 CVSTAG="${SPECFILE##*:}"
2193 SPECFILE="${SPECFILE%%:*}"
2195 ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
2200 if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then
2201 CVSTAG=$(awk -vSPECFILE="${SPECFILE%.spec}.spec" -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries)
2202 if [ "$CVSTAG" ]; then
2203 echo >&2 "builder: Stick tag $CVSTAG active. Use -r TAGNAME to override."
2205 elif [ "$CVSTAG" = "HEAD" ]; then
2206 # assume -r HEAD is same as -A
2210 if [ -n "$DEBUG" ]; then
2215 if [ -n "$TARGET" ]; then
2218 TARGET_SWITCH="--target $TARGET" ;;
2220 TARGET_SWITCH="--target=$TARGET" ;;
2224 if [ "$SCHEDTOOL" != "no" ]; then
2225 NICE_COMMAND="$SCHEDTOOL"
2227 NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
2230 update_shell_title "$COMMAND"
2234 if [ -n "$SPECFILE" ]; then
2235 get_spec > /dev/null
2243 if [ -n "$SPECFILE" ]; then
2244 get_spec > /dev/null
2250 "build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
2252 if [ -n "$SPECFILE" ]; then
2258 if [ "$COMMAND" != "build-source" ]; then
2261 fetch_build_requires
2262 if [ "$INTEGER_RELEASE" = "yes" ]; then
2263 echo "Checking release $PACKAGE_RELEASE..."
2264 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
2265 Exit_error err_fract_rel "$PACKAGE_RELEASE"
2269 # ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
2270 if [ -n "$TEST_TAG" ]; then
2271 # - do not allow utf8 encoded specs on AC-branch
2272 if [ "$CVSTAG" = "AC-branch-disabled" ]; then
2274 t=$(grep '^Summary(.*\.UTF-8):' $SPECFILE)
2276 Exit_error err_acl_deny "UTF-8 .specs not allowed on $CVSTAG"
2280 local TAGVER=`make_tagver`
2281 echo "Searching for tag $TAGVER..."
2282 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
2283 if [ -n "$TAGREL" ]; then
2284 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
2287 # - do not allow to build from HEAD when XX-branch exists
2288 TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
2289 if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
2290 TAG_BRANCH="${TREE_PREFIX}-branch"
2291 TAG_STATUS=$(cvs status -v $SPECFILE | grep -Ei "${TAG_BRANCH}.+(branch: [0-9.]+)")
2292 if [ -n "$TAG_STATUS" -a "$CVSTAG" = "HEAD" ]; then
2293 Exit_error err_branch_exists "$TAG_STATUS"
2299 if [ -n "$NOSOURCE0" ] ; then
2300 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2302 get_files $SOURCES $PATCHES
2305 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
2306 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
2308 remove_build_requires
2310 Exit_error err_no_spec_in_cmdl
2315 if [ -n "$SPECFILE" ]; then
2318 # don't fetch sources from remote locations
2320 for file in $SOURCES; do
2321 [ -n "`src_md5 $file`" ] && continue
2322 new_SOURCES="$new_SOURCES $file"
2324 SOURCES="$new_SOURCES"
2325 get_files $SOURCES $PATCHES
2327 branch_files $TAG $SOURCES $PATCHES $ICONS
2329 Exit_error err_no_spec_in_cmdl
2334 if [ -n "$SPECFILE" ]; then
2338 if [ -n "$NOSOURCE0" ] ; then
2339 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2341 get_files $SOURCES $PATCHES
2344 Exit_error err_no_spec_in_cmdl
2349 if [ -n "$SPECFILE" ]; then
2353 if [ -n "$NOSOURCE0" ] ; then
2354 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2358 Exit_error err_no_spec_in_cmdl
2365 if [ -n "$SPECFILE" ]; then
2369 # don't fetch sources from remote locations
2371 for file in $SOURCES; do
2372 [ -n "`src_md5 $file`" ] && continue
2373 new_SOURCES="$new_SOURCES $file"
2375 SOURCES="$new_SOURCES"
2376 get_files $SOURCES $PATCHES
2378 tag_files $SOURCES $PATCHES $ICONS
2380 Exit_error err_no_spec_in_cmdl
2386 "list-sources-files" )
2389 DONT_PRINT_REVISION="yes"
2392 for SAP in $SOURCES $PATCHES; do
2393 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2396 "list-sources-urls" )
2399 DONT_PRINT_REVISION="yes"
2402 SAPS="$SOURCES $PATCHES"
2403 for SAP in $SAPS ; do
2407 "list-sources-local-paths" )
2410 DONT_PRINT_REVISION="yes"
2413 for SAP in $SOURCES $PATCHES; do
2414 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
2417 "list-sources-distfiles-paths" )
2420 DONT_PRINT_REVISION="yes"
2423 for SAP in $SOURCES $PATCHES; do
2424 if [ -n "$(src_md5 "$SAP")" ]; then
2425 distfiles_path "$SAP"
2429 "list-sources-distfiles" )
2432 DONT_PRINT_REVISION="yes"
2435 for SAP in $SOURCES $PATCHES; do
2436 if [ -n "$(src_md5 "$SAP")" ]; then
2437 distfiles_url "$SAP"
2441 "list-sources-cvs" )
2444 DONT_PRINT_REVISION="yes"
2447 for SAP in $SOURCES $PATCHES; do
2448 if [ -z "$(src_md5 "$SAP")" ]; then
2449 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2463 echo "$VERSIONSTRING"
2466 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
2467 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
2471 # vi:syntax=sh:ts=4:sw=4:noet