New features in 2.0.0

Joshua Root jmr at macports.org
Thu Jul 28 17:50:04 PDT 2011


Now that the customary week has passed since the release of 2.0.0, I
thought I'd point out some of the goodies that are now available to
portfile authors.

1. SHA256 checksums - should be self-explanatory.

2. The sqlite registry is now mandatory, which means workarounds for the
flat format can be removed, and you can have some certainty that your
deactivate and uninstall hooks will run for all users.

3. add_users - setting this option like this:

add_users user1 group=group1 home=${prefix}/var/user1 user2 group=group2

will check that users 'user1' and 'user2' exist, and if not, create them
with the specified attributes, both at build time and install time. This
is important when ports may be installed from archives. Available
attributes are the same as for adduser, see 'man portfile'. Direct use
of adduser should be replaced with this option whenever possible.

4. Subports. These allow you to define multiple ports in one portfile,
which can save a lot of code duplication. Use them like this:

name myport
...
subport myport2 { ... }
subport myport3 { ... }

In the above example, three ports are defined: myport, myport2, and
myport3. When portindex is run on this portfile, all three will be added
to the PortIndex.

When the portfile is executed, the body of each subport block will be
executed if and only if the 'subport' variable is set to the
corresponding subport name. This happens automatically most of the time,
e.g. 'port install myport' and 'port install myport2' will open the same
portfile, but with a different subport set.

If you're using the 'current' pseudo-port, you can choose a subport
explicitly on the command line just like overriding any other option,
i.e. by adding 'subport=whatever'.

Subports are used to implement the new unified python portgroup
(_resources/port1.0/group/python-1.0.tcl). See the comments in the file
for specific of how to use it.


We do, of course, need to get some docs for this stuff into the Guide.
In the meantime, feel free to ask questions about it on the list.

- Josh


More information about the macports-dev mailing list