33# buildrpms.sh
44# ---------------------
55# Date : March 2014
6- # Copyright : (C) 2014 by Matthias Kuhn
6+ # Copyright : (C) 2014-2019 by Matthias Kuhn
77# Email : matthias at opengis dot ch
8+ # ---------------------
9+ # Date : October 2017
10+ # Copyright : (C) 2017-2019 by Daniele Viganò
11+ # Email : daniele at vigano dot me
812# ##########################################################################
913# #
1014# This program is free software; you can redistribute it and/or modify #
1418# #
1519# ##########################################################################
1620
21+ if [ $_BUILDRPMS_DEBUG ]
22+ then
23+ set -x
24+ fi
25+
1726function print_info
1827{
1928 echo -e " \e[0;32m$1 \033[0m"
4049
4150function compress
4251{
43- if command -v pbzip2 & > /dev/null; then
52+ if command -v pbzip2 & > /dev/null
53+ then
4454 echo ' pbzip2'
4555 else
4656 echo ' bzip2'
142152
143153 print_info " Creating source tarball"
144154 # Create source tarball
145- git -C .. archive --format=tar --prefix=qgis-$version / HEAD | compress > sources/qgis-$version .tar.bz2
155+ git -C .. archive --format=tar --prefix=qgis-$version / HEAD | $( compress) > sources/qgis-$version .tar.bz2
146156
147157 print_info " Creating source package"
148158 # Build source package
@@ -156,12 +166,12 @@ then
156166 exit 1
157167 fi
158168
159- srpm=$( grep -e ' Wrote: .*\.src\.rpm' $OUTDIR /build.log |
160- sed ' s_Wrote: /builddir/build/SRPMS/\(.*\)_\1_' )
161-
162169 print_info " Source package created: $srpm "
163170fi
164171
172+ srpm=" $( ls -t $OUTDIR /qgis-$version -$relver .* .src.rpm | head -n 1 ||
173+ (print_error " Source package unavailable. Abort" ; exit 1)) "
174+
165175if [ " $srpm_only " -eq " 1" ]
166176then
167177 exit 0
171181for arch in " ${ARCHS[@]} "
172182do :
173183 print_info " Building packages for $arch "
174- if [ -f $OUTDIR /$arch /build.log ]
184+ if [ -d $OUTDIR /$arch ]
175185 then
176- print_info " Cleaning log file"
177- rm $OUTDIR /$arch /build.log
186+ if [ -f $OUTDIR /$arch /build.log ]
187+ then
188+ print_info " Cleaning log file"
189+ rm $OUTDIR /$arch /build.log
190+ fi
191+ else
192+ mkdir $OUTDIR /$arch
178193 fi
179- mkdir $OUTDIR /$arch
180194
181- if ! mock -r $arch --rebuild $OUTDIR / $ srpm \
195+ if ! mock -r $arch --rebuild $srpm \
182196 --define " _relver $relver " \
183197 --define " _version $version " \
184198 --define " _timestamp $timestamp " \
0 commit comments