<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Ryan,<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 26, 2016, at 10:09 PM, Ryan Schmidt &lt;<a href="mailto:ryandesign@macports.org" class="">ryandesign@macports.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">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.<br class=""><br class="">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.<br class=""><br class="">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.<br class=""><br class="">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.<br class=""><br class="">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.<br class=""></div></div></blockquote><div><br class=""></div></div>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.&nbsp;</div><div class=""><br class=""></div><div class="">To implement this, I think the default value in base should be changed to the following for the next version of Macports for Sierra:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">platforms tiger leopard snowleopard lion mountainlion mavericks yosemite elcapitan sierra</font></div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Monaco" class="">platforms tiger leopard snowleopard mountainlion mavericks yosemite elcapitan sierra</font></div></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class="">or we expand base to allow a construct like:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">platforms-remove&nbsp;lion</font></div><div class=""><br class=""></div><div class="">Or maybe this functionality already exists?</div><div class=""><br class=""></div><div class="">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…</div><div class=""><br class=""></div><div class=""><div class=""><font face="Monaco" class="">platforms tiger leopard snowleopard mountainlion mavericks yosemite elcapitan sierra sequoia</font></div></div><div class=""><br class=""></div><div class="">For the&nbsp;libc++ issue, we simply add a keyword:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class="">requires_libc++ yes</font></div><div class=""><br class=""></div><div class="">The&nbsp;p5-graveyard port(s) can set the platforms variable to blank.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Cheers!</div><div class="">Frank</div><div class=""><br class=""></div></body></html>