Handling of multiple Portfile versions

Rainer Müller raimue at macports.org
Mon Nov 9 08:38:29 PST 2015


On 2015-11-09 17:08, Artur Szostak wrote:
> 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.

> 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.

> 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'.

> 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.

Rainer


More information about the macports-dev mailing list