Subport known but not found (was: Re: "concurrent" qt4-mac: request feedback & testing for current port phase in Portfile?)

René J.V. Bertin rjvbertin at gmail.com
Fri Dec 12 10:40:02 PST 2014


On Friday December 12 2014 12:03:48 Ryan Schmidt wrote:

> > I have yet to figure out the rules here, but one thing I tripped over when I was experimenting with subports is that this can be recursive. That is, if you select the subport, then $name is the subport name and the subport declaration ends up having the wrong name.
> 
> Mmmm, nope. ${name} is the top-level portname. ${subport} is the subport name. It's perfectly normal to declare a subport as "subport ${name}-something"; I do it all the time.

Indeed, replacing ${name}-transitional with qt4-mac-transitional didn't change a thing.

I got it to work though (hoping it will keep working...) after checking out a hunch.

I had begun my work on +concurrent thinking I might at some point be forced to opt for a different port name, so I moved most of the Portfile payload into a separate file, leaving my Portfile as

{{{
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 126922 2014-10-17 18:50:56Z ryandesign at macports.org $
                           
PortSystem          1.0    
                   
name                qt4-mac
version             4.8.6
revision            2
     
if {[catch {source "${portpath}/Portfile.qt4"} err]} {
    puts stderr "Error reading Portfile.qt4: $err"
    return 1;
}
}}}

This had the added benefit that I could edit Portfile.qt4 at will without ever risking an automatic `port clean` ;)

Apparently portindex does execute and support the source command (IIRC it does bail on syntax errors in there), but not in a complete way. After moving the subport declaration

{{{
subport ${name}-transitional {
}   
}}}

into the Portfile, the subport was also picked up by portindex.

In short, I'm almost there ...

R


More information about the macports-dev mailing list