SOURCES: rpm.macros - the spec file does not need to know about preserve_en...

glen glen at pld-linux.org
Sat Mar 21 23:18:58 CET 2009


Author: glen                         Date: Sat Mar 21 22:18:58 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- the spec file does not need to know about preserve_env_base

---- Files affected:
SOURCES:
   rpm.macros (1.512 -> 1.513) 

---- Diffs:

================================================================
Index: SOURCES/rpm.macros
diff -u SOURCES/rpm.macros:1.512 SOURCES/rpm.macros:1.513
--- SOURCES/rpm.macros:1.512	Sat Mar 21 23:07:45 2009
+++ SOURCES/rpm.macros	Sat Mar 21 23:18:52 2009
@@ -137,32 +137,35 @@
 # redefine %_preserve_env in following manner:
 #
 #	# ADDITIONAL_VAR is required because [a good reason here]
-#	%define _preserve_env %_preserve_env_base ADDITIONAL_VAR
+#	%define _preserve_env ADDITIONAL_VAR
 
 %_preserve_env_base	PATH HOME TMP TMPDIR SSH_AUTH_SOCK
-%_preserve_env %_preserve_env_base
 
-%_clean_env		env -i %(awk -vq="'" -vqq="\\"'\\"" -vq2q="'\\"'" 'BEGIN {
+%_clean_env		\
+	%{!?_preserve_env:%global _preserve_env %{nil}}%{expand:%%global _preserve_env %{_preserve_env} %_preserve_env_base} \
+	env -i %(awk -vq="'" -vqq="\\"'\\"" -vq2q="'\\"'" 'BEGIN {
 	split("%{?_preserve_env:%_preserve_env}", P);
 	for (i in P) {
 		p = P[i];
-		if (ENVIRON[p]) {
-			split( ENVIRON[p], V, "" );
-			val = p "=";
-			for ( j = 1; j in V; j++ ) {
-				v = V[j];
-				if ( v == q )
-					v = qq;
-				else if ( v == "\\"" )
-					v = q2q;
-				else if ( v == "\\\\" )
-					v = "\\\\\\\\";
-				else
-					gsub( "[^a-zA-Z0-9/:._-]", "\\"&\\"", v );
-				val = val "" v;
-			}
-			printf( val " " );
+		if (!ENVIRON[p] || d[p]) {
+			continue;
 		}
+		d[p] = 1;
+		split(ENVIRON[p], V, "");
+		val = p "=";
+		for (j = 1; j in V; j++) {
+			v = V[j];
+			if (v == q)
+				v = qq;
+			else if (v == "\\"")
+				v = q2q;
+			else if (v == "\\\\")
+				v = "\\\\\\\\";
+			else
+				gsub("[^a-zA-Z0-9/:._-]", "\\"&\\"", v);
+			val = val "" v;
+		}
+		printf(val " ");
 	}
 }')
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/rpm.macros?r1=1.512&r2=1.513&f=u



More information about the pld-cvs-commit mailing list