]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- the spec file does not need to know about preserve_env_base
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 21 Mar 2009 22:18:52 +0000 (22:18 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm.macros -> 1.513

rpm.macros

index 91cc3a4a6edf5ba7d971b588012ee4821f1bac42..4d26ad6953864f1d1bb61e851657a866feefe9e2 100644 (file)
 # 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 " ");
        }
 }')
 
This page took 0.036837 seconds and 4 git commands to generate.