From: Elan Ruusamäe Date: Mon, 9 Nov 2020 13:28:28 +0000 (+0200) Subject: Improve rpm.org detection X-Git-Tag: auto/th/rpm-build-tools-4.9-8~7 X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm-build-tools.git;a=commitdiff_plain;h=e267517f208dae6ee42da97e4380b9735a8b65bf;hp=7a83f50c06c2a3ae1f39a80c2ddc82298b067563 Improve rpm.org detection Need to detect rpm 4.5 as non-rpm.org flavor --- diff --git a/builder.sh b/builder.sh index 7d11e10..11e01ef 100755 --- a/builder.sh +++ b/builder.sh @@ -475,6 +475,23 @@ Usage: builder [--all-branches] [-D|--debug] [-V|--version] [--short-version] [ " } +is_rpmorg() { + local v + + v=$(rpm --version 2>&1) + v=${v#RPM version } # rpm 4 + v=${v#rpm (RPM) } # rpm 5 + + case "$v" in + 4.5|5.*) + return 1 + ;; + 4.*) + return 0; + ;; + esac +} + # create tempfile. as secure as possible tempfile() { local prefix=builder.$PACKAGE_NAME${1:+.$1} @@ -688,7 +705,8 @@ EOF %_sourcedir ./ EOF fi - if rpm --version 2>&1 | grep -qE '5\.[0-9]+\.[0-9]+'; then + if ! is_rpmorg; then + local safe_macrofiles safe_macrofiles=$(rpm $TARGET_SWITCH --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); print $0 } ') eval PATH=$CLEAN_PATH $RPMBUILD $TARGET_SWITCH --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $* 2>&1 else