port bump


As requested in a ticket, port bump has been partially implemented in GSoC 2019 as a sub-goal of the Xcode project.

The first PR discusses how it is implemented as a target (along with install, fetch, extract, etc.) in macports-base.

What's been done

Basic functionality

port bump updates the checksums of a Portfile if they are outdated or different than the current version's checksums. Additionally, the revision number will be reset.

--patch argument

port bump --patch creates a Portfile.patch file instead of directly overwriting the Portfile.

What hasn't been done

Interaction with the ports tree source

The output of port bump should change depending on the ports tree source. If it's not a git folder, then the changes of port bump might be overwritten in the next port selfupdate. This should be handled.

@version argument

Ideally, the port maintainer doesn't have to manually update the Portfile's version first before running port bump, instead with simply running port bump @version, MacPorts will change the version by itself. To implement this, something has to be changed on or before the fetch phase as (right now) it will download the version that is in the Portfile. An idea would be to modify replace what the port version is memory before running fetch, or do something like manually run portfetch::fetch_main in portbump.tcl with modifications instead of requiring the fetch phase (target_requires ${org.macports.bump} fetch).

This idea can be discussed further with the people from the PR or the Xcode project.

--livecheck argument

As the extension of the @version argument, port livecheck should be integrated somehow so MacPorts will bump to the latest version from livecheck.

Extended goals: batch bump, dry run, and Git actions

We could also implement a batch bump function that bumps a lot of ports at once. Doing this is dangerous unsupervised, so ideally it should also build and test the Port. Or it could run semi-automated with human supervision. To further extend the functionality, we could take inspiration from brew’s bump-formula-pr which can do a dry run (only printing what would be the changes) or automatically take Git actions, such as commits or opening a PR. Just like the batch functionality, the updated Port should first be built and test before being commit. To avoid over-automating, we could tell the user the link to open a PR instead of doing it for them. For example:

$ port bump
---> Bumping checksums for libpng
Version successfully updated. Suggested commit message:
    chromedriver: update to 6.6.3
Review your changes and open a Pull Request at:
Last modified 4 weeks ago Last modified on Aug 16, 2019, 11:15:25 AM