[packages/rpm-build-tools] Improve rpm.org detection

glen glen at pld-linux.org
Mon Nov 9 14:32:42 CET 2020


commit e267517f208dae6ee42da97e4380b9735a8b65bf
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Nov 9 15:28:28 2020 +0200

    Improve rpm.org detection
    
    Need to detect rpm 4.5 as non-rpm.org flavor

 builder.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
---
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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/7ec99798c543ac5f0761f9c2afbfb70f4f92890f



More information about the pld-cvs-commit mailing list