Releasing code as portgroup instead of in base/

Ryan Schmidt ryandesign at
Mon Oct 13 15:51:36 PDT 2014

On Oct 13, 2014, at 5:31 PM, Daniel J. Luke wrote:
> On Oct 13, 2014, at 6:19 PM, Ryan Schmidt wrote:
>>  There's no difference in the capabilities of code in a portgroup vs code in a portfile.
> portfiles are usually simpler than portgroups (almost by definition).
> a portfile that looks like a few key-value pairs is a lot easier to trust/validate than something that sources a bunch of tcl from a portgroup.

I suppose so. I never considered that there might be users that would actually read a port's / portgroup's / base's code to validate it before installing a port. Do such people actually exist?

In any case, the point of putting code into a portgroup is to abstract out code common to a set of ports. It's easier to write that code once, correctly, than to copy and paste it into several ports where it has a chance to become out of sync and incorrect. It should also be easier for an interested reader to read and understand that code once in one place than to see it repeated all over the place, and especially to understand any subtle differences that might exist between the copies.

>> I also see a problem if a port uses a portgroup, and wants to use two different ports, at different revisions, that expect different versions of the portgroup. Is this kind of problem the reason why you're against portgroups?
> this is one of the reasons why I find them somewhat problematic, yes.
> Another way to look at it is that generally the portgroup is unversioned (and an end user doesn't necessarily know which version of a portgroup was used when a particular port was installed).

We do have versionability in portgroups, it just hasn't been used much so far.

But in terms of revisions of portgroup, anyone who cares can find out what revision of the portgroup was in use at the time the port was installed. The portfile that was used is in the installed archive, its $Id$ line contains the port's revision, and the corresponding revision of the portgroup that existed at that time can be obtained.

>> I do want there to be lots of metadata about ports on the new MacPorts web site, including information such as results of buildbot builds. If we get to the point of automating test runs that could be included as well. The web site could also make that information available to the command line MacPorts program in some way if we wanted to do that.
> I think that would be great.
> If I were writing macports from scratch, I might have 'remote portfiles' be the default, you would ping a portfile server to see what was available, or pull whatever recipe for building a port that you selected. End users could select various criteria that they wanted enforced (only install ports that have been reviewed by a MP committer, only install ports that passed a test suite, only install ports that are GPL compliant, only instal ports that built on the buildbot...). It could be simpler for people to (attempt to) install a port at a particular version/revision too.
> ... but those additional capabilities are probably of marginal utility for most people, so I don't think that they're reasonable immediate design goals - instead there are clearly some areas where we can and should continue to improve.

Mhm, I think these days the "sudo port selfupdate" step is a stumbling block for many, who expect things to just automatically be up to date.

>>>> Because if so, that would be stifling, and if not, then I don't see it working very well, since it's previous been very convenient to be able to make changes in portgroups simultaneously with changes in ports. Losing that ability will make working with portgroup more difficult.
>>> it's not all or nothing, but I think we should generally push more code into base/ (especially after an portgroup has matured somewhat) rather than pushing for more and more code out of base/
>> Even for decade-old build systems like imake that are only used by a handful of ports?
> yes, for as long as we wanted to support imake builds
>> That would for me be the definition of special-case code that doesn't belong in base.
> most of base could be construed as special-case code ;-)

I can't really understand this position at all. In my view, most of base deals with things most ports need.

>> The other thing I really like about portgroups is that all code related to a particular thing is contained within a single file. When I want to investigate a feature in base, I have to first use grep to figure out what file(s) the code is in, and it's usually spread out all over the place. In the case of imake support, it's only in two files, portconfigure.tcl and portutil.tcl, but that first file is 800 lines long and, like most of base, hard to read, for someone otherwise only accustomed to reading portfiles. Having all the imake- (or whatever-) related code in a single short portgroup file is much easier to understand and change.
> it seems like that is a problem with base/ and our dev documentation (or lack of) which it would make sense to fix rather than work around it in that way.

We don't have any documentation of base, do we? And there are only a few comments in the code. We could try to document it, but that doesn't change the fact that if I'm dealing with providing support for a new build system, I want to do it in a single short file, not try to figure out where in several thousand-line long files it needs to go.

> It would probably even be possible/reasonable to keep the portgroup implementation the same, and just have base source (some?) from a base install location instead of (or in addition to) the ports tree.

Yeah, we could have multiple directories that portgroups could be stored in, with one location being provided by base and others by ports. I just again see moving a portgroup into base as merely decreasing our ability to develop it effectively without gaining anything for this inconvenience.

More information about the macports-dev mailing list