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