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