Handling of multiple Portfile versions

Artur Szostak aszostak at partner.eso.org
Mon Nov 9 09:10:58 PST 2015

>> Is MacPorts supposed to work correctly if multiple repositories are added to the /opt/local/etc/macports/sources.conf file, each with a different version of the Portfile, but with the same port name?
>> In such a scenario with multiple versions, I notice that things like the following do not appear to work as expected, i.e. the wrong version is selected or the dependencies are not followed:
> Yes, this is supported. Only one Portfile per port name will be
> considered by MacPorts. The first ports tree that contains a port by
> that name in the order listed in sources.conf will be used. All other
> Portfiles in ports trees listed below that are not considered at all for
> any port action.

OK, if it is supposed to work then either I seriously do not understand how the port command is supposed to work or there are bugs.
Let me be more specific with my example. Lets say I start with a clean installation of MacPorts and have two repositories with the port "myport" (category "science"):
ftp://my.server.org/repoA  (this contains myport version 3.4)
ftp://my.server.org/repoB  (this contains myport version 1.2)

I add both repositories on separate lines to the sources.conf file like so:


I then run:

sudo port sync

At this point I refer back to my previous list of commands ... (see below)

>> port install myport @1.2
> This syntax is not supported for 'port install'. The port with this name
> is installed, you cannot specify a version.

OK, then given my specific example above, how do I install myport version 1.2 rather than version 3.4? Or conversely, how do I install version 3.4 rather than 1.2? It seems like you are telling me MacPorts will make a random selection and there is no way to control this. If that is the case then surely concurrent multiple versions of Portfiles from different repositories are not properly supported.

>> port install myport version:1.2
> These arguments actually form an expression which is expanded into a
> list of ports: name:myport or version:1.2
> "version:" is a pseudo-port that expands to all ports that match the
> given expression, in this case treated as a regex. Therefore, this
> expression actually matches a lot of ports. You can test this with 'port
> echo'.

OK, I misunderstood the selection mechanism of the port command. How about the following alternative, should that work?

port install myport and version:1\.2
port activate myport and version:1\.2

>> port activate myport @1.2
>> port activate myport version:1.2
>> port uninstall --follow-dependencies myport @1.2
>> port uninstall --follow-dependencies myport version:1.2
> Dependencies should be followed by what is specified in the Portfile at
> the time the port was installed.
> The behavior you see is probably explained by the syntax of the
> pseudo-port version: as explained above. The @version syntax should work
> to choose the port in case multiple versions are installed.

So if the command with the @version syntax is not following the dependencies when using the --follow-dependencies option, then I have a bug?

Adjusting the second command alternative, should the following work also?

port uninstall --follow-dependencies myport and version:1\.2



More information about the macports-dev mailing list