[MacPorts] #17182: Variables aren't expanded in path:-style dependencies
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- path:-style dependencies don't work as documented. The [http://guide.macports.org/#reference.dependencies.types documentation shows] this example: {{{ depends_run path:${prefix}/lib/libltdl.a:libtool }}} It turns out MacPorts doesn't actually expand variables here, so this doesn't work as intended. Furthermore, it turns out MacPorts actually prepends "`${prefix}/`" if the given path does not begin with a slash. So, 1) the Guide should show and recommend this simpler way to specify a dependency if it is in `${prefix}`: {{{ depends_run path:lib/libltdl.a:libtool }}} And it could show a different example using variable expansion in the path, if the path is not in `${prefix}` (a file in `${frameworks_dir}` perhaps) 2) MacPorts base should be fixed to expand variables so this works as advertised Ports that define dependencies using "`path:${prefix}/...`" should use "`path:...`" instead since this is shorter, simpler, and actually works with MacPorts 1.6.0. -- Ticket URL: <http://trac.macports.org/ticket/17182> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Changes (by ryandesign@macports.org): * cc: markd@macports.org, blb@macports.org (added) -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by ryandesign@macports.org): Changed all my ports to the new style in r41807. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by ryandesign@macports.org): Changed all openmaintainer ports to the new style in r41808. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by ryandesign@macports.org): Replying to [comment:3 ryandesign@…]:
Changed all openmaintainer ports to the new style in r41808.
Actually r41808 was for all nomaintainer ports. r41809 is for the openmaintainer ports. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Changes (by simon@macports.org): * cc: simon@macports.org, wsiegrist@apple.com (added) Comment: I committed the doc fix in r41866 and r41871. But I didn't add an example for `${frameworks_dir}` because I don't know how this works. By the way, it looks like the guide isn't updated on commit anymore. Simon -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by wsiegrist@apple.com): I broke guide regeneration at some point, but its fixed. Thanks for catching it for me. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by blb@macports.org): Replying to [ticket:17182 ryandesign@…]:
And it could show a different example using variable expansion in the path, if the path is not in `${prefix}` (a file in `${frameworks_dir}` perhaps)
Note that frameworks_dir is in ${prefix} (at least by default, unless --with-frameworks-dir is used with configure). Once variable expansion works, then the example could be {{{ path:${frameworks_dir}/MacPorts.framework/Versions/A/MacPorts:MacPorts_Framework }}} -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:7> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Changes (by ryandesign@macports.org): * cc: jmr@macports.org (added) Comment: Replying to [comment:ticket:16830:21 jmr@...]:
The problem with upgrading autoconf is actually that depspecs are auto- escaped, so variable substitution is not done, so it ends up looking for /opt/local/\${prefix}/bin/perl (because the prefix is prepended to any path that doesn't start with a slash.) Joshua, could you tell me where in the source this is? I'm having a hard time finding it.
-- Ticket URL: <http://trac.macports.org/ticket/17182#comment:8> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by blb@macports.org): Replying to [comment:8 ryandesign@…]:
Joshua, could you tell me where in the source this is? I'm having a hard time finding it.
I think he's referring to [http://trac.macports.org/browser/trunk/base/src/macports1.0/macports.tcl#L11... proc _pathtest]. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:9> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | --------------------------------------+------------------------------------- Comment(by jmr@macports.org): This problem only occurs with upgrade, where the depspecs are taken from the PortIndex, and not with install, where they are taken directly from the Portfile. The backslash in `\${prefix}` is there in the PortIndex, so it looks like the bug is either in the portindex command, or in the way data is loaded from the PortIndex. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:10> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by mcalhoun@…): Based on this discussion, could the problem be the following in portindex?: {{{ --- portindex 2008-11-04 09:06:00.000000000 -0500 +++ portindex.new 2008-11-21 21:02:26.000000000 -0500 @@ -38,7 +38,7 @@ incr stats(total) global macports::prefix set save_prefix $prefix - set prefix {\${prefix}} + set prefix {${prefix}} if {[catch {set interp [mportopen file://[file join $directory $portdir]]} result]} { puts stderr "Failed to parse file $portdir/Portfile: $result" # revert the prefix. }}} Making the change seems to have changed the \${prefix} to ${prefix} in a test Portindex file. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:12> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by ryandesign@…): Replying to [comment:12 mcalhoun@…]:
Making the change seems to have changed the \${prefix} to ${prefix} in a test Portindex file. But then you're just setting ${prefix} to itself. Why is there code that goes to the trouble of saving the prefix, setting it to a backslashed version of the prefix, and restoring it later? That code was added in r14567. We would first need to fully understand why it was added then, to understand whether we can safely remove it now. Cc'ing Paul, who committed that revision.
-- Ticket URL: <http://trac.macports.org/ticket/17182#comment:13> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Changes (by ryandesign@…): * cc: pguyot@… (added) Comment: Replying to [comment:13 ryandesign@…]:
That code was added in r14567. Actually it looks like it was added in r14532, bugfixed in r14545 and refined in r14567.
Paul, do you remember the motivation for and implication of this change? -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:14> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by jmr@…): I assume it's that way because the PortIndex is usually not generated on the local machine, so the prefix could be different. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:15> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by blb@…): Replying to [comment:15 jmr@…]:
I assume it's that way because the PortIndex is usually not generated on the local machine, so the prefix could be different.
I [http://thread.gmane.org/gmane.os.opendarwin.darwinports/13379 believe that was exactly the reason]. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:16> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by pguyot@…): It looks like quite a dirty hack.... I believe it was indeed done to cope with PortIndex generation. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:17> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by mcalhoun@…): Please correct me if I am wrong, but it seems that the situation is:[[BR]] * portindex [http://trac.macports.org/browser/trunk/base/src/port/portindex.tcl#L43 reads the Portfile] for dependencies. * /opt/local should not be in the Portindex, so portindex MIGHT try {{{ set prefix {${prefix}} }}} before reading, which would result in ${prefix} in Portindex (instead of /opt/local). * Unfortunately, when Portindex is read, ${prefix} is evaluated to an empty string in [http://trac.macports.org/browser/trunk/base/src/macports1.0/macports.tcl#L15... mportsearch]. * So what portindex [http://trac.macports.org/browser/trunk/base/src/port/portindex.tcl#L42 actually does] results in \${prefix} in Portindex. * Unfortunately, when the procedure [http://trac.macports.org/browser/trunk/base/src/macports1.0/macports.tcl#L11... _pathtest] is finally called, the argument depspec still contains \${prefix}, which is never evaluated. * Therefore, _pathtest not only [http://trac.macports.org/browser/trunk/base/src/macports1.0/macports.tcl#L11... prepends] the actual prefix, but, even if it didn't, would not work correctly because [http://trac.macports.org/browser/trunk/base/src/macports1.0/macports.tcl#L11... _mportsearchpath] is searching for something with \${prefix} in it. My Tcl is limited, so I do not know why {{{ set line [read $fd $len] }}} behaves the way it does if $fd contains ${prefix} (not \${prefix}). I tried a couple of things (like using eval) to have ${prefix} be evaluated in _pathtest, but all I could manage was to have an empty string for ${prefix}. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:18> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by jmr@…): I think the command you want is `subst`. But I don't know why you'd be getting an empty string and not an error. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:19> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts base bugs Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by mcalhoun@…): Replying to [comment:19 jmr@…]:
I think the command you want is `subst`. But I don't know why you'd be getting an empty string and not an error.
I was not able to get subst to work.[[BR]] Attached is a first attempt to correct the problem.[[BR]] I know it's not pretty, but it was the only thing I could get to work. The x11prefix (and eventually frameworks_dir and applications_dir) won't do anything without a modification to portindex. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:20> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by jmr@…): I think this may have been fixed "accidentally" by r44362, since it now grabs the portinfo from the portfile instead of using what's in the index. Will need to re-"break" a port and regenerate the index to test that theory, though. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:22> MacPorts <http://www.macports.org/> Ports system for Mac OS
#17182: Variables aren't expanded in path:-style dependencies --------------------------------------+------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: MacPorts 1.8.0 Component: base | Version: 1.6.0 Resolution: fixed | Keywords: Port: | --------------------------------------+------------------------------------- Changes (by jmr@…): * status: new => closed * resolution: => fixed * milestone: MacPorts Future => MacPorts 1.8.0 Comment: Did the testing, looks fixed. -- Ticket URL: <http://trac.macports.org/ticket/17182#comment:23> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts