]>
Commit | Line | Data |
---|---|---|
b054f772 | 1 | #!/bin/sh |
33f5276d | 2 | # ----------- |
25fa34fe | 3 | # $Id$ |
33f5276d | 4 | # Exit codes: |
5 | # 0 - succesful | |
6 | # 1 - help dispayed | |
7 | # 2 - no spec file name in cmdl parameters | |
8 | # 3 - spec file not stored in repo | |
0ad50ce9 | 9 | # 4 - some source, patch or icon files not stored in repo |
10 | # 5 - package build failed | |
5a491465 | 11 | |
931a4acf TP |
12 | # Notes (todo): |
13 | # - builder -u fetches current version first | |
14 | # - tries to get new version from distfiles without new md5 | |
15 | # - after fetching new version doesn't update md5 | |
9308ddd0 TP |
16 | # - doesn't get sources for specs with %include /usr/lib/rpm/macros.python |
17 | # when there's no rpm-pythonprov (rpm's fault, but it's ugly anyway) | |
931a4acf | 18 | |
4003ad8c | 19 | VERSION="\ |
20 | Build package utility from PLD CVS repository | |
6cb7df6d | 21 | V 0.11 (C) 1999-2003 Free Penguins". |
5a491465 | 22 | PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin" |
a7af9862 | 23 | |
b03f053b | 24 | COMMAND="build" |
25 | ||
bde1c404 | 26 | SPECFILE="" |
d287305c | 27 | BE_VERBOSE="" |
4003ad8c | 28 | QUIET="" |
5dd89621 | 29 | CLEAN="" |
7c2dd1b2 | 30 | DEBUG="" |
cc97f1f3 | 31 | NOURLS="" |
157dc315 | 32 | NOCVS="" |
6fc910c7 | 33 | NOCVSSPEC="" |
fc0e5bb5 | 34 | NODIST="" |
b130abf2 | 35 | UPDATE="" |
a9d9a79a | 36 | UPDATE5="" |
de6b5b2a | 37 | ADD5="" |
81474543 | 38 | ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"} |
c61a8d10 AM |
39 | if [ -s CVS/Root ]; then |
40 | CVSROOT=$(cat CVS/Root) | |
41 | else | |
42 | CVSROOT=${CVSROOT:-""} | |
43 | fi | |
d6a75d60 | 44 | # Example: LOGFILE='../log.$PACKAGE_NAME' |
45 | # Yes, you can use variable name! Note _single_ quotes! | |
46 | LOGFILE='' | |
00fcec7e | 47 | |
48 | LOGDIR="" | |
49 | LOGDIROK="" | |
50 | LOGDIRFAIL="" | |
51 | LASTLOG_FILE="" | |
52 | LTAG="" | |
79d76918 | 53 | CHMOD="no" |
d6a75d60 | 54 | CHMOD_MODE="0444" |
33a9d2d1 | 55 | RPMOPTS="" |
6049c3d1 | 56 | BCOND="" |
d287305c | 57 | |
58 | PATCHES="" | |
59 | SOURCES="" | |
7053d3fd | 60 | ICONS="" |
d287305c | 61 | PACKAGE_RELEASE="" |
62 | PACKAGE_VERSION="" | |
63 | PACKAGE_NAME="" | |
34c911e6 | 64 | WGET_RETRIES=${MAX_WGET_RETRIES:-0} |
b92ecfc9 | 65 | CVS_RETRIES=${MAX_CVS_RETRIES:-1000} |
5a491465 | 66 | |
00fcec7e | 67 | CVSTAG="" |
68 | RES_FILE="" | |
69 | ||
62546902 | 70 | CVS_SERVER="cvs.pld-linux.org" |
6cb7df6d | 71 | DISTFILES_SERVER="ftp://distfiles.pld-linux.org" |
ea15df77 | 72 | |
3ae81a20 | 73 | DEF_NICE_LEVEL=0 |
74 | ||
c6a390a1 AM |
75 | FAIL_IF_NO_SOURCES="yes" |
76 | ||
8f7b338e | 77 | GETURI="wget --passive-ftp -c -nd -t$WGET_RETRIES --inet" |
78 | GETURI2="wget -c -nd -t$WGET_RETRIES --inet" | |
6aefe77b | 79 | GETLOCAL="cp -a" |
11f33a0c | 80 | |
7147050f AM |
81 | if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then |
82 | RPM="rpm" | |
83 | RPMBUILD="rpm" | |
84 | else | |
85 | RPM="rpm" | |
86 | RPMBUILD="rpmbuild" | |
87 | fi | |
88 | ||
6eb44b93 | 89 | if [ -f ~/etc/builderrc ]; then |
7922b3ec | 90 | . ~/etc/builderrc |
6eb44b93 | 91 | elif [ -f ~/.builderrc ]; then |
7922b3ec | 92 | . ~/.builderrc |
5aa0ef93 AF |
93 | fi |
94 | ||
da946cd6 | 95 | #--------------------------------------------- |
96 | # functions | |
97 | ||
5a491465 | 98 | usage() |
99 | { | |
7c2dd1b2 | 100 | if [ -n "$DEBUG" ]; then set -xv; fi |
101 | echo "\ | |
7922b3ec | 102 | Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build] |
81f85806 | 103 | |
104 | [-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade] | |
105 | [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get] | |
106 | [-h|--help] [{-l,--logtofile} <logfile>] [-m|--mr-proper] | |
00fcec7e | 107 | [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>] |
a2164135 MM |
108 | [-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest] |
109 | [-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version] | |
81f85806 | 110 | [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] |
c9ff8825 | 111 | [--with/--without <feature>] [--define <macro> <value>] <package>[.spec] |
5a491465 | 112 | |
de6b5b2a MM |
113 | -5, --update-md5 |
114 | - update md5 comments in spec, implies -nd | |
115 | -a5, --add-md5 - add md5 comments to URL sources, implies -nc -nd | |
a2a9c8df | 116 | -D, --debug - enable script debugging mode, |
5a491465 | 117 | -V, --version - output builder version |
62546902 | 118 | -a, --as_anon - get files via pserver as cvs@$CVS_SERVER, |
79b2ec0e | 119 | -b, -ba, |
cc97f1f3 | 120 | --build - get all files from CVS repo or HTTP/FTP and build |
5a491465 | 121 | package from <package>.spec, |
7922b3ec | 122 | -bb, --build-binary |
123 | - get all files from CVS repo or HTTP/FTP and build | |
79b2ec0e | 124 | binary only package from <package>.spec, |
125 | -bs, | |
cc97f1f3 SZ |
126 | --build-source - get all files from CVS repo or HTTP/FTP and only |
127 | pack them into src.rpm, | |
8ba5cdda | 128 | -B, --branch - add branch |
7922b3ec | 129 | -c, --clean - clean all temporarily created files (in BUILD, |
79b2ec0e | 130 | SOURCES, SPECS and \$RPM_BUILD_ROOT), |
7922b3ec | 131 | -d <cvsroot>, --cvsroot <cvsroot> |
132 | - setup \$CVSROOT, | |
e7bdc1b4 | 133 | --define <macro> <value> |
81f85806 | 134 | - define a macro <macro> with value <value>, |
7922b3ec | 135 | -g, --get - get <package>.spec and all related files from |
cc97f1f3 | 136 | CVS repo or HTTP/FTP, |
5a491465 | 137 | -h, --help - this message, |
7922b3ec | 138 | -l <logfile>, --logtofile <logfile> |
139 | - log all to file, | |
ff45a501 | 140 | -m, --mr-proper - only remove all files related to spec file and |
8bc51224 | 141 | all work resources, |
6fc910c7 | 142 | -nc, --no-cvs - don't download sources from CVS, if source URL is |
143 | given, | |
144 | -ncs, --no-cvs-specs | |
145 | - don't check specs in CVS | |
fc0e5bb5 TP |
146 | -nd, --no-distfiles |
147 | - don't download from distfiles | |
4ca52257 | 148 | -nm, --no-mirrors - don't download from mirror, if source URL is given, |
157dc315 | 149 | -nu, --no-urls - don't try to download from FTP/HTTP location, |
0143ec80 | 150 | -ns, --no-srcs - don't download Sources |
fd2b5687 | 151 | -ns0, --no-source0 |
0143ec80 | 152 | - don't download Source0 |
7922b3ec | 153 | --opts <rpm opts> |
154 | - additional options for rpm | |
5a491465 | 155 | -q, --quiet - be quiet, |
448deaa0 | 156 | --date yyyy-mm-dd |
157 | - build package using resources from specified CVS | |
158 | date, | |
7922b3ec | 159 | -r <cvstag>, --cvstag <cvstag> |
160 | - build package using resources from specified CVS | |
67fcd1e4 | 161 | tag, |
7922b3ec | 162 | -T <cvstag> , --tag <cvstag> |
163 | - add cvs tag <cvstag> for files, | |
78ce14b3 | 164 | -Tvs, --tag-version-stable |
165 | - add cvs tags STABLE and NAME-VERSION-RELESE for files, | |
a2164135 MM |
166 | -Tvn, --tag-version-nest |
167 | - add cvs tags NEST and NAME-VERSION-RELESE for files, | |
78ce14b3 | 168 | -Ts, --tag-stable |
169 | - add cvs tag STABLE for files, | |
a2164135 MM |
170 | -Tn, --tag-nest |
171 | - add cvs tag NEST for files, | |
7922b3ec | 172 | -Tv, --tag-version |
173 | - add cvs tag NAME-VERSION-RELESE for files, | |
5a491465 | 174 | -v, --verbose - be verbose, |
81f85806 | 175 | -u, --try-upgrade |
176 | - check version, and try to upgrade package | |
b130abf2 TP |
177 | -un, --try-upgrade-with-float-version |
178 | - as above, but allow float version | |
179 | -U, --update | |
de6b5b2a MM |
180 | - refetch sources, don't use distfiles, and update md5 |
181 | comments | |
d5787aec | 182 | --with/--without <feature> |
81f85806 | 183 | - conditional build package depending on |
d5787aec | 184 | %_with_<feature>/%_without_<feature> macro |
81f85806 | 185 | switch |
5a491465 | 186 | " |
187 | } | |
188 | ||
ad6f43de MM |
189 | rpm_dump () { |
190 | case "$RPMBUILD" in | |
191 | rpm ) | |
192 | rpm -bp --define 'prep %dump' $BCOND $SPECFILE 2>&1 | |
193 | ;; | |
194 | rpmbuild ) | |
195 | rpmbuild --define 'prep %dump' $BCOND $SPECFILE 2>&1 | |
196 | ;; | |
197 | esac | |
198 | } | |
199 | ||
59398507 | 200 | parse_spec() |
201 | { | |
c3428d50 | 202 | if [ -n "$DEBUG" ]; then |
a7af9862 | 203 | set -x; |
204 | set -v; | |
71d62f04 | 205 | fi |
7c2dd1b2 | 206 | |
25fa34fe | 207 | cd $SPECS_DIR |
72fb89b5 | 208 | if [ "$NOSRCS" != "yes" ]; then |
ad6f43de | 209 | SOURCES="`rpm_dump | awk '/SOURCEURL[0-9]+/ {print $3}'`" |
72fb89b5 | 210 | fi |
ad6f43de | 211 | if (rpm_dump | grep -qEi ":.*nosource.*1"); then |
a7af9862 | 212 | FAIL_IF_NO_SOURCES="no" |
c6a390a1 AM |
213 | fi |
214 | ||
ad6f43de | 215 | PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`" |
cc97f1f3 | 216 | ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`" |
7147050f AM |
217 | PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`" |
218 | PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -1`" | |
219 | PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`" | |
79379585 | 220 | |
9e06e5c3 | 221 | if [ -n "$BE_VERBOSE" ]; then |
00fcec7e | 222 | echo "- Sources : `nourl $SOURCES`" |
cc97f1f3 | 223 | if [ -n "$PATCHES" ]; then |
a7af9862 | 224 | echo "- Patches : `nourl $PATCHES`" |
cc97f1f3 | 225 | else |
a7af9862 | 226 | echo "- Patches : *no patches needed*" |
cc97f1f3 | 227 | fi |
7053d3fd | 228 | if [ -n "$ICONS" ]; then |
a7af9862 | 229 | echo "- Icon : `nourl $ICONS`" |
a3df415f | 230 | else |
a7af9862 | 231 | echo "- Icon : *no package icon*" |
a3df415f | 232 | fi |
9e06e5c3 | 233 | echo "- Name : $PACKAGE_NAME" |
234 | echo "- Version : $PACKAGE_VERSION" | |
39cbc282 | 235 | echo "- Release : $PACKAGE_RELEASE" |
d287305c | 236 | fi |
33f5276d | 237 | } |
238 | ||
239 | Exit_error() | |
240 | { | |
00fcec7e | 241 | if [ -n "$DEBUG" ]; then |
0dd6320d | 242 | set -x; |
00fcec7e | 243 | set -v; |
71d62f04 | 244 | fi |
7c2dd1b2 | 245 | |
33f5276d | 246 | cd $__PWD |
247 | ||
4849ca8d | 248 | case "$1" in |
33f5276d | 249 | "err_no_spec_in_cmdl" ) |
250 | echo "ERROR: spec file name not specified."; | |
251 | exit 2 ;; | |
252 | "err_no_spec_in_repo" ) | |
253 | echo "Error: spec file not stored in CVS repo."; | |
254 | exit 3 ;; | |
255 | "err_no_source_in_repo" ) | |
4849ca8d | 256 | echo "Error: some source, patch or icon files not stored in CVS repo. ($2)"; |
33f5276d | 257 | exit 4 ;; |
258 | "err_build_fail" ) | |
298c753e | 259 | echo "Error: package build failed. (${2:-no more info})"; |
33f5276d | 260 | exit 5 ;; |
261 | esac | |
262 | } | |
bc8d444f | 263 | |
33f5276d | 264 | init_builder() |
265 | { | |
00fcec7e | 266 | if [ -n "$DEBUG" ]; then |
0dd6320d | 267 | set -x; |
00fcec7e | 268 | set -v; |
71d62f04 | 269 | fi |
7c2dd1b2 | 270 | |
7147050f AM |
271 | SOURCE_DIR="`$RPM --eval '%{_sourcedir}'`" |
272 | SPECS_DIR="`$RPM --eval '%{_specdir}'`" | |
bc8d444f | 273 | |
33f5276d | 274 | __PWD=`pwd` |
59398507 | 275 | } |
276 | ||
277 | get_spec() | |
278 | { | |
00fcec7e | 279 | if [ -n "$DEBUG" ]; then |
0dd6320d | 280 | set -x; |
00fcec7e | 281 | set -v; |
71d62f04 | 282 | fi |
7c2dd1b2 | 283 | |
6fc910c7 | 284 | if [ "$NOCVSSPEC" != "yes" ]; then |
285 | cd $SPECS_DIR | |
5644bf7e | 286 | |
6fc910c7 | 287 | OPTIONS="up " |
67fcd1e4 | 288 | |
6fc910c7 | 289 | if [ -n "$CVSROOT" ]; then |
290 | OPTIONS="-d $CVSROOT $OPTIONS" | |
291 | else | |
292 | if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then | |
293 | echo "warning: No cvs access defined - using local .spec file" | |
294 | NOCVSSPEC="yes" | |
295 | fi | |
296 | fi | |
00fcec7e | 297 | |
72e08ca8 | 298 | if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then |
6fc910c7 | 299 | OPTIONS="$OPTIONS -A" |
72e08ca8 AM |
300 | else |
301 | if [ -n "$CVSDATE" ]; then | |
0dd6320d | 302 | OPTIONS="$OPTIONS -D $CVSDATE" |
72e08ca8 AM |
303 | fi |
304 | if [ -n "$CVSTAG" ]; then | |
0dd6320d | 305 | OPTIONS="$OPTIONS -r $CVSTAG" |
72e08ca8 | 306 | fi |
6fc910c7 | 307 | fi |
33f5276d | 308 | |
b92ecfc9 AM |
309 | result=1 |
310 | retries_counter=0 | |
311 | while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do | |
312 | retries_counter=$(( $retries_counter + 1 )) | |
313 | output=$(LC_ALL=C cvs $OPTIONS $SPECFILE 2>&1) | |
314 | result=$? | |
fef1dc85 | 315 | [ -n "$output" ] && echo "$output" |
b92ecfc9 | 316 | if [ "$result" -ne "0" ]; then |
67a44175 | 317 | if (echo "$output" | grep -qE "(Cannot connect to|connect to .* failed|Connection reset by peer|Connection timed out)") && [ "$retries_counter" -le "$CVS_RETRIES" ]; then |
ee004885 | 318 | echo "Trying again [$SPECFILE]... ($retries_counter)" |
96686ae5 | 319 | sleep 2 |
b92ecfc9 | 320 | continue |
0dd6320d | 321 | fi |
322 | Exit_error err_no_spec_in_repo; | |
b92ecfc9 AM |
323 | fi |
324 | done | |
33f5276d | 325 | fi |
6fc910c7 | 326 | if [ ! -f "$SPECFILE" ]; then |
b857906d | 327 | Exit_error err_no_spec_in_repo; |
6fc910c7 | 328 | fi |
a7af9862 | 329 | |
d013b3df | 330 | if [ "$CHMOD" = "yes" -a -n "$SPECFILE" ]; then |
7922b3ec | 331 | chmod $CHMOD_MODE $SPECFILE |
5aa0ef93 | 332 | fi |
7c2dd1b2 | 333 | unset OPTIONS |
67da0368 | 334 | grep -E -m 1 "^#.*Revision:.*Date" $SPECFILE |
59398507 | 335 | } |
336 | ||
4ca52257 JK |
337 | find_mirror(){ |
338 | ||
339 | cd "$SPECS_DIR" | |
00fcec7e | 340 | url="$1" |
6631fc57 | 341 | if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then |
00fcec7e | 342 | cvs update mirrors >&2 |
4ca52257 JK |
343 | fi |
344 | ||
345 | IFS="|" | |
346 | while read origin mirror name rest; do | |
00fcec7e | 347 | ol=`echo -n "$origin"|wc -c` |
4ca52257 JK |
348 | prefix="`echo -n "$url" | head -c $ol`" |
349 | if [ "$prefix" = "$origin" ] ; then | |
6fc910c7 | 350 | suffix="`echo "$url"|cut -b $ol-`" |
351 | echo -n "$mirror$suffix" | |
352 | return 0 | |
4ca52257 JK |
353 | fi |
354 | done < mirrors | |
355 | echo "$url" | |
356 | } | |
357 | ||
00fcec7e | 358 | src_no () |
359 | { | |
360 | cd $SPECS_DIR | |
ad6f43de | 361 | rpm_dump | \ |
0dd6320d | 362 | grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \ |
363 | sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \ | |
364 | head -1 | xargs | |
00fcec7e | 365 | } |
366 | ||
367 | src_md5 () | |
368 | { | |
369 | no=$(src_no "$1") | |
370 | [ -z "$no" ] && return | |
371 | cd $SPECS_DIR | |
0dd6320d | 372 | spec_rev=$(grep $SPECFILE CVS/Entries | sed -e s:/$SPECFILE/:: -e s:/.*::) |
373 | if [ -z "$spec_rev" ]; then | |
374 | spec_rev="$(head -1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')" | |
375 | fi | |
376 | spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')" | |
80dcd8ed | 377 | md5=$(grep -s -v '^#' additional-md5sums | \ |
0dd6320d | 378 | grep -E "[ ]$(basename "$1")[ ]+${spec}([ ,]|\$)" | \ |
379 | sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \ | |
380 | grep -E '^[0-9a-f]{32}$') | |
6d2b8f55 | 381 | if [ X"$md5" = X"" ] ; then |
0dd6320d | 382 | grep -i "#[ ]*Source$no-md5[ ]*:" $SPECFILE | sed -e 's/.*://' | xargs |
6d2b8f55 | 383 | else |
0dd6320d | 384 | if [ $(echo "$md5" | wc -l) != 1 ] ; then |
385 | echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2 | |
386 | fi | |
387 | echo "$md5" | tail -1 | |
6d2b8f55 | 388 | fi |
00fcec7e | 389 | } |
390 | ||
391 | distfiles_url () | |
392 | { | |
8963720e | 393 | echo "$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")" |
00fcec7e | 394 | } |
395 | ||
d99ac371 MM |
396 | good_md5 () |
397 | { | |
398 | md5=$(src_md5 "$1") | |
399 | [ "$md5" = "" ] || \ | |
400 | [ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ] | |
401 | } | |
402 | ||
25fa34fe | 403 | get_files() |
59398507 | 404 | { |
25fa34fe AM |
405 | GET_FILES="$@" |
406 | ||
00fcec7e | 407 | if [ -n "$DEBUG" ]; then |
0dd6320d | 408 | set -x; |
00fcec7e | 409 | set -v; |
71d62f04 | 410 | fi |
7c2dd1b2 | 411 | |
25fa34fe | 412 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then |
7053d3fd | 413 | cd $SOURCE_DIR |
33f5276d | 414 | |
82c46005 | 415 | OPTIONS="up " |
7053d3fd | 416 | if [ -n "$CVSROOT" ]; then |
c1e79fcd | 417 | OPTIONS="-d $CVSROOT $OPTIONS" |
6fc910c7 | 418 | else |
419 | if [ ! -s CVS/Root -a "$NOCVS" != "yes" ]; then | |
420 | echo "warning: No cvs access defined for SOURCES" | |
421 | NOCVS="yes" | |
422 | fi | |
67fcd1e4 | 423 | fi |
0dd6320d | 424 | if [ -z "$CVSDATE" -a -z "$CVSTAG" ]; then |
425 | OPTIONS="$OPTIONS -A" | |
426 | else | |
427 | if [ -n "$CVSDATE" ]; then | |
428 | OPTIONS="$OPTIONS -D $CVSDATE" | |
429 | fi | |
430 | if [ -n "$CVSTAG" ]; then | |
431 | OPTIONS="$OPTIONS -r $CVSTAG" | |
432 | fi | |
433 | fi | |
25fa34fe | 434 | for i in $GET_FILES; do |
81474543 | 435 | if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then |
4a0bb672 | 436 | if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then |
6fc910c7 | 437 | echo "Warning: no URL given for $i" |
157dc315 | 438 | fi |
a7af9862 | 439 | |
fc0e5bb5 | 440 | if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then |
d99ac371 | 441 | if good_md5 "$i"; then |
f67349b7 | 442 | echo "$(nourl "$i") having proper md5sum already exists" |
443 | continue | |
444 | fi | |
00fcec7e | 445 | target=$(nourl "$i") |
446 | url=$(distfiles_url "$i") | |
6aefe77b JR |
447 | if [ `echo $url | grep -E '^(\.|/)'` ] ; then |
448 | ${GETLOCAL} $url $target | |
449 | else | |
450 | if [ -z "$NOMIRRORS" ] ; then | |
451 | url="`find_mirror "$url"`" | |
00fcec7e | 452 | fi |
6aefe77b JR |
453 | ${GETURI} -O "$target" "$url" || \ |
454 | if [ `echo $url | grep -E 'ftp://'` ]; then | |
455 | ${GETURI2} -O "$target" "$url" | |
456 | fi | |
457 | test -s "$target" || rm -f "$target" | |
458 | fi | |
de6b5b2a MM |
459 | elif [ -z "$(src_md5 "$i")" ] && \ |
460 | ( [ -z "$NOCVS" ] || echo $i | grep -qvE '(ftp|http|https)://' ); then | |
b92ecfc9 | 461 | result=1 |
0dd6320d | 462 | retries_counter=0 |
463 | while [ "$result" != "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; do | |
464 | retries_counter=$(( $retries_counter + 1 )) | |
b92ecfc9 | 465 | output=$(LC_ALL=C cvs $OPTIONS `nourl $i` 2>&1) |
0dd6320d | 466 | result=$? |
fef1dc85 | 467 | [ -n "$output" ] && echo "$output" |
67a44175 | 468 | if (echo "$output" | grep -qE "(Cannot connect to|connect to .* failed|Connection reset by peer|Connection timed out)") && [ "$result" -ne "0" -a "$retries_counter" -le "$CVS_RETRIES" ]; then |
ee004885 | 469 | echo "Trying again [`nourl $i`]... ($retries_counter)" |
96686ae5 | 470 | sleep 2 |
b92ecfc9 | 471 | continue |
711eb1e4 AM |
472 | else |
473 | break | |
b92ecfc9 AM |
474 | fi |
475 | done | |
157dc315 | 476 | fi |
a7af9862 | 477 | |
b130abf2 | 478 | if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then |
00fcec7e | 479 | if [ -z "$NOMIRRORS" ] ; then |
3428d253 JB |
480 | im="`find_mirror "$i"`" |
481 | else | |
482 | im="$i" | |
6fc910c7 | 483 | fi |
3428d253 JB |
484 | ${GETURI} "$im" || \ |
485 | if [ `echo $im | grep -E 'ftp://'` ]; then ${GETURI2} "$im" ; fi | |
157dc315 SZ |
486 | fi |
487 | ||
de6b5b2a | 488 | |
422fbc56 TP |
489 | fi |
490 | srcno=$(src_no $i) | |
491 | if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then | |
492 | Exit_error err_no_source_in_repo $i; | |
493 | elif [ -n "$UPDATE5" ] && \ | |
494 | ( ( [ -n "$ADD5" ] && echo $i | grep -q -E 'ftp://|http://|https://' && \ | |
495 | [ -z "$(grep -E -i '^NoSource[ ]*:[ ]*'$i'([ ]|$)' $SPECS_DIR/$SPECFILE)" ] ) || \ | |
496 | grep -q -i -E '^#[ ]*source'$(src_no $i)'-md5[ ]*:' $SPECS_DIR/$SPECFILE ) | |
497 | then | |
498 | echo "Updating source-$srcno md5." | |
499 | md5=$(md5sum `nourl $i` | cut -f1 -d' ') | |
82db6b8d MM |
500 | perl -i -ne ' |
501 | print unless /^\s*#\s*Source'$srcno'-md5\s*:/i; | |
502 | print "# Source'$srcno'-md5:\t'$md5'\n" | |
503 | if /^Source'$srcno'\s*:\s+/; | |
504 | ' \ | |
422fbc56 TP |
505 | $SPECS_DIR/$SPECFILE |
506 | fi | |
507 | ||
508 | if good_md5 "$i"; then | |
509 | : | |
510 | else | |
511 | echo "MD5 sum mismatch. Use -U to refetch sources," | |
512 | echo "or -5 to update md5 sums, if you're sure files are correct." | |
513 | Exit_error err_no_source_in_repo $i | |
3ae81a20 | 514 | fi |
cc97f1f3 | 515 | done |
a7af9862 | 516 | |
5aa0ef93 | 517 | if [ "$CHMOD" = "yes" ]; then |
d013b3df AM |
518 | CHMOD_FILES="`nourl $GET_FILES`" |
519 | if [ -n "$CHMOD_FILES" ]; then | |
6fc910c7 | 520 | chmod $CHMOD_MODE $CHMOD_FILES |
d013b3df | 521 | fi |
5aa0ef93 | 522 | fi |
7c2dd1b2 | 523 | unset OPTIONS |
7053d3fd | 524 | fi |
59398507 | 525 | } |
526 | ||
1471f6d6 | 527 | tag_files() |
528 | { | |
529 | TAG_FILES="$@" | |
530 | ||
00fcec7e | 531 | if [ -n "$DEBUG" ]; then |
0dd6320d | 532 | set -x; |
00fcec7e | 533 | set -v; |
1471f6d6 | 534 | fi |
535 | ||
536 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then | |
0b9271b0 PG |
537 | echo "Version: $PACKAGE_VERSION" |
538 | echo "Release: $PACKAGE_RELEASE" | |
b4fd0ec0 | 539 | TAGVER=$PACKAGE_NAME-`echo $PACKAGE_VERSION | sed -e "s/\./\_/g" -e "s/@/#/g"`-`echo $PACKAGE_RELEASE | sed -e "s/\./\_/g" -e "s/@/#/g"` |
01de2036 JB |
540 | if [ "$TAG_VERSION" = "yes" ]; then |
541 | echo "CVS tag: $TAGVER" | |
542 | fi | |
543 | if [ -n "$TAG" ]; then | |
544 | echo "CVS tag: $TAG" | |
545 | fi | |
1471f6d6 | 546 | |
547 | OPTIONS="tag -F" | |
548 | if [ -n "$CVSROOT" ]; then | |
549 | OPTIONS="-d $CVSROOT $OPTIONS" | |
550 | fi | |
551 | ||
552 | cd $SOURCE_DIR | |
553 | for i in $TAG_FILES; do | |
554 | if [ -f `nourl $i` ]; then | |
f02788de JB |
555 | if [ "$TAG_VERSION" = "yes" ]; then |
556 | cvs $OPTIONS $TAGVER `nourl $i` | |
557 | fi | |
558 | if [ -n "$TAG" ]; then | |
559 | cvs $OPTIONS $TAG `nourl $i` | |
560 | fi | |
1471f6d6 | 561 | else |
4849ca8d | 562 | Exit_error err_no_source_in_repo $i |
1471f6d6 | 563 | fi |
564 | done | |
565 | ||
566 | cd $SPECS_DIR | |
f02788de JB |
567 | if [ "$TAG_VERSION" = "yes" ]; then |
568 | cvs $OPTIONS $TAGVER $SPECFILE | |
569 | fi | |
570 | if [ -n "$TAG" ]; then | |
571 | cvs $OPTIONS $TAG $SPECFILE | |
572 | fi | |
1471f6d6 | 573 | |
574 | unset OPTIONS | |
575 | fi | |
576 | } | |
577 | ||
8ba5cdda PG |
578 | branch_files() |
579 | { | |
a7af9862 | 580 | TAG=$1 |
581 | echo "CVS branch tag: $TAG" | |
582 | shift; | |
8ba5cdda | 583 | |
a7af9862 | 584 | TAG_FILES="$@" |
8ba5cdda | 585 | |
a7af9862 | 586 | if [ -n "$DEBUG" ]; then |
587 | set -x; | |
588 | set -v; | |
589 | fi | |
8ba5cdda | 590 | |
a7af9862 | 591 | if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then |
592 | ||
593 | OPTIONS="tag -b" | |
594 | if [ -n "$CVSROOT" ]; then | |
595 | OPTIONS="-d $CVSROOT $OPTIONS" | |
8ba5cdda | 596 | fi |
a7af9862 | 597 | cd $SOURCE_DIR |
598 | for i in $TAG_FILES; do | |
599 | if [ -f `nourl $i` ]; then | |
600 | cvs $OPTIONS $TAG `nourl $i` | |
601 | else | |
602 | Exit_error err_no_source_in_repo $i | |
603 | fi | |
604 | done | |
605 | cd $SPECS_DIR | |
606 | cvs $OPTIONS $TAG $SPECFILE | |
607 | ||
608 | unset OPTIONS | |
609 | fi | |
8ba5cdda PG |
610 | } |
611 | ||
f308b816 | 612 | |
613 | ||
59398507 | 614 | build_package() |
615 | { | |
00fcec7e | 616 | if [ -n "$DEBUG" ]; then |
7922b3ec | 617 | set -x; |
00fcec7e | 618 | set -v; |
71d62f04 | 619 | fi |
7c2dd1b2 | 620 | |
33f5276d | 621 | cd $SPECS_DIR |
3d97a432 | 622 | |
00fcec7e | 623 | if [ -n "$TRY_UPGRADE" ]; then |
a7af9862 | 624 | |
625 | if [ -n "FLOAT_VERSION" ]; then | |
626 | TNOTIFY=`./pldnotify.awk $SPECFILE -n` | |
627 | else | |
628 | TNOTIFY=`./pldnotify.awk $SPECFILE` | |
629 | fi | |
630 | ||
3d97a432 | 631 | TNEWVER=`echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }'` |
a7af9862 | 632 | |
0096b1ae | 633 | if [ -n "$TNEWVER" ]; then |
a7af9862 | 634 | |
3d97a432 | 635 | TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'` |
a7af9862 | 636 | |
3d97a432 | 637 | echo "New version found, updating spec file to version " $TNEWVER |
a7af9862 | 638 | |
3d97a432 | 639 | cp -f $SPECFILE $SPECFILE.bak |
a7af9862 | 640 | |
3d97a432 | 641 | chmod +w $SPECFILE |
a7af9862 | 642 | |
3d97a432 MK |
643 | eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE" |
644 | eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t1/' $SPECFILE" | |
a7af9862 | 645 | |
3d97a432 | 646 | parse_spec; |
a7af9862 | 647 | |
3d97a432 | 648 | get_files "$SOURCES $PATCHES"; |
a7af9862 | 649 | |
3d97a432 MK |
650 | unset TOLDVER TNEWVER TNOTIFY |
651 | fi | |
00fcec7e | 652 | |
3d97a432 MK |
653 | fi |
654 | ||
655 | ||
656 | cd $SPECS_DIR | |
657 | ||
79b2ec0e | 658 | case "$COMMAND" in |
659 | build ) | |
7922b3ec | 660 | BUILD_SWITCH="-ba" ;; |
79b2ec0e | 661 | build-binary ) |
662 | BUILD_SWITCH="-bb" ;; | |
663 | build-source ) | |
956d1492 | 664 | BUILD_SWITCH="-bs --nodeps" ;; |
79b2ec0e | 665 | esac |
d6a75d60 | 666 | if [ -n "$LOGFILE" ]; then |
00fcec7e | 667 | if [ -n "$CVSTAG" ]; then |
668 | LTAG="r_`echo $CVSTAG|sed -e 's/\./_/g'`_" | |
669 | else | |
670 | LTAG="" | |
671 | fi | |
972bd3c3 | 672 | LOG=`eval echo $LOGFILE` |
00fcec7e | 673 | if [ -n "$LASTLOG_FILE" ]; then |
674 | echo "LASTLOG=$LOG" > $LASTLOG_FILE | |
675 | fi | |
676 | RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM | |
677 | (nice -n ${DEF_NICE_LEVEL} time $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG | |
678 | RETVAL=`cat $RES_FILE` | |
679 | rm $RES_FILE | |
680 | if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then | |
0dd6320d | 681 | if [ "$RETVAL" -eq "0" ]; then |
00fcec7e | 682 | mv $LOG $LOGDIROK |
0dd6320d | 683 | else |
684 | mv $LOG $LOGDIRFAIL | |
00fcec7e | 685 | fi |
686 | fi | |
d6a75d60 | 687 | else |
7147050f | 688 | eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE |
f308b816 | 689 | RETVAL=$? |
d6a75d60 | 690 | fi |
33f5276d | 691 | |
f308b816 | 692 | if [ "$RETVAL" -ne "0" ]; then |
a7af9862 | 693 | |
00fcec7e | 694 | if [ -n "$TRY_UPGRADE" ]; then |
3d97a432 | 695 | echo "\n!!! Package with new version cannot be build automagically\n" |
3d97a432 | 696 | mv -f $SPECFILE.bak $SPECFILE |
3d97a432 | 697 | fi |
a7af9862 | 698 | |
33f5276d | 699 | Exit_error err_build_fail; |
700 | fi | |
a7af9862 | 701 | |
79b2ec0e | 702 | unset BUILD_SWITCH |
59398507 | 703 | } |
704 | ||
cc97f1f3 SZ |
705 | nourl() |
706 | { | |
a7af9862 | 707 | echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g' |
cc97f1f3 | 708 | } |
da946cd6 | 709 | #--------------------------------------------- |
710 | # main() | |
711 | ||
ba877a00 | 712 | if [ "$#" = 0 ]; then |
da946cd6 | 713 | usage; |
d764d255 | 714 | exit 1 |
da946cd6 | 715 | fi |
716 | ||
5a491465 | 717 | while test $# -gt 0 ; do |
718 | case "${1}" in | |
de6b5b2a | 719 | -5 | --update-md5 ) |
a9d9a79a TP |
720 | COMMAND="get"; |
721 | NODIST="yes" | |
722 | UPDATE5="yes" | |
723 | shift ;; | |
de6b5b2a MM |
724 | -a5 | --add-md5 ) |
725 | COMMAND="get"; | |
726 | NODIST="yes" | |
727 | NOCVS="yes" | |
728 | UPDATE5="yes" | |
729 | ADD5="yes" | |
730 | shift ;; | |
7c2dd1b2 | 731 | -D | --debug ) |
732 | DEBUG="yes"; shift ;; | |
bde1c404 | 733 | -V | --version ) |
4003ad8c | 734 | COMMAND="version"; shift ;; |
bde1c404 | 735 | -a | --as_anon ) |
62546902 | 736 | CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;; |
79b2ec0e | 737 | -b | -ba | --build ) |
4003ad8c | 738 | COMMAND="build"; shift ;; |
79b2ec0e | 739 | -bb | --build-binary ) |
740 | COMMAND="build-binary"; shift ;; | |
741 | -bs | --build-source ) | |
742 | COMMAND="build-source"; shift ;; | |
8ba5cdda PG |
743 | -B | --branch ) |
744 | COMMAND="branch"; shift; TAG="${1}"; shift;; | |
5dd89621 | 745 | -c | --clean ) |
746 | CLEAN="--clean --rmspec --rmsource"; shift ;; | |
bde1c404 | 747 | -d | --cvsroot ) |
4003ad8c | 748 | shift; CVSROOT="${1}"; shift ;; |
bde1c404 | 749 | -g | --get ) |
750 | COMMAND="get"; shift ;; | |
751 | -h | --help ) | |
752 | COMMAND="usage"; shift ;; | |
5a491465 | 753 | -l | --logtofile ) |
4003ad8c | 754 | shift; LOGFILE="${1}"; shift ;; |
3ae81a20 | 755 | -ni| --nice ) |
756 | shift; DEF_NICE_LEVEL=${1}; shift ;; | |
8bc51224 | 757 | -m | --mr-proper ) |
758 | COMMAND="mr-proper"; shift ;; | |
157dc315 SZ |
759 | -nc | --no-cvs ) |
760 | NOCVS="yes"; shift ;; | |
37f54b4a | 761 | -ncs | --no-cvs-specs ) |
6fc910c7 | 762 | NOCVSSPEC="yes"; shift ;; |
fc0e5bb5 TP |
763 | -nd | --no-distfiles ) |
764 | NODIST="yes"; shift ;; | |
4ca52257 JK |
765 | -nm | --no-mirrors ) |
766 | NOMIRRORS="yes"; shift ;; | |
157dc315 SZ |
767 | -nu | --no-urls ) |
768 | NOURLS="yes"; shift ;; | |
72fb89b5 | 769 | -ns | --no-srcs ) |
770 | NOSRCS="yes"; shift ;; | |
fd2b5687 MM |
771 | -ns0 | --no-source0 ) |
772 | NOSOURCE0="yes"; shift ;; | |
33a9d2d1 SZ |
773 | --opts ) |
774 | shift; RPMOPTS="${1}"; shift ;; | |
6049c3d1 | 775 | --with | --without ) |
a2d6aca2 | 776 | BCOND="$BCOND $1 $2" ; shift 2 ;; |
bde1c404 | 777 | -q | --quiet ) |
33f5276d | 778 | QUIET="--quiet"; shift ;; |
448deaa0 | 779 | --date ) |
780 | CVSDATE="${2}"; shift 2 ;; | |
67fcd1e4 | 781 | -r | --cvstag ) |
782 | shift; CVSTAG="${1}"; shift ;; | |
78ce14b3 | 783 | -Tvs | --tag-version-stable ) |
7922b3ec | 784 | COMMAND="tag"; |
78ce14b3 | 785 | TAG="STABLE" |
7922b3ec | 786 | TAG_VERSION="yes" |
787 | shift;; | |
a2164135 | 788 | -Tvn | --tag-version-nest ) |
7922b3ec | 789 | COMMAND="tag"; |
a2164135 | 790 | TAG="NEST" |
7922b3ec | 791 | TAG_VERSION="yes" |
792 | shift;; | |
78ce14b3 | 793 | -Ts | --tag-stable ) |
7922b3ec | 794 | COMMAND="tag"; |
78ce14b3 | 795 | TAG="STABLE" |
7922b3ec | 796 | TAG_VERSION="no" |
797 | shift;; | |
a2164135 | 798 | -Tn | --tag-nest ) |
7922b3ec | 799 | COMMAND="tag"; |
a2164135 | 800 | TAG="NEST" |
7922b3ec | 801 | TAG_VERSION="no" |
802 | shift;; | |
803 | -Tv | --tag-version ) | |
804 | COMMAND="tag"; | |
f02788de | 805 | TAG="" |
7922b3ec | 806 | TAG_VERSION="yes" |
807 | shift;; | |
1471f6d6 | 808 | -T | --tag ) |
7922b3ec | 809 | COMMAND="tag"; |
810 | shift | |
811 | TAG="$1" | |
812 | TAG_VERSION="no" | |
813 | shift;; | |
b130abf2 | 814 | -U | --update ) |
de6b5b2a MM |
815 | UPDATE="yes" |
816 | NODIST="yes" | |
817 | UPDATE5="yes" | |
818 | COMMAND="get" | |
819 | shift ;; | |
0096b1ae | 820 | -u | --try-upgrade ) |
3d97a432 | 821 | TRY_UPGRADE="1"; shift ;; |
a7af9862 | 822 | -un | --try-upgrade-with-float-version ) |
823 | TRY_UPGRADE="1"; FLOAT_VERSION="1"; shift ;; | |
b130abf2 TP |
824 | -v | --verbose ) |
825 | BE_VERBOSE="1"; shift ;; | |
c7ab67cf | 826 | --define) |
c24b056c | 827 | shift |
c7ab67cf SZ |
828 | MACRO="${1}" |
829 | VALUE="${2}" | |
830 | shift 2 | |
831 | RPMOPTS="${RPMOPTS} --define \"${MACRO} ${VALUE}\"" | |
832 | ;; | |
bde1c404 | 833 | * ) |
0fc6e9ec | 834 | SPECFILE="`basename ${1} .spec`.spec"; shift ;; |
5a491465 | 835 | esac |
836 | done | |
837 | ||
00fcec7e | 838 | if [ -n "$DEBUG" ]; then |
a7af9862 | 839 | set -x; |
00fcec7e | 840 | set -v; |
71d62f04 | 841 | fi |
7c2dd1b2 | 842 | |
bde1c404 | 843 | case "$COMMAND" in |
79b2ec0e | 844 | "build" | "build-binary" | "build-source" ) |
33f5276d | 845 | init_builder; |
8a7fc6f7 | 846 | if [ -n "$SPECFILE" ]; then |
59398507 | 847 | get_spec; |
848 | parse_spec; | |
298c753e AM |
849 | |
850 | if [ -n "$FAIL_IF_CHANGED_BUT_NOT_BUMPED" ]; then | |
b4fd0ec0 | 851 | TAGVER=$PACKAGE_NAME-`echo $PACKAGE_VERSION | sed -e "s/\./\_/g" -e "s/@/#/g"`-`echo $PACKAGE_RELEASE | sed -e "s/\./\_/g" -e "s/@/#/g"` |
298c753e | 852 | CURTAGREL=$(cvs status $SPECFILE | grep "Working revision:" | awk '{ print $3 }') |
1f188001 | 853 | TAGREL=$(cvs status -v $SPECFILE | grep -E "^[[:space:]]*${TAGVER}[[[:space:]]" | sed -e 's#.*(revision: ##g' -e 's#).*##g') |
298c753e AM |
854 | |
855 | if [ -n "$TAGREL" -a "$TAGREL" != "$CURTAGREL" ]; then | |
856 | Exit_error err_build_fail "not bumped ver-rel - was already used in rev $TAGREL" | |
857 | fi | |
858 | fi | |
859 | ||
25fa34fe | 860 | if [ -n "$ICONS" ]; then |
0dd6320d | 861 | get_files $ICONS; |
862 | parse_spec; | |
25fa34fe | 863 | fi |
f9a62a6a | 864 | if [ -n "$NOSOURCE0" ] ; then |
865 | SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'` | |
866 | fi | |
25fa34fe | 867 | get_files "$SOURCES $PATCHES"; |
59398507 | 868 | build_package; |
869 | else | |
33f5276d | 870 | Exit_error err_no_spec_in_cmdl; |
59398507 | 871 | fi |
872 | ;; | |
8ba5cdda | 873 | "branch" ) |
0dd6320d | 874 | init_builder; |
8ba5cdda PG |
875 | if [ -n "$SPECFILE" ]; then |
876 | get_spec; | |
877 | parse_spec; | |
878 | if [ -n "$ICONS" ]; then | |
879 | get_files $ICONS | |
880 | parse_spec; | |
881 | fi | |
882 | get_files $SOURCES $PATCHES; | |
883 | branch_files $TAG "$SOURCES $PATCHES $ICONS"; | |
884 | else | |
885 | Exit_error err_no_spec_in_cmdl; | |
886 | fi | |
0dd6320d | 887 | ;; |
bde1c404 | 888 | "get" ) |
33f5276d | 889 | init_builder; |
8a7fc6f7 | 890 | if [ -n "$SPECFILE" ]; then |
59398507 | 891 | get_spec; |
892 | parse_spec; | |
25fa34fe | 893 | if [ -n "$ICONS" ]; then |
7922b3ec | 894 | get_files $ICONS |
895 | parse_spec; | |
25fa34fe | 896 | fi |
fd2b5687 MM |
897 | if [ -n "$NOSOURCE0" ] ; then |
898 | SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'` | |
899 | fi | |
bc441b0c | 900 | get_files $SOURCES $PATCHES |
bde1c404 | 901 | else |
33f5276d | 902 | Exit_error err_no_spec_in_cmdl; |
bde1c404 | 903 | fi |
904 | ;; | |
1471f6d6 | 905 | "tag" ) |
906 | init_builder; | |
907 | if [ -n "$SPECFILE" ]; then | |
908 | get_spec; | |
909 | parse_spec; | |
910 | if [ -n "$ICONS" ]; then | |
7922b3ec | 911 | get_files $ICONS |
912 | parse_spec; | |
1471f6d6 | 913 | fi |
bc441b0c | 914 | get_files $SOURCES $PATCHES; |
1471f6d6 | 915 | tag_files "$SOURCES $PATCHES $ICONS"; |
916 | else | |
917 | Exit_error err_no_spec_in_cmdl; | |
918 | fi | |
919 | ;; | |
8bc51224 | 920 | "mr-proper" ) |
7147050f | 921 | $RPM --clean --rmsource --rmspec --force --nodeps $SPECFILE |
8bc51224 | 922 | ;; |
bde1c404 | 923 | "usage" ) |
924 | usage;; | |
4003ad8c | 925 | "version" ) |
926 | echo "$VERSION";; | |
bde1c404 | 927 | esac |
9e06e5c3 | 928 | |
929 | cd $__PWD |