build.env-append working with merger in muniversal?
Michael Dickens
michaelld at macports.org
Wed Sep 15 06:50:54 PDT 2010
"Brief" update after more hacking around this yesterday:
(1) One issue is found at base/src/port1.0/portutil.tcl:754, which reads
++++++++++++++++++
while {[regexp "^(?: *)(\[^= \]+)=(\"|'|)(\[^\"'\]*?)\\2(?: +|$)(.*)$" ${the_environment} matchVar key delimiter value remaining]} {
++++++++++++++++++
The regexp search string is not catching variables with values that start with, literally, \" -- it finds those with any of: ", ', or nothing at all. It does find those with spaces in them, so long as the delimiters are correct. One way to fix this issue is to do a 'strsed' before this 'while' command, to change any instances of \" -> "; I think this would be safe, or, rather, I can't think of a reason to use \" in an argument -- I think port internally converts a " into \", so this change would just convert it back. I'm sure there's a way to augment the regexp match string, but I don't have time right now to get into it.
(2) In doing these experiments, I found that if I append the same environment variable more than once to build.env (or any other *.env), then only the last version is used -- and, no warnings or such are printed. It's simple enough to check for this issue and print a warning; I'd also propose concatenating the various flags -- seems like a better solution than ignoring some. Here's the diff that does both:
++++++++++++++++++
Index: base/src/port1.0/portutil.tcl
===================================================================
--- base/src/port1.0/portutil.tcl (revision 71479)
+++ base/src/port1.0/portutil.tcl (working copy)
@@ -753,6 +753,12 @@
while {[regexp "^(?: *)(\[^= \]+)=(\"|'|)(\[^\"'\]*?)\\2(?: +|$)(.*)$" ${the_environment} matchVar key delimiter value remaining]} {
set the_environment ${remaining}
+ if {[info exists ${command}.env_array(${key})]} {
+ ui_debug "Warning: Multiple values provided for ${command} environment variable '${key}'; concatenating them."
+ set previous_key_val [set ${command}.env_array(${key})]
+ set concat_val [concat ${previous_key_val} ${value}]
+ set value [join ${concat_val} " "]
+ }
set ${command}.env_array(${key}) ${value}
}
} else {
++++++++++++++++++
(3) The change to merge Python-compiled files when doing +universal using muniversal is as follows. Note that I copy from 'dir2' instead of 'dir1', since for some reason doing so avoids a timestamp issue when doing 'import numpy':
++++++++++++++++++
Index: dports/_resources/port1.0/group/muniversal-1.0.tcl
===================================================================
--- dports/_resources/port1.0/group/muniversal-1.0.tcl (revision 71479)
+++ dports/_resources/port1.0/group/muniversal-1.0.tcl (working copy)
@@ -507,6 +507,11 @@
# nothing has worked so far.
switch -glob ${fl} {
+ *.pyc {
+ # pyc files can be different.
+ ui_debug "universal: merge: ${prefixDir}/${fl} differs in ${base1} and ${base2}; assume trivial difference"
+ copy ${dir2}/${fl} ${dir}
+ }
*.jar {
# jar files can be different because of timestamp
ui_debug "universal: merge: ${prefixDir}/${fl} differs in ${base1} and ${base2}; assume timestamp difference"
++++++++++++++++++
More information about the macports-dev
mailing list