Determine before installation whether a port can be installed
mf2k at macports.org
mf2k at macports.org
Wed Jul 27 06:26:10 PDT 2016
> On Jul 26, 2016, at 10:09 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
> I would like MacPorts to be extended so that it can be determined in advance, from the command line, before running "port install", whether a port can be installed (barring unexpected build failures and bugs). Currently, MacPorts assumes any port can be installed on any system, which is not the case. Many ports cannot be built on certain versions of macOS. Some require libc++. Some require dependencies to be installed with a nondefault variant. Some have other requirements. Some ports, like p5-graveyard or other ports that serve as placeholders designed to inform the user of the discontinuation of a port, are designed to fail. Being able to determine in advance whether a port is supposed to be installable will let us skip those ports when triggering builds on the buildbot. This will cut down on unnecessary work performed by the buildbot, and will avoid unnecessary emails sent to maintainers who already know the port will fail in those circumstances.
> How can we accomplish this? We currently use "return -code error" to trigger these kinds of error messages from ports, but we do so within a phase, such as pre-configure or pre-fetch, but that means that code doesn't run until those phases are running, and I want to know before those phases run, indeed even before dependencies are calculated and installed.
> One solution that occurs to me is to define a new "preflight" phase, to be run before dependencies are computed. Ports can override that phase and do whatever checks they need and exit with "return -code error" if needed. This seems like the most straightforward and flexible solution.
> Another possible solution could be to define a new Boolean variable "installable" to indicate if the port is installable, which would default to "yes". If a port sets this to "no", MacPorts could print a generic failure message. There could be a second variable which the port developer could set to a custom failure message.
> A third possibility could be to codify each of the reasons why a build might fail, and introduce new variables for each reason. For example, a variable to indicate the supported C++ libraries, or a variable to indicate the supported macOS versions. There might be some advantage to this, in that it could be used to programmatically answer questions like what C++ libraries or macOS versions a port supports, but it is the least flexible and most complicated solution.
In my mind, the existing and largely useless “platform" variable should be re-purposed and used for this purpose. It currently usually says “darwin” but that could be expanded for each version of MacOS.
To implement this, I think the default value in base should be changed to the following for the next version of Macports for Sierra:
platforms tiger leopard snowleopard lion mountainlion mavericks yosemite elcapitan sierra
Then we remove the “platform” variable from all Portfiles when we release the new version of base. For ports that cannot build on, for example, lion the Portfile’s platforms variable can either be overridden as such:
platforms tiger leopard snowleopard mountainlion mavericks yosemite elcapitan sierra
or we expand base to allow a construct like:
Or maybe this functionality already exists?
For each new version of MacOS, we need to release a new version of base anyway. That version of base will get the new MacOS version added to the default “platforms” variable…
platforms tiger leopard snowleopard mountainlion mavericks yosemite elcapitan sierra sequoia
For the libc++ issue, we simply add a keyword:
The p5-graveyard port(s) can set the platforms variable to blank.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the macports-dev