DNF vs YUM, $pkg, $pkg-mpi, $pkg-openmpi having same provides

T.C. Hollingsworth tchollingsworth at gmail.com
Thu Jun 18 23:10:49 UTC 2015


On Sun, Jun 14, 2015 at 7:28 AM, Sandro Mani <manisandro at gmail.com> wrote:
> Having had a go at this: if bar{-openmpi} requires foo-{openmpi}, filtering
> the provides from foo-openmpi and adding an explicit requires to bar-openmpi
> on foo-openmpi, this all will result in bar-openmpi depending both on
> foo-openmpi as well as foo. Obviously the requires could be filtered as
> well, but then things would start really getting cluttered with syntax
> overhead...
>
> I was rather thinking, is there an obvious disadvantage in having a
> {mpich,openmpi}-find-requires.sh script which encodes the mpi flavour in the
> provides/requires? I.e.
>
> libfoo.so.0()(64bit)(openmpi)
>
> Rules to generate such requires/provides:
> * Provides: if the path of the library starts with $MPI_LIB, append the
> (openmpi) resp (mpich) to the provides string
> * Requires: 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
>
> Overriding the find-requires.sh could be done with a
> %{?openmpi_package_header}.

You don't have to override the internal dependency generator.  In
fact, you really shouldn't because overriding it also overrides
portions of rpm's multilib handling.  :-(

Patching find-(requires|provides) in /usr/lib/rpm is also useless, as
modern versions of rpm use an internal dependency generator instead.
(I think these scripts only still exist in modern Fedora because some
old external srpms hardcode it, overriding the internal dependency
generator.)

You should instead use the new depdendency generator hooks, which are
also quite a bit nicer to work with. All you have to do is create a
file %{_rpmconfigdir}/fileattrs/openmpi.attrs with something like:

# the path to your provides generating script
%__openmpi_provides %{_rpmconfigdir}/openmpi.prov
# the path to your requires generating script
%__openmpi_requires %{_rpmconfigdir}/openmpi.req
# a regular expression that paths in an RPM
# must match to trigger the generator
%__openmpi_path ^%{_prefix}/lib(64)/(openmpi|mpich)/.*$

When this file is present and any file is packaged during rpmbuild
that matches the regular expression in the last entry, the scripts
listed in the first two entries are executed.  Just as with
find-(provides|requires) a newline-seperated list of files in the
package is provided on the standard input (but in this case only those
which match the regular expression!) and you provide the Requires or
Provides to add on the standard output.

You can look in your /usr/lib/rpm/fileattrs directory for some hints.  :-)

Once you've got it working, you could propose a patch to
redhat-rpm-config to add it universally for all packages.  Or, if you
don't want to block on rpm changes and have more freedom to update it
in the future, you could create a new package for it and add it as a
dependency of both openmpi and mpich.

-T.C.


More information about the devel mailing list