Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] RPM build errors when creating multiple rpms
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2008-03-25 20:56:11


On Mar 19, 2008, at 1:48 PM, Michael Jennings wrote:
> On Tuesday, 18 March 2008, at 18:18:36 (-0700),
> Christopher Irving wrote:
>
>> Well you're half correct. You're thinking that _prefix is always
>> defined as /usr.
>
> No, actually I'm not. :)
>
>> But in the case were install_in_opt is defined they have redefined
>> _prefix to be /opt/%{name}/%{version} in which case it is fine for
>> one of the openmpi rpms to claim that directory with a %dir
>> directive.
>
> Except that you should never do that. First off, RPMs should never
> install in /opt by default.

The community Open MPI projects distributes SRPMs which, when built,
do not install into /opt by default -- you have to request it
specifically.

> Secondly, the correct way to support
> installing in /opt is to list the necessary prefixes in the RPM
> headers so that the --prefix option (or the --relocate option) may be
> used at install time.

Well, we sorta do this, but not entirely. :-\ Perhaps I could use
some of your advice; I am *not* an RPM expert...

The overriding theme to the specfile is that Open MPI installs a *LOT*
of files (the SVN trunk currently installs 640 files). The exact list
of files also changes over time; I did not want to have to list them
in the specfile because they would pretty much be guaranteed to get
out of sync with the real set of files that is installed.

Right now, the specfile treats it differently if we are building "one
big RPM" or multiple sub-RPMs. In the one big RPM case:

-----
%files
%defattr(-, root, root, -)
%{_prefix}
# If the sysconfdir is not under the prefix, then list it explicitly.
%if !%{sysconfdir_in_prefix}
%{_sysconfdir}
%endif
# If %{instal_in_opt}, then we're instaling OMPI to
# /opt/openmpi/<version>. But be sure to also explicitly mention
# /opt/openmpi so that it can be removed by RPM when everything under
# there is also removed.
%if %{install_in_opt}
%dir /opt/%{name}
%endif
# If we're installing the modulefile, get that, too
%if %{install_modulefile}
%{modulefile_path}
%endif
# If we're installing the shell scripts, get those, too
%if %{install_shell_scripts}
%{shell_scripts_path}/%{shell_scripts_basename}.sh
%{shell_scripts_path}/%{shell_scripts_basename}.csh
%endif
%doc README INSTALL LICENSE
-----

Let's discuss each of these in particular...

1. We are explicitly listing %{_prefix}, which is what you are
suggesting that we should *not* do. Instead, should I build a file of
of filenames (e.g., via a big "find" in %install) and list %files -f
<whatever>?

2. I explicitly list sysconfdir when it's not in the prefix on the
argument that it may be in a different tree, and therefore may need to
be created (or deleted when there's nothing left in it).

3. Similar arugment for /opt/{%name} -- it will likely need to be
created, and it should be removed when the RPM is installed.

4. Explicitly list the modulefile; who knows where it will be.

5. Similar argument for %{shell_scripts_path}.

Here's what we do in the build-multiple-RPMs case -- let's do the
runtime sub RPM first:

-----
%files runtime -f runtime.files
%defattr(-, root, root, -)
%dir %{_prefix}
# If the sysconfdir is not under the prefix, then list it explicitly.
%if !%{sysconfdir_in_prefix}
%{_sysconfdir}
%endif
# If %{instal_in_opt}, then we're instaling OMPI to
# /opt/openmpi/<version>. But be sure to also explicitly mention
# /opt/openmpi so that it can be removed by RPM when everything under
# there is also removed. Also list /opt/openmpi/<version>/share so
# that it can be removed as well.
%if %{install_in_opt}
%dir /opt/%{name}
%dir /opt/%{name}/%{version}/share
%endif
# If we're installing the modulefile, get that, too
%if %{install_modulefile}
%{modulefile_path}
%endif
# If we're installing the shell scripts, get those, too
%if %{install_shell_scripts}
%{shell_scripts_path}/%{shell_scripts_basename}.sh
%{shell_scripts_path}/%{shell_scripts_basename}.csh
%endif
%dir %{_bindir}
%dir %{_libdir}
%dir %{_libdir}/openmpi
%doc README INSTALL LICENSE
%{_pkgdatadir}
%{_bindir}/mpirun
%{_bindir}/mpiexec
%{_bindir}/ompi_info
%{_bindir}/orterun
%{_bindir}/orted
-----

1. Much the same as the all-in-one RPM, but we have a runtime.files
file that lists all OMPI *.so files in it. However, there are many
more files than just the *.so files, so we keep going.

2. I *%dir* %{_prefix} here, assuming that it won't be /usr. However,
I can see how that might not be true. It's listed because I wanted it
removed if OMPI was the last set of files in that tree to be removed.

3. Christopher has good points about the %if block about sysconfdir; I
think he's right -- the %if block doesn't need to be there
(particularly because I used %dir).

4. Similar rationale to the all-in-one for /opt/%{name}, modulefile,
and shell scripts.

5. Add the %dir's for bin, lib, and lib/openmpi so that they'll be
removed when this RPM is uninstalled.

6. List pkgdatadir and specific executables in the bindir.

Now for the devel sub-RPM:

-----
%files devel -f devel.files
%defattr(-, root, root, -)
%{_includedir}
%{_bindir}/mpicc
%{_bindir}/mpiCC
%{_bindir}/mpic++
%{_bindir}/mpicxx
%{_bindir}/mpif77
%{_bindir}/mpif90
%{_bindir}/opal_wrapper
-----

Just list the wrapper compilers and the includedir.

Finally, the docs sub RPM:

-----
# Note that we list the mandir specifically here, because we want all
# files found in that tree, because rpmbuild may have compressed them
# (e.g., foo.1.gz or foo.1.bz2) -- and we therefore don't know the
# exact filenames.
%files docs
%defattr(-, root, root, -)
%{_mandir}
------

Just list the top man dir and get everything in it.

I suspect you might hate much of this because we *do* list directories
in many places, for two reasons:

- so they'll be removed when the OMPI RPM(s) is(are) uninstalled
- so we don't have to list every single file

If this is wholly wrong, please feel free to tell me (and suggest a
better way); I'd rather have a standards-conformant RPM.

Thanks!

-- 
Jeff Squyres
Cisco Systems