How to parse a Portfile?

Frank Stock fstock at bytelightning.com
Fri Dec 1 00:27:37 UTC 2023


Section 6.4.1 has an interesting bullet…
"Ports API - API for Portfile parsing and execution”

I would like to extract information from a Portfile such as, version, license, add_users, startupitem, post-destroot, etc. for analysis/processing in a Node.js app.
Thought I might be able to use a Tcl Interpreter such as npm tcl or npm tcl-js to load from base/src/port1.0/ and obtain what I want using mportinfo.

But I confess, being a newbie to Tcl as well as MacPorts internals, after a day of “grep”, I still haven’t figured out how (or even if its possible) to load the API into an interpreter outside MacPorts?

Are there better ways to accomplish my goal of extracting Portfile info?
Wish I could just use “port info acme”, but add_users and post-destroot are some of the required pieces of info I need.

TIA,

-Frank


More information about the macports-dev mailing list