request for port create command, to build a portfile from a URL

Enrico Maria Crisostomo enrico.m.crisostomo at gmail.com
Wed Mar 7 09:23:48 UTC 2018


Hi Ken,

I think it's a great idea. I'm maintaining a lot of software both on my personal machines and at work using MacPorts and I've setup some local Makefile targets to do some of this work. Perhaps I could contribute some work on this area, but first I'd like to know what is it that we'd like to have.

What is currently working for me is a very simple, template-based approach. Since 90% of the time I'm dealing with ports using the github portgroup, I'm basically calculating the relevant variables (port name, version, checksums, etc.) and fill in a template. The template is a file where shell expansion is performed (i.e.: variables in the form ${VAR}) are expanded.) I think this approach could be both very useful and simple to maintain if we had a list of pre-defined templates. It doesn't scale well with the number of different templates to support and their complexity. If we needed templates to have logic in it (flow control, expressions, etc.),then my guts say we should move to a suitable templating engine (or a different kind of solution altogether).

I've had a look at portfile-gen and it's a nice source of inspiration. Yet, I'm not convinced that outputting text directly from the program flow is either easy to read or easily maintainable, especially if complexity goes up.

portfile-gen, if I understand correctly, supports the following groups:

  * perl5
  * php 
  * python 
  * ruby
  * github

If we extracted a template for each one of those groups (or more templates in case a group may have multiple templates), then the effort required to come up with a working prototype would be implementing the functions required to populate the environment (i.e.: downloading a file if needed, calculating checksums, examining it). Perhaps we would have to split a Portfile in multiple segments, and generate each segment from a specific template (e.g.: if a port requires GNU Autotools).

What are your gut feelings about a template-based solution? Do you think it would be able to manage the level of Portfile complexity we desire for this tool?

Cheers,
-- 
Enrico


> On 7 Mar 2018, at 01:27, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
> 
> 
> On 2018-03-06, at 7:19 AM, Joshua Root wrote:
> 
>> 
>> There's a fairly basic tool called portfile-gen in contrib. Improvements
>> are certainly welcome.
> 
> That is indeed a step towards what I was thinking of.
> 
> I'll look at this. 
> 
> Ken
> 



More information about the macports-dev mailing list