Skip to content
Permalink
Browse files

[RPM] Make buildrpm.sh more robust and fix -b flag usage

  • Loading branch information
daniviga authored and nyalldawson committed Mar 26, 2019
1 parent 841f234 commit 31d2786a62190c5d334bec1372872024206549dc
Showing with 26 additions and 12 deletions.
  1. +25 −11 rpm/buildrpms.sh
  2. +1 −1 rpm/default.cfg
@@ -3,8 +3,12 @@
# buildrpms.sh
# ---------------------
# Date : March 2014
# Copyright : (C) 2014 by Matthias Kuhn
# Copyright : (C) 2014-2019 by Matthias Kuhn
# Email : matthias at opengis dot ch
# ---------------------
# Date : October 2017
# Copyright : (C) 2017-2019 by Daniele Viganò
# Email : daniele at vigano dot me
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
@@ -14,6 +18,11 @@
# #
###########################################################################

if [ $_BUILDRPMS_DEBUG ]
then
set -x
fi

function print_info
{
echo -e "\e[0;32m$1\033[0m"
@@ -40,7 +49,8 @@ Usage:

function compress
{
if command -v pbzip2 &> /dev/null; then
if command -v pbzip2 &> /dev/null
then
echo 'pbzip2'
else
echo 'bzip2'
@@ -142,7 +152,7 @@ then

print_info "Creating source tarball"
# Create source tarball
git -C .. archive --format=tar --prefix=qgis-$version/ HEAD | compress > sources/qgis-$version.tar.bz2
git -C .. archive --format=tar --prefix=qgis-$version/ HEAD | $(compress) > sources/qgis-$version.tar.bz2

print_info "Creating source package"
# Build source package
@@ -156,12 +166,12 @@ then
exit 1
fi

srpm=$(grep -e 'Wrote: .*\.src\.rpm' $OUTDIR/build.log |
sed 's_Wrote: /builddir/build/SRPMS/\(.*\)_\1_')

print_info "Source package created: $srpm"
fi

srpm="$(ls -t $OUTDIR/qgis-$version-$relver.*.src.rpm | head -n 1 ||
(print_error "Source package unavailable. Abort"; exit 1))"

if [ "$srpm_only" -eq "1" ]
then
exit 0
@@ -171,14 +181,18 @@ fi
for arch in "${ARCHS[@]}"
do :
print_info "Building packages for $arch"
if [ -f $OUTDIR/$arch/build.log ]
if [ -d $OUTDIR/$arch ]
then
print_info "Cleaning log file"
rm $OUTDIR/$arch/build.log
if [ -f $OUTDIR/$arch/build.log ]
then
print_info "Cleaning log file"
rm $OUTDIR/$arch/build.log
fi
else
mkdir $OUTDIR/$arch
fi
mkdir $OUTDIR/$arch

if ! mock -r $arch --rebuild $OUTDIR/$srpm \
if ! mock -r $arch --rebuild $srpm \
--define "_relver $relver" \
--define "_version $version" \
--define "_timestamp $timestamp" \
@@ -6,7 +6,7 @@
# maintainer.

# Where should the results go
OUTDIR="result/"
OUTDIR="result"

# Which arches to build for. Check /etc/mock for possible options
ARCHS=(

0 comments on commit 31d2786

Please sign in to comment.
You can’t perform that action at this time.