[oi-dev] manually specifying dependencies between scripting language modules

Andreas Wacknitz a.wacknitz at gmx.de
Tue Jan 4 06:13:21 UTC 2022


Am 04.01.22 um 06:10 schrieb Tim Mooney via oi-dev:
>
> All-
>
> My basic question is what the best practice is for how packagers
> should be
> specifying dependencies between language modules/libraries for scripting
> languages?  Currently I'm specifically interested in perl modules, but
> the same idea is relevant for python, ruby, etc.
>
> As an example of one way to do it, there's
> oi-userland/components/perl/libwww-perl/libwww-perl-PERLVER.p5m.
> Alexander manually added all of the modules that are needed for
> libwww-perl-###, using the most obvious, "friendly" syntax for depend:
>
>     depend fmri=library/perl-5/encode-locale-$(PLV) type=require
>     depend fmri=library/perl-5/file-listing-$(PLV) type=require
>     depend fmri=library/perl-5/html-parser-$(PLV) type=require
>
> etc.
>
> Doing it that way, though, those dependencies don't get added to Makefile
> when you do "gmake REQUIRED_PACKAGES", and they don't appear to be added
> to the "pkg5" metadata after a successful publish.

This is intended. The requirements modeled in the Makefile (and thus in
pkg5) are BUILD dependencies whereas depend actions in the manifest are
RUNTIME dependencies. Alas our tools are not good at detecting runtime
dependencies and sometimes fail on build dependencies (eg. for test
requirements). So we need to manually add missing dependencies. The
actual state of both, runtime and build dependencies is lacking. And
sometimes you'll be hit by this fact when you build or install packages
locally. This is also a reason why sometimes local builds are fine while
they fail on the build server (and vice versa).


>
> The same is true if you want to make a language module depend upon the
> version of the perl interpreter it was built for.  I first tried using
> this syntax:
>
>     depend fmri=runtime/perl-$(PLV) type=require
>
> or variants of it as outlined in the pkg guide, like:
>
>     depend fmri=pkg:/runtime/perl-$(PLV) type=require
>
> Dependencies specified that way aren't output by REQUIRED_PACKAGES.
>
> However, if you change the syntax to a "less obvious" method:
>
>     depend fmri=__TBD pkg.debug.depend.file=perl \
>         pkg.debug.depend.path=usr/perl5/$(PERLVER)/bin type=require
>
> then REQUIRED_PACKAGES *does* add the dependency to the Makefile and the
> pkg5 metadata.  That's a trick that Aurélien has used in some places.

When IPS is working (eg. by running pkg install) it does not have access
to the information in the Makefiles or pkg5.
 From what I know pkg5 files aren't yet used at all. They are artifacts
from future enhancements of the build tools Aurélien has been working on.

>
> So what's the right thing to do here?  Use the simple syntax in the .p5m
> file and don't care that the dependency isn't listed in the Makefile or
> pkg5?  Use the more complicated syntax, with "fmri=__TBD" and a file and
> path from the dependency?  Don't specify anything in the .p5m file and
> instead manually add the dependency in the Makefile, as you might for
> a build dependency?

It depends on what you want to model: build dependency, runtime
dependency or both.


>
> I'm happy to fix up missing inter-module dependencies when I find them,
> but I would like to follow whatever the best practice is for these types
> of dependencies.
>
> Thanks,
>
> Tim
>
Andreas



More information about the oi-dev mailing list