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

Andreas Wacknitz a.wacknitz at gmx.de
Tue Jan 4 18:00:39 UTC 2022


Am 04.01.22 um 07:39 schrieb Tim Mooney via oi-dev:
> In regard to: Re: [oi-dev] manually specifying dependencies between...:
>
>>
>> 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.
>
> Thanks Andreas!  That's the clearest explanation I've seen of that, and
> it does help to clear up some things.
>
> So thinking not about scripting languages but instead a traditional
> ELF binary that's linked against multiple libraries, when I do a
>
>     gmake install; gmake REQUIRED_PACKAGES
>
> pkg is adding build-time dependencies to the Makefile, but a later
>
>     gmake publish
>
> is also adding the same dependencies to the package automatically as
> runtime dependencies, correct?  It must be, based on ELF linkage,
> otherwise we would have a lot of packages that don't have correct runtime
> dependencies because we're not (manually) specifying them in the
> manifest.

I don't know. As it hasn't been a problem yet, I didn't care to look
into it.


>
>> 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.
>
> Oh, interesting, I wasn't aware that pkg5 wasn't really even being used.
> I assumed that was some critical metadata that pkg used.
>
>>> 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.
>
> In the case that prompted my question, it would be both.
>
> For example the perl/File-Listing module has an unrecorded build-time
> and runtime dependency on library/perl-5/http-date for the same version
> of perl (i.e. library/perl-5/file-listing-524 needs
> library/perl-5/http-date-524).
>
> It's needed at build time to run the test suite.
>
> It's also needed at runtime for the correct functioning of the module.
>
> I want to correctly record that file-listing for one version of perl
> needs http-date from the same version of perl.
>
> In this case, am I correct in thinking I should be doing both of these
> things:
>
> 1) manually add REQUIRED_PACKAGES += library/perl-5/http-date-###
> to the Makefile for the build-time dependency.
>
> 2) add
>
>     depend fmri=library/perl-5/http-date-$(PLV) type=require
>
> to the manifest as a runtime dependency?

Yes, to my knowledge. I am still learning myself.

Andreas



More information about the oi-dev mailing list