Re: Dependency generator hooks and extending default requires/provides

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 July 2015 at 00:27, Sandro Mani <manisandro@xxxxxxxxx> wrote:
> I'm looking at extending the requires and provides strings returned by
> rpmdeps (background: [1]), and it was suggested to me to use dependency
> generator hooks to accomplish this [2].
>
> My initial experiment is
>
> $ cat /usr/lib/rpm/fileattrs/mpi.attrs
> # the path to your provides generating script
> %__mpi_provides %{_rpmconfigdir}/mpi.prov
> # the path to your requires generating script
> %__mpi_requires %{_rpmconfigdir}/mpi.req
> # a regular expression that paths in an RPM
> # must match to trigger the generator
> %__mpi_path ^%{_prefix}/lib(64)/(openmpi|mpich)/.*$
>
> $ cat /usr/lib/rpm/mpi.prov
> #!/bin/sh
> /usr/lib/rpm/rpmdeps --provides
>
> $ cat /usr/lib/rpm/mpi.req
> #!/bin/sh
> /usr/lib/rpm/rpmdeps --requires
>
> This however triggers what appears to be an endless recursion of calls
> mpi.prov -> rpmdeps -> mpi.prov -> rpmdeps -> etc

(...)

> Without any knowledge of the rpm codebase, I figure what is happening is
> that rpmdeps internally honours %__mpi_provides, which causes the endless
> loop.

Yes.
rpmdeps will check if the .attr files' rules match files and if yes,
will run the command in the .prov & .req scripts used in the .attr
files.*
As you call rpmdeps in one of those scripts, you've a loop

> So my question: is there any way to write dependency generator hooks which
> take the output of stock rpmdeps --requires resp. --provides and extend it
> with some additional text?

Just tell in mpo.attr what files are of interest for you and write a
script that compute the additional deps that are missing by rpmdeps
with default attr files
You've to write a script that will actually output the
"libfoo.so()(64bit)(mpich-x86_64)" requires/provides you want.
You must _NOT_ call rpmdeps.
Rpmdeps is just the high level program that collects the deps computed
by the various *.prov/*.req scripts according to *.attr rules.

So according to your links,
mpi.prov should do sg like

"if the path of the library starts with $MPI_LIB, append the
(openmpi) resp (mpich) to the provides string"

mpi.req should do sg like:
"if the path of the scanned object starts with $MPI_LIB and the
required library exists in $MPI_LIB, add (openmpi) resp (mpich) to the
requires string"

You'll still got the generic "libfoo.so()(64bit)" provides but as
you'll provides & requires additional tags.

Alternatively, you could alter elfdeps directly so that it changes the
"libfoo.so()" requires/provides for additional tags but I would not do
that.
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux