Determine dependencies of another port
Joshua Root
jmr at macports.org
Sat Jul 17 19:11:10 UTC 2021
On 2021-7-15 20:26 , Haren Samarasinghe wrote:
> I'm trying to write an NPM portgroup, part of which involves setting the
> correct version of npm and the corresponding version of nodejs as a
> port's dependencies.
>
> From some port A, how would I find if port B has C as a dependency? As
> an example, how would I find out in the portgroup that npm4 goes with
> nodejs8?
There would be hacky ways of doing that, but why not just depend on npm4
and let its dependencies be handled automatically?
> I thought about manually hardcoding it into the PG, but then this would
> have to be regularly updated and could lead to conflicts if not done
> properly. I also thought about setting npm/nodejs as path deps, but that
> doesn't work when the port requires a newer node version.
If there's a true need to have the information in both places, then the
Don't Repeat Yourself principle is good, but I think the structure
should be reversed. The npm* portfiles should get the information about
which nodejs* to depend on from the same place as the new portgroup,
possibly the portgroup itself, or a separate portgroup if it's too
difficult to make including the npm portgroup work in the npm ports.
- Josh
More information about the macports-dev
mailing list