aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-05-08 15:08:48 +0200
committerOliver Smith <osmith@sysmocom.de>2020-05-08 15:08:48 +0200
commit9cf3a0a01ac5f0d450d13b76316623782aec0760 (patch)
tree17a95df311100bec6ba165e78ca9254b15091eae
parent56c7e4f720d808ba653c3f1c43682e7b7292482b (diff)
build_pkg.sh: only install systemd-rpm-macros if needed
-rwxr-xr-xrpm-local/scripts/build_pkg.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/rpm-local/scripts/build_pkg.sh b/rpm-local/scripts/build_pkg.sh
index 8354bf4..4d0e0f2 100755
--- a/rpm-local/scripts/build_pkg.sh
+++ b/rpm-local/scripts/build_pkg.sh
@@ -22,13 +22,14 @@ for arch in $ARCHES; do
fi
done
-# HACK: install systemd-rpm-macros unless we are building it now, so the spec files can be parsed
-if [ "$1" != "systemd-rpm-macros" ]; then
+cd /home/user/rpmbuild/SPECS
+
+# Install systemd-rpm-macros if needed, so the .spec can be parsed
+if grep "^BuildRequires:" "$1.spec" | grep -q systemd-rpm-macros; then
dnf -y install systemd-rpm-macros
fi
# keepcache: /var/cache/dnf is mounted from outside docker dir, so downloaded rpm depends are cached
-cd /home/user/rpmbuild/SPECS
dnf \
--setopt=keepcache=1 \
-y \