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