About

About

Radiation physics, environmental contamination, and computational science. Researcher working for the Japan Atomic Energy Agency, in Kashiwa, Japan

Spotted an error on this site?
Corrections appreciated, please email alex (at) alexmalins.com or leave a comment.

Updating the version of a port on MacPorts

This post broadly follows the MacPorts howto/Upgrade guide: https://trac.macports.org/wiki/howto/Upgrade

If you come across a piece of software on MacPorts where the version is out of date, here’s how to update it. First open up a terminal window and identify the port’s maintainer:

port info --maintainers <portname>

If the port has a maintainer, easiest is to send them a polite email requesting the port is brought up to date.

If the port has no maintainer (nomaintainer@macports.org), or allows open maintenance (openmaintainer@macports.org), you can upgrade the port manually yourself with the following steps. If successful, you can then submit a new ticket to http://trac.macports.org/ in order for the update to be propagated onto the MacPorts server for the benefit of other users.

First change directory into the port folder:

cd $(port dir <portname>)

Backup the port build file:

sudo cp Portfile Portfile.orig

Use a text editor to edit the software version in the Portfile to the latest version number (e.g. version 1.4.1 to 1.5):

sudo nano Portfile

If the Portfile revision entry is not set to 0, set it to 0 as this is the first revision for the updated version. Now download the source code of the latest version of the port and find its checksums with the following command:

sudo port -d checksum <portname>

Copy the checksums (rmd160 and sha256) that are printed out for the for the latest version and paste them into place over the old checksums in the Portfile. Similarly, if the Portfile contains a livecheck.md5 entry, fetch this for the latest version and propagate it into the Portfile:

sudo port -d livecheck <portname>

You can now compile and install the latest version on your local machine by:

sudo port -d install <portname>

If the compile is successful and the updated software functions correctly, you can then file an update. First create a diff file for the changes to the Portfile:

diff -u Portfile.orig Portfile | sudo tee <portname>.diff

Then file a new ticket at http://trac.macports.org/. Give the ticket a title like:

<portname> @<current_version>: update to <latest_version>

Cc in the email address coupled to the port which you identified at the beginning of this process. Attach the <portname>.diff file. All being well one of the MacPorts team will use your patch and update the port to the latest version on the MacPorts server within the following days.

About Alex Malins

Alex is a researcher working for JAEA in radiation physics and environmental contamination.

Leave a reply

Your email address will not be published.