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 [ -x /usr/bin/rpm-getdeps ]; then
117 FETCH_BUILD_REQUIRES_RPMGETDEPS="yes"
119 FETCH_BUILD_REQUIRES_RPMGETDEPS="no"
122 # Here we load saved user environment used to
123 # predefine options set above, or passed to builder
125 # This one reads global system environment settings:
126 if [ -f ~/etc/builderrc ]; then
129 # And this one cascades settings using user personal
131 # Example of ~/.builderrc:
133 #UPDATE_POLDEK_INDEXES="yes"
134 #FETCH_BUILD_REQUIRES="yes"
135 #REMOVE_BUILD_REQUIRES="force"
137 #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
141 if [ -n "$HOME_ETC" ]; then
142 USER_CFG="$HOME_ETC/.builderrc"
143 BUILDER_MACROS="$HOME_ETC/.builder-rpmmacros"
145 USER_CFG=~/.builderrc
146 BUILDER_MACROS=~/.builder-rpmmacros
149 [ -f "$USER_CFG" ] && . "$USER_CFG"
151 if [ "$SCHEDTOOL" = "auto" ]; then
152 if [ -x /usr/bin/schedtool ] && schedtool -B -e echo >/dev/null; then
153 SCHEDTOOL="schedtool -B -e"
159 if [ -n "$USE_PROZILLA" ]; then
160 GETURI="proz --no-getch -r -P ./ -t$WGET_RETRIES $PROZILLA_OPTS"
163 elif [ -n "$USE_AXEL" ]; then
164 GETURI="axel -a $AXEL_OPTS"
168 wget --help 2>&1 | grep -q -- ' --no-check-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
169 wget --help 2>&1 | grep -q -- ' --inet ' && WGET_OPTS="$WGET_OPTS --inet"
170 wget --help 2>&1 | grep -q -- ' --retry-connrefused ' && WGET_OPTS="$WGET_OPTS --retry-connrefused"
171 WGET_OPTS="$WGET_OPTS --user-agent=$USER_AGENT"
173 GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES $WGET_OPTS"
174 GETURI2="wget -c -nd -t$WGET_RETRIES $WGET_OPTS"
180 if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
188 POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
189 POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
193 RES_FILE=~/tmp/poldek-exit-status.$RANDOM
194 if [ -n "$LOGFILE" ]; then
195 LOG=`eval echo $LOGFILE`
196 if [ -n "$LASTLOG_FILE" ]; then
197 echo "LASTLOG=$LOG" > $LASTLOG_FILE
199 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee -a $LOG
202 (${NICE_COMMAND} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
203 return `cat ${RES_FILE}`
208 #---------------------------------------------
213 if [ -n "$DEBUG" ]; then set -xv; fi
215 Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
216 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
217 [{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
218 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
219 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
220 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
221 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
222 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
223 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
224 <package>[.spec][:cvstag]
226 -5, --update-md5 - update md5 comments in spec, implies -nd -ncs
227 -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd -ncs
228 -n5, --no-md5 - ignore md5 comments in spec
229 -D, --debug - enable builder script debugging mode,
230 -debug - produce rpm debug package (same as --opts -debug)
231 -V, --version - output builder version string
232 --short-version - output builder short version
233 -a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
234 -b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
236 -bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
237 only package from <package>.spec,
238 -bp, --build-prep - execute the %prep phase of <package>.spec,
239 -bc - execute the %build phase of <package>.spec,
240 -bi - execute the %install phase of <package>.spec
241 -bl - execute the %files phase of <package>.spec
242 -bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
244 --short-circuit - short-circuit build
245 -B, --branch - add branch
246 -c, --clean - clean all temporarily created files (in BUILD, SOURCES,
247 SPECS and \$RPM_BUILD_ROOT and CVS/Entries) after rpmbuild commands.
248 -m, --mr-proper - clean all temporarily created files (in BUILD, SOURCES,
249 SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
251 -cf, --cvs-force - use -F when tagging (useful when moving branches)
252 -d <cvsroot>, --cvsroot <cvsroot>
254 --define <macro> <value>
255 - define a macro <macro> with value <value>,
256 --alt_kernel <kernel>
257 - same as --define 'alt_kernel <kernel>'
258 --nodeps - rpm won't check any dependences
259 -g, --get - get <package>.spec and all related files from CVS repo
261 -h, --help - this message,
262 --http - use http instead of ftp,
263 -l <logfile>, --logtofile <logfile>
265 -nc, --no-cvs - don't download sources from CVS, if source URL is given,
267 - don't check specs in CVS
268 -nd, --no-distfiles - don't download from distfiles
269 -nm, --no-mirrors - don't download from mirror, if source URL is given,
270 -nu, --no-urls - don't try to download from FTP/HTTP location,
271 -ns, --no-srcs - don't download Sources
272 -ns0, --no-source0 - don't download Source0
273 -nn, --no-net - don't download anything from the net
274 -pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
275 --no-init - don't initialize builder paths (SPECS and SOURCES)
277 --skip-existing-files - skip existing files in get_files
278 --opts <rpm opts> - additional options for rpm
279 -q, --quiet - be quiet,
280 --date yyyy-mm-dd - build package using resources from specified CVS date,
281 -r <cvstag>, --cvstag <cvstag>
282 - build package using resources from specified CVS tag,
283 -A - build package using CVS resources as any sticky tags/date/kopts being reset.
284 -R, --fetch-build-requires
285 - fetch what is BuildRequired,
286 -RB, --remove-build-requires
287 - remove all you fetched with -R or --fetch-build-requires
288 remember, this option requires confirmation,
289 -FRB, --force-remove-build-requires
290 - remove all you fetched with -R or --fetch-build-requires
291 remember, this option works without confirmation,
292 -sd, --source-distfiles - list sources available from distfiles (intended for offline
293 operations; does not work when Icon field is present
294 but icon file is absent),
295 -sc, --source-cvs - list sources available from CVS
296 -sdp, --source-distfiles-paths - list sources available from distfiles -
297 paths relative to distfiles directory (intended for offline
298 operations; does not work when Icon field is present
299 but icon file is absent),
300 -sf, --source-files - list sources - bare filenames (intended for offline
301 operations; does not work when Icon field is present
302 but icon file is absent),
303 -sp, --source-paths - list sources - filenames with full local paths (intended for
304 offline operations; does not work when Icon field is present
305 but icon file is absent),
306 -su, --source-urls - list urls - urls to sources and patches
307 intended for copying urls with spec with lots of macros in urls
308 -T <cvstag> , --tag <cvstag>
309 - add cvs tag <cvstag> for files,
310 -Tvs, --tag-version-stable
311 - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
313 - add cvs tag STABLE for files,
315 - add cvs tag NAME-VERSION-RELEASE for files,
316 -Tp, --tag-prefix <prefix>
317 - add <prefix> to NAME-VERSION-RELEASE tags,
318 -tt, --test-tag <prefix>
319 - fail if tag is already present,
320 -ir, --integer-release-only
321 - allow only integer and snapshot releases
322 -v, --verbose - be verbose,
323 -u, --try-upgrade - check version, and try to upgrade package
324 -un, --try-upgrade-with-float-version
325 - as above, but allow float version
327 - try download source from tag head if don't find it in
329 -U, --update - refetch sources, don't use distfiles, and update md5 comments
330 -Upi, --update-poldek-indexes
331 - refresh or make poldek package index files.
332 -np, --nopatch <patchnumber>
333 - don't apply <patchnumber>
334 --show-bconds - show available conditional builds, which can be used
335 - with --with and/or --without switches.
336 --show-bcond-args - show active bconds, from ~/.bcondrc. this is used by
337 ./repackage.sh script. in other words, the output is
338 parseable by scripts.
339 --with/--without <feature>
340 - conditional build package depending on %_with_<feature>/
341 %_without_<feature> macro switch. You may now use
342 --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
343 constructions. Set GROUP_BCONDS to yes to make use of it.
344 --target <platform>, --target=<platform>
345 - build for platform <platform>.
346 --init-rpm-dir - initialize ~/rpm directory structure
350 update_shell_title() {
352 local len=${COLUMNS:-80}
353 local msg=$(echo "$*" | cut -c-$len)
355 if [ -n "$BE_VERBOSE" ]; then
356 echo >&2 "$(date +%s.%N) $*"
359 if [ "x$TITLECHANGE" == "xyes" -o "x$TITLECHANGE" == "x" ]; then
361 if [ -n "$PACKAGE_NAME" ]; then
362 pkg=${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_RELEASE}
367 msg="$pkg: ${SHELL_TITLE_PREFIX:+$SHELL_TITLE_PREFIX }$msg"
368 msg="$(echo $msg | tr -d '\n\r')"
371 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
374 echo >&2 -ne "\033]0;$msg\007"
380 # set TARGET from BuildArch: from SPECFILE
382 if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then
383 tmp=$(awk '/^BuildArch:/ { print $NF}' $SPECFILE)
385 target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}')
389 TARGET_SWITCH="--target ${TARGET}-${target_platform}" ;;
391 TARGET_SWITCH="--target=$TARGET" ;;
397 # runs rpm with minimal macroset
399 # we reset macros not to contain macros.build as all the %() macros are
400 # executed here, while none of them are actually needed.
401 # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
402 safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
404 # TODO: move these to /usr/lib/rpm/macros
405 cat > $BUILDER_MACROS <<'EOF'
406 %x8664 x86_64 amd64 ia32e
409 %requires_releq_kernel_up %{nil}
410 %requires_releq_kernel_smp %{nil}
411 %requires_releq_kernel %{nil}
412 %requires_releq() %{nil}
413 %pyrequires_eq() %{nil}
414 %requires_eq() %{nil}
415 %requires_eq_to() %{nil}
416 %releq_kernel_up ERROR
417 %releq_kernel_smp ERROR
422 %ruby_ver_requires_eq() %{nil}
423 %ruby_mod_ver_requires_eq() %{nil}
424 %__php_api_requires() %{nil}
425 %php_major_version ERROR
426 %php_api_version ERROR
427 %requires_xorg_xserver_extension %{nil}
428 %requires_xorg_xserver_xinput %{nil}
429 %requires_xorg_xserver_font %{nil}
430 %requires_xorg_xserver_videodrv %{nil}
432 %perl_vendorarch ERROR
433 %perl_vendorlib ERROR
434 # damn. need it here! - copied from /usr/lib/rpm/macros.build
435 %tmpdir %(echo "${TMPDIR:-/tmp}")
436 %patchset_source(f:b:) %(
437 base=%{-b*}%{!-b*:10000};
438 start=$(expr $base + %1);
439 end=$(expr $base + %{?2}%{!?2:%{1}});
440 # we need to call seq twice as it doesn't allow two formats
441 seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
442 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
443 paste %{tmpdir}/__ps{1,2};
444 rm -f %{tmpdir}/__ps{1,2};
448 if [ "$NOINIT" = "yes" ] ; then
449 cat >> $BUILDER_MACROS <<'EOF'
454 eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
458 if [ -n "$DEBUG" ]; then
463 update_shell_title "cache_rpm_dump"
466 # what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
467 dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
473 ARGS='--nodigest --nosignature --nobuild'
476 minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
478 if [ $? -gt 0 ]; then
479 error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
481 Exit_error err_build_fail
484 # make small dump cache
485 rpm_dump_cache=`echo "$rpm_dump" | awk '
486 $2 ~ /^SOURCEURL/ {print}
487 $2 ~ /^PATCHURL/ {print}
488 $2 ~ /^nosource/ {print}
489 $2 ~ /^PACKAGE_/ {print}
492 update_shell_title "cache_rpm_dump: OK!"
496 if [ -z "$rpm_dump_cache" ] ; then
497 echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
499 echo "$rpm_dump_cache"
504 update_shell_title "get icons"
505 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
506 if [ -z "$ICONS" ]; then
510 rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
515 update_shell_title "parsing specfile"
516 if [ -n "$DEBUG" ]; then
521 # icons are needed for successful spec parse
527 if [ "$NOSRCS" != "yes" ]; then
528 SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`"
531 if (rpm_dump | grep -qEi ":.*nosource.*1"); then
532 FAIL_IF_NO_SOURCES="no"
535 PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
536 ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
537 PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}')
538 PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
539 PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
541 if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
542 echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
545 if [ -n "$BE_VERBOSE" ]; then
546 echo "- Sources : `nourl $SOURCES`"
547 if [ -n "$PATCHES" ]; then
548 echo "- Patches : `nourl $PATCHES`"
550 echo "- Patches : *no patches needed*"
552 if [ -n "$ICONS" ]; then
553 echo "- Icon : `nourl $ICONS`"
555 echo "- Icon : *no package icon*"
557 echo "- Name : $PACKAGE_NAME"
558 echo "- Version : $PACKAGE_VERSION"
559 echo "- Release : $PACKAGE_RELEASE"
562 update_shell_title "parse_spec: OK!"
567 if [ -n "$DEBUG" ]; then
575 "err_no_spec_in_cmdl" )
576 remove_build_requires
577 echo "ERROR: spec file name not specified."
579 "err_invalid_cmdline" )
580 echo "ERROR: invalid command line arg ($2)."
582 "err_no_spec_in_repo" )
583 remove_build_requires
584 echo "Error: spec file not stored in CVS repo."
586 "err_no_source_in_repo" )
587 remove_build_requires
588 echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"
591 remove_build_requires
592 echo "Error: package build failed. (${2:-no more info})"
594 "err_no_package_data" )
595 remove_build_requires
596 echo "Error: couldn't get out package name/version/release from spec file."
599 remove_build_requires
600 echo "Tag ${2} already exists (spec release: ${3})."
603 remove_build_requires
604 echo "Release ${2} not integer and not a snapshot."
606 "err_branch_exists" )
607 remove_build_requires
608 echo "Tree branch already exists (${2})."
611 remove_build_requires
612 echo "Error: conditions reject building this spec (${2})."
615 echo "Unknown error."
621 if [ -n "$DEBUG" ]; then
626 if [ "$NOINIT" != "yes" ] ; then
628 if [ "$ASSUMED_NAME" ]; then
629 extra="--define 'name $ASSUMED_NAME'"
631 SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
632 SPEC_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
644 update_shell_title "get_spec"
646 if [ -n "$DEBUG" ]; then
652 if [ ! -f "$SPECFILE" ]; then
653 SPECFILE="`basename $SPECFILE .spec`.spec"
655 if [ "$NOCVSSPEC" != "yes" ]; then
657 if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
658 echo "Warning: No CVS access defined - using local .spec file"
662 cvsup "$SPECFILE" || Exit_error err_no_spec_in_repo
665 if [ ! -f "$SPECFILE" ]; then
666 Exit_error err_no_spec_in_repo
669 if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then
670 chmod $CHMOD_MODE $SPECFILE
673 [ -n "$DONT_PRINT_REVISION" ] || grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE
682 if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
683 cvs update mirrors >&2
687 local origin mirror name rest ol prefix
688 while read origin mirror name rest; do
689 # skip comments and empty lines
690 if [ -z "$origin" ] || [[ $origin == \#* ]]; then
693 ol=`echo -n "$origin"|wc -c`
694 prefix="`echo -n "$url" | head -c $ol`"
695 if [ "$prefix" = "$origin" ] ; then
696 suffix="`echo "$url"|cut -b $((ol+1))-`"
697 echo -n "$mirror$suffix"
704 # Warning: unpredictable results if same URL used twice
709 grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
710 sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
716 [ "$NO5" = "yes" ] && return
718 [ -z "$no" ] && return
722 if [ -f additional-md5sums ]; then
723 local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
724 if [ -z "$spec_rev" ]; then
725 spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
727 local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
728 md5=$(grep -s -v '^#' additional-md5sums | \
729 grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \
730 sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
731 grep -E '^[0-9a-f]{32}$')
734 if [ $(echo "$md5" | wc -l) != 1 ] ; then
735 echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
737 echo "$md5" | tail -n 1
742 source_md5=`grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
743 if [ -n "$source_md5" ]; then
746 source_md5=`grep -i "BuildRequires:[ ]*digest(%SOURCE$no)[ ]*=" $SPECFILE | sed -e 's/.*=//'`
747 if [ -n "$source_md5" ]; then
750 # we have empty SourceX-md5, but it is still possible
751 # that we have NoSourceX-md5 AND NoSource: X
752 nosource_md5=`grep -i "#[ ]*NoSource$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://'`
753 if [ -n "$nosource_md5" -a -n "`grep -i "^NoSource:[ ]*$no$" $SPECFILE`" ] ; then
762 echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
767 echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
770 distfiles_attic_url ()
772 echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
779 [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
784 size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
785 [ -n "$size" -a "$size" -gt 0 ]
790 if [ "$CVSIGNORE_DF" != "yes" ]; then
793 cvsignore=${SOURCE_DIR}/.cvsignore
794 if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
795 echo "$1" >> $cvsignore
801 update_shell_title "cvsup"
803 if [ -n "$CVSROOT" ]; then
804 OPTIONS="-d $CVSROOT $OPTIONS"
807 if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then
808 OPTIONS="$OPTIONS -A"
810 if [ -n "$CVSDATE" ]; then
811 OPTIONS="$OPTIONS -D $CVSDATE"
813 if [ -n "$CVSTAG" ]; then
814 OPTIONS="$OPTIONS -r $CVSTAG"
819 local retries_counter=0
821 update_shell_title "cvsup: $*"
823 update_shell_title "cvsup: $# files"
825 while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do
826 retries_counter=$(( $retries_counter + 1 ))
827 output=$(LC_ALL=C cvs $OPTIONS "$@" 2>&1)
829 [ -n "$output" ] && echo "$output"
830 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
831 echo "Trying again [$*]... ($retries_counter)"
832 update_shell_title "cvsup: retry #$retries_counter"
839 update_shell_title "cvsup: done!"
843 # returns true if "$1" is ftp, http or https protocol url
847 ftp://*|http://*|https://*)
856 if [ $# -eq 0 ]; then
860 update_shell_title "update md5"
861 if [ -n "$DEBUG" ]; then
868 # pass 1: check files to be fetched
872 local fp=$(nourl "$i")
873 local srcno=$(src_no "$i")
874 if [ -n "$ADD5" ]; then
875 [ "$fp" = "$i" ] && continue # FIXME what is this check doing?
876 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE && continue
877 grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE && continue
879 grep -qiE '^#[ ]*Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE || grep -qiE '^BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE || continue
881 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
882 need_files="$need_files $i"
886 # pass 1a: get needed files
887 if [ "$need_files" ]; then
888 get_files $need_files
891 # pass 2: proceed with md5 adding or updating
893 local fp=$(nourl "$i")
894 local srcno=$(src_no "$i")
895 local md5=$(grep -iE '^#[ ]*(No)?Source'$srcno'-md5[ ]*:' $SPEC_DIR/$SPECFILE )
896 if [ -z "$md5"]; then
897 md5=$(grep -iE '^[ ]*BuildRequires:[ ]*digest[(]%SOURCE'$srcno'[)][ ]*=' $SPEC_DIR/$SPECFILE )
899 if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
900 local tag="# Source$srcno-md5:\t"
901 if [[ "$md5" == *NoSource* ]]; then
902 tag="# NoSource$srcno-md5:\t"
903 elif [ -n "$USEDIGEST" ]; then
904 tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
906 md5=$(md5sum "$fp" | cut -f1 -d' ')
907 echo "Updating $tag ($md5: $fp)."
909 print unless (/^\s*#\s*(No)?Source'$srcno'-md5\s*:/i or /^\s*BuildRequires:\s*digest\(%SOURCE'$srcno'\)/i);
910 print "'"$tag$md5"'\n" if /^Source'$srcno'\s*:\s+/;
919 update_shell_title "check md5"
922 if good_md5 "$i" && good_size "$i"; then
926 echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
927 echo "or -5 to update md5 sums, if you're sure files are correct."
928 Exit_error err_no_source_in_repo $i
934 update_shell_title "get_files"
936 if [ -n "$DEBUG" ]; then
941 if [ $# -gt 0 ]; then
944 if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then
945 echo "Warning: No CVS access defined for SOURCES"
950 local get_files_cvs=""
954 SHELL_TITLE_PREFIX="get_files[$nc/$#]"
955 update_shell_title "$i"
956 local fp=`nourl "$i"`
957 if [ "$SKIP_EXISTING_FILES" = "yes" ] && [ -f "$fp" ]; then
962 local srcmd5=$(src_md5 "$i")
964 # we know if source/patch is present in cvs/distfiles
965 # - has md5 (in distfiles)
968 # CHECK: local file didn't exist or always cvs up (first) requested.
969 if [ ! -f "$fp" ] || [ $ALWAYS_CVSUP = "yes" ]; then
970 if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
971 echo "Warning: no URL given for $i"
974 if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then
975 if good_md5 "$i" && good_size "$i"; then
976 echo "$fp having proper md5sum already exists"
981 # optionally prefer mirror over distfiles if there's mirror
982 # TODO: build url list and then try each url from the list
983 if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
986 url=$(distfiles_url "$i")
989 url_attic=$(distfiles_attic_url "$i")
991 # is $url local file?
992 if [[ "$url" = [./]* ]]; then
993 update_shell_title "${GETLOCAL%% *}: $url"
994 ${GETLOCAL} $url $target
996 if [ -z "$NOMIRRORS" ]; then
997 url=$(find_mirror "$url")
1001 # make shorter message for distfiles urls
1002 if [[ "$uri" = ${PROTOCOL}${DISTFILES_SERVER}* ]] || [[ "$uri" = ${PROTOCOL}${ATTICDISTFILES_SERVER}* ]]; then
1003 uri=${uri#${PROTOCOL}${DISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1004 uri=${uri#${PROTOCOL}${ATTICDISTFILES_SERVER}/distfiles/by-md5/?/?/*/}
1007 update_shell_title "${GETURI%% *}: $uri"
1008 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1009 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1010 update_shell_title "${GETURI2%% *}: $url"
1011 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1016 if [ ! -s "$target" ]; then
1018 if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
1019 update_shell_title "${GETLOCAL%% *}: $url_attic"
1020 ${GETLOCAL} $url_attic $target
1022 if [ -z "$NOMIRRORS" ]; then
1023 url_attic="`find_mirror "$url_attic"`"
1025 update_shell_title "${GETURI%% *}: $url_attic"
1026 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1027 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1028 update_shell_title "${GETURI2%% *}: $url_attic"
1029 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1034 if [ -s "$target" ]; then
1035 cvsignore_df $target
1040 elif [ "$NOCVS" != "yes" -a -z "$srcmd5" ]; then
1041 if [ $# -gt 1 ]; then
1042 get_files_cvs="$get_files_cvs $fp"
1043 update_shell_title "$fp (will cvs up later)"
1050 if [ -z "$NOURLS" ] && [ ! -f "$fp" -o -n "$UPDATE" ] && [ "`echo $i | grep -E 'ftp://|http://|https://'`" ]; then
1051 if [ -z "$NOMIRRORS" ]; then
1052 im="`find_mirror "$i"`"
1056 update_shell_title "${GETURI%% *}: $im"
1057 ${GETURI} "$im" || \
1058 if [ "`echo $im | grep -E 'ftp://'`" ]; then
1059 update_shell_title "${GETURI2%% *}: $im"
1064 if [ "$cvsup" = 1 ]; then
1070 # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
1071 if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
1072 if [ -n "GREEDSRC" ]; then
1073 get_greed_sources $i
1075 Exit_error err_no_source_in_repo $i
1079 # we check md5 here just only to refetch immediately
1080 if good_md5 "$i" && good_size "$i"; then
1082 elif [ "$FROM_DISTFILES" = 1 ]; then
1083 # wrong md5 from distfiles: remove the file and try again
1085 echo "MD5 sum mismatch. Trying full fetch."
1088 update_shell_title "${GETURI%% *}: $url"
1089 ${GETURI} ${OUTFILEOPT} "$target" "$url" || \
1090 if [ "`echo $url | grep -E 'ftp://'`" ]; then
1091 update_shell_title "${GETURI2%% *}: $url"
1092 ${GETURI2} ${OUTFILEOPT} "$target" "$url"
1094 if [ ! -s "$target" ]; then
1096 update_shell_title "${GETURI%% *}: $url_attic"
1097 ${GETURI} ${OUTFILEOPT} "$target" "$url_attic" || \
1098 if [ "`echo $url_attic | grep -E 'ftp://'`" ]; then
1099 update_shell_title "${GETURI2%% *}: $url_attic"
1100 ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic"
1103 test -s "$target" || rm -f "$target"
1106 SHELL_TITLE_PREFIX=""
1108 if [ "$get_files_cvs" ]; then
1109 cvsup $get_files_cvs
1112 if [ "$CHMOD" = "yes" ]; then
1113 CHMOD_FILES="`nourl "$@"`"
1114 if [ -n "$CHMOD_FILES" ]; then
1115 chmod $CHMOD_MODE $CHMOD_FILES
1122 if [ -n "$DEBUG" ]; then
1127 # Check whether first character of PACKAGE_NAME is legal for tag name
1128 if [ -z "${PACKAGE_NAME##[_0-9]*}" -a -z "$TAG_PREFIX" ]; then
1132 # NOTE: CVS tags may must not contain the characters `$,.:;@'
1133 TAGVER=$(echo $TAG_PREFIX$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_RELEASE | tr '[.@]' '[_#]')
1135 # Remove #kernel.version_release from TAGVER because tagging sources
1136 # could occur with different kernel-headers than kernel-headers used at build time.
1137 # besides, %{_kernel_ver_str} is not expanded.
1139 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1#%{_kernel_ver_str}
1140 # TAGVER=auto-ac-madwifi-ng-0-0_20070225_1
1150 if [ -n "$DEBUG" ]; then
1155 echo "Version: $PACKAGE_VERSION"
1156 echo "Release: $PACKAGE_RELEASE"
1159 if [ "$TAG_VERSION" = "yes" ]; then
1160 TAGVER=`make_tagver`
1161 echo "CVS tag: $TAGVER"
1163 if [ -n "$TAG" ]; then
1164 echo "CVS tag: $TAG"
1167 local OPTIONS="tag $CVS_FORCE"
1168 if [ -n "$CVSROOT" ]; then
1169 OPTIONS="-d $CVSROOT $OPTIONS"
1174 for i in $TAG_FILES; do
1175 # don't tag files stored on distfiles
1176 [ -n "`src_md5 $i`" ] && continue
1177 local fp=`nourl "$i"`
1178 if [ -f "$fp" ]; then
1179 tag_files="$tag_files $fp"
1180 elif [ -n "GREEDSRC" ]; then
1181 get_greed_sources $i
1183 Exit_error err_no_source_in_repo $i
1187 if [ "$tag_files" ]; then
1188 if [ "$TAG_VERSION" = "yes" ]; then
1189 update_shell_title "tag sources: $TAGVER"
1190 printf "Tagging %d files\n" $(echo $tag_files | wc -w)
1191 cvs $OPTIONS $TAGVER $tag_files || exit
1193 if [ -n "$TAG" ]; then
1194 update_shell_title "tag sources: $TAG"
1196 while [ "$tag_files" ]; do
1197 local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
1198 printf "Tagging %d files\n" $(echo $chunk | wc -w)
1199 cvs $OPTIONS $TAG $chunk || exit
1200 tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
1206 if [ "$TAG_VERSION" = "yes" ]; then
1207 update_shell_title "tag spec: $TAGVER"
1208 cvs $OPTIONS $TAGVER $SPECFILE || exit
1210 if [ -n "$TAG" ]; then
1211 update_shell_title "tag spec: $TAG"
1212 cvs $OPTIONS $TAG $SPECFILE || exit
1219 echo "CVS branch tag: $TAG"
1224 if [ -n "$DEBUG" ]; then
1229 local OPTIONS="tag $CVS_FORCE -b"
1230 if [ -n "$CVSROOT" ]; then
1231 OPTIONS="-d $CVSROOT $OPTIONS"
1235 for i in $TAG_FILES; do
1236 local fp=`nourl "$i"`
1237 if [ -f "$fp" ]; then
1238 tag_files="$tag_files $fp"
1239 elif [ -n "GREEDSRC" ]; then
1240 get_greed_sources $i
1242 Exit_error err_no_source_in_repo $i
1245 if [ "$tag_files" ]; then
1246 cvs $OPTIONS $TAG $tag_files || exit
1250 cvs $OPTIONS $TAG $SPECFILE || exit
1254 # this function should exit early if package can't be built for this arch
1255 # this avoids unneccessary BR filling.
1258 out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
1260 if [ $ret -ne 0 ]; then
1269 update_shell_title "build_package"
1270 if [ -n "$DEBUG" ]; then
1277 if [ -n "$TRY_UPGRADE" ]; then
1278 update_shell_title "build_package: try_upgrade"
1279 if [ -n "$FLOAT_VERSION" ]; then
1280 TNOTIFY=`./pldnotify.awk $SPECFILE -n` || exit 1
1282 TNOTIFY=`./pldnotify.awk $SPECFILE` || exit 1
1285 TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'`
1287 if [ -n "$TNEWVER" ]; then
1288 TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
1289 echo "New version found, updating spec file to version " $TNEWVER
1290 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1291 cp -f $SPECFILE $SPECFILE.bak
1294 eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
1295 eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
1297 NODIST="yes" get_files $SOURCES $PATCHES
1300 unset TOLDVER TNEWVER TNOTIFY
1307 BUILD_SWITCH="-ba" ;;
1309 BUILD_SWITCH="-bb" ;;
1311 BUILD_SWITCH="-bs --nodeps" ;;
1313 BUILD_SWITCH="-bp --nodeps" ;;
1315 BUILD_SWITCH="-bc" ;;
1317 BUILD_SWITCH="-bi" ;;
1319 BUILD_SWITCH="-bl" ;;
1323 update_shell_title "build_package: $COMMAND"
1324 if [ -n "$LOGFILE" ]; then
1325 LOG=`eval echo $LOGFILE`
1326 if [ -d "$LOG" ]; then
1327 echo "Log file $LOG is a directory."
1328 echo "Parse error in the spec?"
1329 Exit_error err_build_fail
1331 if [ -n "$LASTLOG_FILE" ]; then
1332 echo "LASTLOG=$LOG" > $LASTLOG_FILE
1334 RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
1335 (time eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
1336 RETVAL=`cat $RES_FILE`
1338 if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
1339 if [ "$RETVAL" -eq "0" ]; then
1346 eval ${NICE_COMMAND} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE
1349 if [ "$RETVAL" -ne "0" ]; then
1350 if [ -n "$TRY_UPGRADE" ]; then
1351 echo "\n!!! Package with new version cannot be built automagically\n"
1352 if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
1353 mv -f $SPECFILE.bak $SPECFILE
1356 Exit_error err_build_fail
1363 echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
1366 install_required_packages()
1373 # taken from find-spec-bcond, but with just getting the list
1375 # quick revert hint: '$RPMBUILD --bcond $SPEC'
1377 /^%changelog/ { exit }
1378 /_with(out)?_[_a-zA-Z0-9]+/{
1379 match($0, /_with(out)?_[_a-zA-Z0-9]+/);
1380 print substr($0, RSTART, RLENGTH);
1383 match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
1384 bcond = substr($0, RSTART +5 , RLENGTH -5);
1385 gsub(/[ \t]+/,"_",bcond);
1387 }' $SPEC | LC_ALL=C sort -u
1391 # expand bconds from ~/.bcondrc
1392 # The file structure is like gentoo's package.use:
1395 # samba -mysql -pgsql
1396 # w32codec-installer license_agreement
1399 if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
1405 SN=${SPECFILE%%\.spec}
1407 local bcondrc=$HOME/.bcondrc
1408 [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
1410 local bcond_avail=$(find_spec_bcond $SPECFILE)
1412 while read pkg flags; do
1414 [[ "$pkg" == \#* ]] && continue
1416 # any package or current package?
1417 if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
1418 for flag in $flags; do
1419 local opt=${flag#[+-]}
1421 # use only flags which are in this package.
1422 if [[ $bcond_avail = *${opt}* ]]; then
1423 if [[ $flag = -* ]]; then
1424 if [[ $BCOND != *--with?${opt}* ]]; then
1425 BCOND="$BCOND --without $opt"
1428 if [[ $BCOND != *--without?${opt}* ]]; then
1429 BCOND="$BCOND --with $opt"
1436 update_shell_title "parse ~/.bcondrc: DONE!"
1441 update_shell_title "set bcond values"
1443 AVAIL_BCONDS_WITHOUT=""
1444 AVAIL_BCONDS_WITH=""
1445 if `grep -q ^%bcond ${SPECFILE}`; then
1447 elif `egrep -q ^#\ *_with ${SPECFILE}`; then
1453 local bcond_avail=$(find_spec_bcond $SPECFILE)
1454 process_bcondrc "$SPECFILE"
1456 update_shell_title "parse bconds"
1457 case "${BCOND_VERSION}" in
1462 echo "Warning: This spec has old style bconds. Fix it || die."
1463 for opt in `echo "$bcond_avail" | grep ^_without_`
1465 AVAIL_BCOND_WITHOUT=${opt#_without_}
1466 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1467 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1469 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1473 for opt in `echo "$bcond_avail" | grep ^_with_`
1475 AVAIL_BCOND_WITH=${opt#_with_}
1476 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1477 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1479 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1484 local cond_type="" # with || without
1485 for opt in $bcond_avail; do
1494 AVAIL_BCOND_WITHOUT=${opt#_without_}
1495 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1496 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1498 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1502 AVAIL_BCOND_WITH=${opt#_with_}
1503 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1504 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1506 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1510 case "$cond_type" in
1513 AVAIL_BCOND_WITH="$opt"
1514 if [[ "$BCOND" = *--with?${AVAIL_BCOND_WITH}* ]]; then
1515 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH <$AVAIL_BCOND_WITH>"
1517 AVAIL_BCONDS_WITH="$AVAIL_BCONDS_WITH $AVAIL_BCOND_WITH"
1522 AVAIL_BCOND_WITHOUT="$opt"
1523 if [[ "$BCOND" = *--without?${AVAIL_BCOND_WITHOUT}* ]]; then
1524 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT <$AVAIL_BCOND_WITHOUT>"
1526 AVAIL_BCONDS_WITHOUT="$AVAIL_BCONDS_WITHOUT $AVAIL_BCOND_WITHOUT"
1540 update_shell_title "run_sub_builder $package_name"
1542 # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
1543 # pakieta zbudowaæ. Aktualnie niewiele dziala, bo generalnie nie widze do
1544 # konca algorytmu... Ale damy rade. :) Na razie po prostu sie wyjebie tak samo
1545 # jakby nie bylo tego kawalka kodu.
1547 # Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
1548 # Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
1555 # Istnieje taki spec? ${package}.spec
1556 if [ -f "${SPEC_DIR}/${package}.spec" ]; then
1557 parent_spec_name=${package}.spec
1558 elif [ -f "${SPEC_DIR}/`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
1559 parent_spec_name="`echo ${package_name} | sed -e s,-devel.*,,g -e s,-static,,g`.spec"
1561 for provides_line in `grep ^Provides:.*$package ${SPEC_DIR} -R`
1567 if [ "${parent_spec_name}" != "" ]; then
1568 spawn_sub_builder $parent_spec_name
1570 NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
1576 update_shell_title "spawn_sub_builder $package_name"
1579 if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
1580 sub_builder_opts="${sub_builder_opts} -R"
1582 if [ "${REMOVE_BUILD_REQUIRES}" == "nice" ]; then
1583 sub_builder_opts="${sub_builder_opts} -RB"
1584 elif [ "${REMOVE_BUILD_REQUIRES}" == "force" ]; then
1585 sub_builder_opts="${sub_builder_opts} -FRB"
1587 if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
1588 sub_builder_opts="${sub_builder_opts} -Upi"
1592 ./builder ${sub_builder_opts} "$@"
1595 remove_build_requires()
1597 if [ "$INSTALLED_PACKAGES" != "" ]; then
1598 case "$REMOVE_BUILD_REQUIRES" in
1600 run_poldek --noask -ve $INSTALLED_PACKAGES
1603 run_poldek --ask -ve $INSTALLED_PACKAGES
1606 echo You may want to manually remove following BuildRequires fetched:
1607 echo $INSTALLED_PACKAGES
1608 echo Try poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`
1616 if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
1617 if [ "$BCOND" != "" ]; then
1618 echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
1621 echo -ne "\nNo conditional flags passed"
1623 echo -ne "\n\nfrom available:\n"
1624 echo -ne "--with :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
1630 if [ "$NOCVSSPEC" != "yes" ]; then
1631 echo -ne "Available branches: "
1632 cvs status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
1636 # checks a given list of packages/files/provides agains current rpmdb.
1637 # outputs all dependencies whcih current rpmdb doesn't satisfy.
1638 # input can be either STDIN or parameters
1643 if [ "$#" -gt 0 ]; then
1649 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
1652 echo "$DEPS" | awk '/^no package provides/ { print $NF }'
1654 # other deps (files)
1655 echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
1658 # checks if given package/files/provides exists in rpmdb.
1659 # inout can be either stdin or parameters
1660 # returns packages wchi hare present in the rpmdb
1665 if [ "$#" -gt 0 ]; then
1671 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
1674 fetch_build_requires()
1676 if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
1677 update_shell_title "fetch build requires"
1678 if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
1679 # TODO: Conflicts list doesn't check versions
1680 local CNFL=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
1681 local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
1683 if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
1684 echo "fetch builderequires: install [$DEPS]; remove [$CNFL]"
1685 update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
1686 $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
1688 if [ -n "$CNFL" ]; then
1689 update_shell_title "uninstall conflicting packages: $CNFL"
1690 echo "Trying to uninstall conflicting packages ($CNFL):"
1691 $SU_SUDO /usr/bin/poldek --noask --nofollow -ev $CNFL
1694 while [ "$DEPS" ]; do
1695 update_shell_title "install deps: $DEPS"
1696 echo "Trying to install dependencies ($DEPS):"
1697 local log=.${SPECFILE}_poldek.log
1698 $SU_SUDO /usr/bin/poldek --caplookup -uGq $DEPS | tee $log
1699 failed=$(awk -F: '/^error:/{print $2}' $log)
1702 if [ -n "$failed" ]; then
1703 for package in $failed; do
1704 # FIXME: sanitise, deps could be not .spec files
1705 spawn_sub_builder -bb $package && ok="$ok $package"
1715 echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
1716 echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
1717 echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
1718 echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
1719 echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1720 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`
1722 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`"
1724 package=`basename "$package_item"|sed -e "s/}$//g"`
1725 COND_ARCH_TST="`cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g"`"
1728 COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
1729 if `echo $COND_TST|grep -q '^BuildRequires:'`; then
1730 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
1735 COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
1738 if `echo $COND_TST|grep -q 'without_'`; then
1739 COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
1740 if `echo $COND_TST|grep -q !`; then
1745 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1746 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1747 if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
1753 elif `echo $COND_TST|grep -q 'with_'`; then
1754 COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
1755 if `echo $COND_TST|grep -q !`; then
1760 COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
1761 COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
1762 if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
1768 RESULT="${COND_STATE}-${COND_ARGV}"
1770 "with-wout" | "wout-with" )
1773 "wout-wout" | "with-with" )
1777 echo "Action '$RESULT' was not defined for package '$package_item'"
1783 if [ "$GO" = "yes" ]; then
1784 if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
1785 echo "Testing if $package has subrequirements..."
1786 run_poldek -t -i $package --dumpn=".$package-req.txt"
1787 if [ -f ".$package-req.txt" ]; then
1788 for package_name in `cat ".$package-req.txt"|grep -v ^#`
1790 if [ "$package_name" = "$package" ]; then
1791 echo -ne "Installing BuildRequired package:\t$package_name\n"
1792 update_shell_title "Installing BuildRequired package: ${package_name}"
1793 install_required_packages $package
1795 echo -ne "Installing (sub)Required package:\t$package_name\n"
1796 update_shell_title "Installing (sub)Required package: ${package_name}"
1797 install_required_packages $package_name
1801 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1802 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1805 echo "Attempting to run spawn sub - builder..."
1806 echo -ne "Package installation failed:\t$package_name\n"
1807 run_sub_builder $package_name
1808 if [ $? -eq 0 ]; then
1809 install_required_packages $package_name
1812 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1813 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1816 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1823 rm -f ".$package-req.txt"
1825 echo "Attempting to run spawn sub - builder..."
1826 echo -ne "Package installation failed:\t$package\n"
1827 run_sub_builder $package
1828 if [ $? -eq 0 ]; then
1829 install_required_packages $package
1832 INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
1833 echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
1836 NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
1842 echo "Package $package is already installed. BuildRequirement satisfied."
1846 if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
1847 echo "Unable to install following packages and their dependencies:"
1848 for pkg in "$NOT_INSTALLED_PACKAGES"
1852 remove_build_requires
1860 TOP_DIR="`eval $RPM $RPMOPTS --eval '%{_topdir}'`"
1861 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1863 mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
1865 cvs -d $CVSROOT co SOURCES/.cvsignore SPECS/{mirrors,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
1869 echo "To checkout *all* .spec files:"
1870 echo "- remove $SPEC_DIR/CVS/Entries.Static"
1871 echo "- run cvs up in $SPEC_DIR dir"
1874 echo "To commit with your developer account:"
1875 echo "- edit $SPEC_DIR/CVS/Root"
1876 echo "- edit $SOURCE_DIR/CVS/Root"
1879 get_greed_sources() {
1880 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
1881 if [ -n "BE_VERBOSE" ]; then
1882 echo "Try greed download: $1 from: $CVSROOT"
1884 cvs -d $CVSROOT get SOURCES/$1
1885 if [ $? != 0 ]; then
1886 Exit_error err_no_source_in_repo $1
1891 # remove entries from CVS/Entries
1892 cvs_entry_remove() {
1893 local cvsdir="$1"; shift
1894 if [ ! -d "$cvsdir" ]; then
1895 echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
1899 for file in "$@"; do
1900 rm -f $cvsdir/CVS/Entries.new || return 1
1901 awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
1902 mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
1910 DONT_PRINT_REVISION="yes"
1914 # remove from CVS/Entries
1915 cvs_entry_remove $SPEC_DIR $SPECFILE
1916 cvs_entry_remove $SOURCE_DIR $SOURCES $PATCHES
1918 # remove spec and sources
1919 $RPMBUILD --clean --rmsource --rmspec --nodeps $SPECFILE
1922 #---------------------------------------------
1930 while [ $# -gt 0 ]; do
1933 COMMAND="update_md5"
1938 COMMAND="update_md5"
1948 DEBUG="yes"; shift ;;
1950 COMMAND="version"; shift ;;
1952 COMMAND="short-version"; shift ;;
1954 CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
1955 -b | -ba | --build )
1956 COMMAND="build"; shift ;;
1957 -bb | --build-binary )
1958 COMMAND="build-binary"; shift ;;
1960 COMMAND="build-build"; shift ;;
1962 COMMAND="build-install"; shift ;;
1964 COMMAND="build-list"; shift ;;
1965 -bp | --build-prep )
1966 COMMAND="build-prep"; shift ;;
1967 -bs | --build-source )
1968 COMMAND="build-source"; shift ;;
1970 COMMAND="branch"; shift; TAG="${1}"; shift;;
1972 CLEAN="--clean --rmspec --rmsource"; shift ;;
1974 CVS_FORCE="-F"; shift;;
1976 shift; CVSROOT="${1}"; shift ;;
1978 COMMAND="get"; shift ;;
1980 COMMAND="usage"; shift ;;
1982 PROTOCOL="http"; shift ;;
1984 shift; LOGFILE="${1}"; shift ;;
1986 shift; DEF_NICE_LEVEL=${1}; shift ;;
1987 -ske | --skip-existing-files)
1988 SKIP_EXISTING_FILES="yes"; shift ;;
1990 COMMAND="mr-proper"; shift ;;
1992 NOCVS="yes"; shift ;;
1993 -ncs | --no-cvs-specs )
1994 NOCVSSPEC="yes"; shift ;;
1995 -nd | --no-distfiles )
1996 NODIST="yes"; shift ;;
1997 -nm | --no-mirrors )
1998 NOMIRRORS="yes"; shift ;;
2000 NOURLS="yes"; shift ;;
2002 NOSRCS="yes"; shift ;;
2003 -ns0 | --no-source0 )
2004 NOSOURCE0="yes"; shift ;;
2014 -pm | --prefer-mirrors )
2021 shift; RPMOPTS="${RPMOPTS} ${1}"; shift ;;
2023 shift; RPMOPTS="${RPMOPTS} --define \"patch${1} : ignoring patch${1}; exit 1; \""; shift ;;
2024 --with | --without )
2025 case $GROUP_BCONDS in
2029 while ! `echo ${1}|grep -qE '(^-|spec)'`
2031 BCOND="$BCOND $COND $1"
2035 if [[ "$2" = *,* ]]; then
2036 for a in $(echo "$2" | tr , ' '); do
2037 BCOND="$BCOND $1 $a"
2040 BCOND="$BCOND $1 $2"
2046 shift; TARGET="${1}"; shift ;;
2048 TARGET=$(echo "${1}" | sed 's/^--target=//'); shift ;;
2050 QUIET="--quiet"; shift ;;
2052 CVSDATE="${2}"; shift 2 ;;
2054 shift; CVSTAG="${1}"; shift ;;
2056 shift; CVSTAG="HEAD"; ;;
2057 -R | --fetch-build-requires)
2058 FETCH_BUILD_REQUIRES="yes"
2059 NOT_INSTALLED_PACKAGES=
2061 -RB | --remove-build-requires)
2062 REMOVE_BUILD_REQUIRES="nice"
2064 -FRB | --force-remove-build-requires)
2065 REMOVE_BUILD_REQUIRES="force"
2067 -sc | --sources-cvs)
2068 COMMAND="list-sources-cvs"
2070 -sd | --sources-distfiles)
2071 COMMAND="list-sources-distfiles"
2073 -sdp | --sources-distfiles-paths)
2074 COMMAND="list-sources-distfiles-paths"
2076 -sf | --sources-files)
2077 COMMAND="list-sources-files"
2079 -sp | --sources-paths)
2080 COMMAND="list-sources-local-paths"
2082 -su | --sources-urls)
2083 COMMAND="list-sources-urls"
2085 -Tvs | --tag-version-stable )
2090 -Ts | --tag-stable )
2095 -Tv | --tag-version )
2100 -Tp | --tag-prefix )
2112 -ir | --integer-release-only )
2113 INTEGER_RELEASE="yes"
2116 COMMAND="update_md5"
2121 -Upi | --update-poldek-indexes )
2122 UPDATE_POLDEK_INDEXES="yes"
2125 COMMAND="init_rpm_dir"
2127 --use-greed-sources )
2130 -u | --try-upgrade )
2131 TRY_UPGRADE="1"; shift ;;
2132 -un | --try-upgrade-with-float-version )
2133 TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;;
2135 BE_VERBOSE="1"; shift ;;
2140 if echo "${MACRO}" | grep -q '\W'; then
2141 RPMOPTS="${RPMOPTS} --define \"${MACRO}\""
2145 RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\""
2150 RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
2154 RPMBUILDOPTS="${RPMBUILDOPTS} --short-circuit"
2157 --show-bconds | -show-bconds | -print-bconds | --print-bconds | -display-bconds | --display-bconds )
2158 COMMAND="show_bconds"
2162 COMMAND="show_bcond_args"
2167 RPMOPTS="${RPMOPTS} --nodeps"
2170 RPMBUILDOPTS="${RPMBUILDOPTS} -debug"; shift
2173 Exit_error err_invalid_cmdline "$1"
2177 # check if specname was passed as specname:cvstag
2178 if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then
2179 CVSTAG="${SPECFILE##*:}"
2180 SPECFILE="${SPECFILE%%:*}"
2182 ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
2187 if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then
2188 CVSTAG=$(awk -vSPECFILE="${SPECFILE%.spec}.spec" -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries)
2189 if [ "$CVSTAG" ]; then
2190 echo >&2 "builder: Stick tag $CVSTAG active. Use -r TAGNAME to override."
2192 elif [ "$CVSTAG" = "HEAD" ]; then
2193 # assume -r HEAD is same as -A
2197 if [ -n "$DEBUG" ]; then
2202 if [ -n "$TARGET" ]; then
2205 TARGET_SWITCH="--target $TARGET" ;;
2207 TARGET_SWITCH="--target=$TARGET" ;;
2211 if [ "$SCHEDTOOL" != "no" ]; then
2212 NICE_COMMAND="$SCHEDTOOL"
2214 NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
2217 update_shell_title "$COMMAND"
2221 if [ -n "$SPECFILE" ]; then
2222 get_spec > /dev/null
2230 if [ -n "$SPECFILE" ]; then
2231 get_spec > /dev/null
2237 "build" | "build-binary" | "build-source" | "build-prep" | "build-build" | "build-install" | "build-list")
2239 if [ -n "$SPECFILE" ]; then
2245 if [ "$COMMAND" != "build-source" ]; then
2248 fetch_build_requires
2249 if [ "$INTEGER_RELEASE" = "yes" ]; then
2250 echo "Checking release $PACKAGE_RELEASE..."
2251 if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
2252 Exit_error err_fract_rel "$PACKAGE_RELEASE"
2256 # ./builder -bs test.spec -r AC-branch -Tp auto-ac- -tt
2257 if [ -n "$TEST_TAG" ]; then
2258 # - do not allow utf8 encoded specs on AC-branch
2259 if [ "$CVSTAG" = "AC-branch-disabled" ]; then
2261 t=$(grep '^Summary(.*\.UTF-8):' $SPECFILE)
2263 Exit_error err_acl_deny "UTF-8 .specs not allowed on $CVSTAG"
2267 local TAGVER=`make_tagver`
2268 echo "Searching for tag $TAGVER..."
2269 TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g')
2270 if [ -n "$TAGREL" ]; then
2271 Exit_error err_tag_exists "$TAGVER" "$TAGREL"
2274 # - do not allow to build from HEAD when XX-branch exists
2275 TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
2276 if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
2277 TAG_BRANCH="${TREE_PREFIX}-branch"
2278 TAG_STATUS=$(cvs status -v $SPECFILE | grep -Ei "${TAG_BRANCH}.+(branch: [0-9.]+)")
2279 if [ -n "$TAG_STATUS" -a "$CVSTAG" = "HEAD" ]; then
2280 Exit_error err_branch_exists "$TAG_STATUS"
2286 if [ -n "$NOSOURCE0" ] ; then
2287 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2289 get_files $SOURCES $PATCHES
2292 if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
2293 run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
2295 remove_build_requires
2297 Exit_error err_no_spec_in_cmdl
2302 if [ -n "$SPECFILE" ]; then
2305 # don't fetch sources from remote locations
2307 for file in $SOURCES; do
2308 [ -n "`src_md5 $file`" ] && continue
2309 new_SOURCES="$new_SOURCES $file"
2311 SOURCES="$new_SOURCES"
2312 get_files $SOURCES $PATCHES
2314 branch_files $TAG $SOURCES $PATCHES $ICONS
2316 Exit_error err_no_spec_in_cmdl
2321 if [ -n "$SPECFILE" ]; then
2325 if [ -n "$NOSOURCE0" ] ; then
2326 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2328 get_files $SOURCES $PATCHES
2331 Exit_error err_no_spec_in_cmdl
2336 if [ -n "$SPECFILE" ]; then
2340 if [ -n "$NOSOURCE0" ] ; then
2341 SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
2345 Exit_error err_no_spec_in_cmdl
2352 if [ -n "$SPECFILE" ]; then
2356 # don't fetch sources from remote locations
2358 for file in $SOURCES; do
2359 [ -n "`src_md5 $file`" ] && continue
2360 new_SOURCES="$new_SOURCES $file"
2362 SOURCES="$new_SOURCES"
2363 get_files $SOURCES $PATCHES
2365 tag_files $SOURCES $PATCHES $ICONS
2367 Exit_error err_no_spec_in_cmdl
2373 "list-sources-files" )
2376 DONT_PRINT_REVISION="yes"
2379 for SAP in $SOURCES $PATCHES; do
2380 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2383 "list-sources-urls" )
2386 DONT_PRINT_REVISION="yes"
2389 SAPS="$SOURCES $PATCHES"
2390 for SAP in $SAPS ; do
2394 "list-sources-local-paths" )
2397 DONT_PRINT_REVISION="yes"
2400 for SAP in $SOURCES $PATCHES; do
2401 echo $SOURCE_DIR/$(echo $SAP | awk '{gsub(/.*\//,"") ; print }')
2404 "list-sources-distfiles-paths" )
2407 DONT_PRINT_REVISION="yes"
2410 for SAP in $SOURCES $PATCHES; do
2411 if [ -n "$(src_md5 "$SAP")" ]; then
2412 distfiles_path "$SAP"
2416 "list-sources-distfiles" )
2419 DONT_PRINT_REVISION="yes"
2422 for SAP in $SOURCES $PATCHES; do
2423 if [ -n "$(src_md5 "$SAP")" ]; then
2424 distfiles_url "$SAP"
2428 "list-sources-cvs" )
2431 DONT_PRINT_REVISION="yes"
2434 for SAP in $SOURCES $PATCHES; do
2435 if [ -z "$(src_md5 "$SAP")" ]; then
2436 echo $SAP | awk '{gsub(/.*\//,"") ; print}'
2450 echo "$VERSIONSTRING"
2453 if [ -f "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES" -a "$REMOVE_BUILD_REQUIRES" != "" ]; then
2454 rm "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
2458 # vi:syntax=sh:ts=4:sw=4:noet