Programmatically finding dependencies for a Portfile

Artur Szostak aszostak at partner.eso.org
Thu May 28 07:16:45 PDT 2015


Thanks,

    set mport [mportopen "file:///tmp/testport" [list subport "testsubport"] [list]]

Is exactly what is needed to select data for a specific subport.

Cheers

Artur

________________________________________
From: Rainer Müller [raimue at macports.org]
Sent: 28 May 2015 15:45
To: Artur Szostak; macports-dev‎
Subject: Re: Programmatically finding dependencies for a Portfile

On 2015-05-28 14:44, Artur Szostak wrote:
> package require macports
> mportinit
> set mport [mportopen "file:///tmp/testport" [list] [list]]

If you want a specific subport, you would need to give its name in the
list of options here. This list of options consists of pairs of key and
value as list items.

set mport [mportopen "file:///tmp/testport" [list subport "testsubport"] [list]]

> array unset portinfo
> array set portinfo [mportinfo $mport]
> mportclose $mport
> array set depsdict {depends_build build depends_lib lib depends_run run}
> foreach deptype [array names depsdict] {
>     if {[info exists portinfo($deptype)] && \
>         [string length $portinfo($deptype)] > 0} \
>     {
>         foreach dependency $portinfo($deptype) {
>             puts "$depsdict($deptype) $dependency"
>         }
>     }
> }
> _______________________________________________________
>
> How can I access the dependencies for the subports?
> Is there any developers manual that I could refer to?
> Is the API and structures documented anywhere?

Unfortunately, the internal API is very sparsely documented if at all...

There is a section dedicated to it in the the guide, but as you already
got this far, you seem to know most of its content already.

https://guide.macports.org/#internals.apis


Hope that helps,
Rainer


More information about the macports-dev mailing list