]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- add _clean_env with _preserve_env support
authorsparky <sparky@pld-linux.org>
Sun, 23 Nov 2008 18:54:07 +0000 (18:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm.macros -> 1.495

rpm.macros

index 62a2b46291367be6e2e1129c49a6866b0088817d..b334e6d5fe551d49aba52baad45178379b4a4b18 100644 (file)
         };
 }')
 
         };
 }')
 
+#-----------------------------------------------------------------
+#
+#  Generate a command which cleans environment, leaving only the
+# most important variables.
+#  If any spec requires any additional environment it should
+# redefine %_preserve_env in following manner:
+#
+#      # ADDITIONAL_VAR is required because [a good reason here]
+#      %{expand:%%define _preserve_env %_preserve_env ADDITIONAL_VAR}
+
+%_preserve_env HOME TMP TMPDIR
+
+%_clean_env            env -i %(awk 'BEGIN {
+       split("%{?_preserve_env:%_preserve_env}",P);
+       for ( i in P ) {
+               p = P[ i ];
+               if ( ENVIRON[ p ] ) {
+                       val = ENVIRON[ p ];
+                       gsub( /[\\\\"$`]/, "\\\\\\&", val );
+                       printf( "\\"" p "=" val "\\" ");
+               }
+       }
+}')
+
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
This page took 0.033897 seconds and 4 git commands to generate.