Skip to content

Commit 70e6236

Browse files
authored
fix(openmpi): restore openmpi-devel subpackages
Restore the Azure Linux 3.0 OpenMPI packaging contract after the DOCA 3.3.0 update. The spec now: - keeps runtime files in openmpi - builds openmpi-devel and openmpi-docs - restores /usr/share/modulefiles/mpi/openmpi-<arch> This fixes the golden-container flow, which installs openmpi openmpi-devel and then loads mpi/openmpi before running mpiexec --version.
1 parent fa0446a commit 70e6236

1 file changed

Lines changed: 26 additions & 105 deletions

File tree

SPECS/openmpi/openmpi.spec

Lines changed: 26 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
# Define this to 1 if you want this RPM to install a modulefile.
7171
# type: bool (0/1)
72-
%{!?install_modulefile: %define install_modulefile 0}
72+
%{!?install_modulefile: %define install_modulefile 1}
7373

7474
# Root path to install modulefiles. If the value modulefile_path is
7575
# set, that directory is the root path for where the modulefile will
@@ -80,9 +80,9 @@
8080
# to check/process install_in_opt first.
8181

8282
# type: string (subdir to install modulefile)
83-
%{!?modulefile_subdir: %define modulefile_subdir %{name}}
83+
%{!?modulefile_subdir: %define modulefile_subdir mpi}
8484
# type: string (name of modulefile)
85-
%{!?modulefile_name: %define modulefile_name %{version}}
85+
%{!?modulefile_name: %define modulefile_name openmpi-%{_arch}%{?_cc_name_suffix}}
8686

8787
# The name of the modules RPM. Can vary from system to system.
8888
# RHEL6 calls it "environment-modules".
@@ -104,10 +104,6 @@
104104
# type: bool (0/1)
105105
%{!?build_debuginfo_rpm: %define build_debuginfo_rpm 0}
106106

107-
# Should we build an all-in-one RPM, or several sub-package RPMs?
108-
# type: bool (0/1)
109-
%{!?build_all_in_one_rpm: %define build_all_in_one_rpm 1}
110-
111107
# Should we use the default "check_files" RPM step (i.e., check for
112108
# unpackaged files)? It is discouraged to disable this, but some
113109
# installers need it (e.g., older versions of OFED, because they
@@ -181,7 +177,7 @@
181177
# Now that we have processed install_in_opt, we can see if
182178
# modulefile_path was not set. If it was not, then set it to a
183179
# default value.
184-
%{!?modulefile_path: %define modulefile_path /usr/share/Modules/modulefiles}
180+
%{!?modulefile_path: %define modulefile_path %{_datadir}/modulefiles}
185181

186182
%if !%{build_debuginfo_rpm}
187183
%define debug_package %{nil}
@@ -224,7 +220,7 @@ Summary: A powerful implementation of MPI/SHMEM
224220
Name: openmpi
225221
Epoch: 3
226222
Version: 4.1.9a1
227-
Release: 1%{?dist}
223+
Release: 2%{?dist}
228224
License: BSD
229225
Group: Development/Libraries
230226
# https://linux.mellanox.com/public/repo/doca/3.3.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-26.01-1.0.0.0.tgz
@@ -261,45 +257,6 @@ communication techniques.
261257
This RPM contains all the tools necessary to compile, link, and run
262258
Open MPI and OpenSHMEM jobs.
263259

264-
%if !%{build_all_in_one_rpm}
265-
266-
#############################################################################
267-
#
268-
# Preamble Section (runtime)
269-
#
270-
#############################################################################
271-
272-
%package runtime
273-
Summary: Tools and plugin modules for running Open MPI/SHMEM jobs
274-
Group: Development/Libraries
275-
Provides: mpi
276-
Provides: openmpi = %{version}
277-
Provides: openmpi-runtime = %{version}
278-
%if %{disable_auto_requires}
279-
AutoReq: no
280-
%endif
281-
%if %{install_modulefile}
282-
Requires: %{modules_rpm_name}
283-
%endif
284-
285-
%description runtime
286-
Open MPI is an open source implementation of the Message Passing
287-
Interface specification (http://www.mpi-forum.org/) developed and
288-
maintained by a consortium of research, academic, and industry
289-
partners.
290-
291-
Open MPI also includes an implementation of the OpenSHMEM parallel
292-
programming API (http://www.openshmem.org/). OpenSHMEM is a
293-
Partitioned Global Address Space (PGAS) abstraction layer, which
294-
provides fast inter-process communication using one-sided
295-
communication techniques.
296-
297-
This subpackage provides general tools (mpirun, mpiexec, etc.) and the
298-
Module Component Architecture (MCA) base and plugins necessary for
299-
running Open MPI/OpenSHMEM jobs.
300-
301-
%endif
302-
303260
#############################################################################
304261
#
305262
# Preamble Section (devel)
@@ -313,7 +270,7 @@ Group: Development/Libraries
313270
AutoReq: no
314271
%endif
315272
Provides: openmpi-devel = %{version}
316-
Requires: %{name}-runtime
273+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
317274

318275
%description devel
319276
Open MPI is an open source implementation of the Message Passing
@@ -344,7 +301,7 @@ Group: Development/Documentation
344301
AutoReq: no
345302
%endif
346303
Provides: openmpi-docs = %{version}
347-
Requires: %{name}-runtime
304+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
348305

349306
%description docs
350307
Open MPI is an open source implementation of the Message Passing
@@ -481,21 +438,32 @@ find $RPM_BUILD_ROOT -name config.log -exec rm -f {} \;
481438
%if %{install_modulefile}
482439
%{__mkdir_p} $RPM_BUILD_ROOT/%{modulefile_path}/%{modulefile_subdir}/
483440
cat <<EOF >$RPM_BUILD_ROOT/%{modulefile_path}/%{modulefile_subdir}/%{modulefile_name}
484-
#%Module
441+
#%Module 1.0
485442

486443
# NOTE: This is an automatically-generated file! (generated by the
487444
# Open MPI/SHMEM RPM). Any changes made here will be lost a) if the RPM is
488445
# uninstalled, or b) if the RPM is upgraded or uninstalled.
489446

447+
conflict mpi
448+
490449
proc ModulesHelp { } {
491450
puts stderr "This module adds Open MPI/SHMEM v%{version} to various paths"
492451
}
493452

494453
module-whatis "Sets up Open MPI/SHMEM v%{version} in your enviornment"
495454

496-
prepend-path PATH "%{_prefix}/bin/"
455+
prepend-path PATH "%{_bindir}"
497456
prepend-path LD_LIBRARY_PATH %{_libdir}
457+
prepend-path PKG_CONFIG_PATH %{_libdir}/pkgconfig
498458
prepend-path MANPATH %{_mandir}
459+
setenv MPI_BIN %{_bindir}
460+
setenv MPI_SYSCONFIG %{_sysconfdir}
461+
setenv MPI_INCLUDE %{_includedir}
462+
setenv MPI_LIB %{_libdir}
463+
setenv MPI_MAN %{_mandir}
464+
setenv MPI_COMPILER %{modulefile_name}
465+
setenv MPI_SUFFIX %{?_cc_name_suffix}_openmpi
466+
setenv MPI_HOME %{_prefix}
499467
EOF
500468
%endif
501469
# End of modulefile if
@@ -565,8 +533,6 @@ EOF
565533
%endif
566534
# End of shell_scripts if
567535

568-
%if !%{build_all_in_one_rpm}
569-
570536
# Build lists of files that are specific to each package that are not
571537
# easily identifiable by a single directory (e.g., the different
572538
# libraries). In a somewhat lame move, we can't just pipe everything
@@ -632,9 +598,6 @@ mv tmp.files devel.files
632598
grep -v %{_mandir} docs.files > tmp.files | /bin/true
633599
mv tmp.files docs.files
634600

635-
%endif
636-
# End of build_all_in_one_rpm
637-
638601
#############################################################################
639602
#
640603
# Clean Section
@@ -680,50 +643,6 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
680643
#
681644
#############################################################################
682645

683-
%if %{build_all_in_one_rpm}
684-
685-
#
686-
# All in one RPM
687-
#
688-
# Easy; just list the prefix and then specifically call out the doc
689-
# files.
690-
#
691-
692-
%files
693-
%defattr(-, root, root, -)
694-
%if %(test "%{_prefix}" = "/usr" && echo 1 || echo 0)
695-
%{_bindir}/*
696-
%{_includedir}/*
697-
%{_libdir}/*
698-
%{_datadir}
699-
%else
700-
%{_prefix}
701-
%endif
702-
# If the sysconfdir is not under the prefix, then list it explicitly.
703-
%if !%{sysconfdir_in_prefix}
704-
%{_sysconfdir}
705-
%endif
706-
# If %{install_in_opt}, then we're instaling OMPI to
707-
# /opt/openmpi/<version>. But be sure to also explicitly mention
708-
# /opt/openmpi so that it can be removed by RPM when everything under
709-
# there is also removed.
710-
%if %{install_in_opt}
711-
%dir /opt/%{name}
712-
%endif
713-
# If we're installing the modulefile, get that, too
714-
%if %{install_modulefile}
715-
%{modulefile_path}
716-
%endif
717-
# If we're installing the shell scripts, get those, too
718-
%if %{install_shell_scripts}
719-
%{shell_scripts_path}/%{shell_scripts_basename}.sh
720-
%{shell_scripts_path}/%{shell_scripts_basename}.csh
721-
%endif
722-
%doc README INSTALL
723-
%license LICENSE
724-
725-
%else
726-
727646
#
728647
# Sub-package RPMs
729648
#
@@ -733,7 +652,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
733652
# specific file lists.
734653
#
735654

736-
%files runtime -f runtime.files
655+
%files -f runtime.files
737656
%defattr(-, root, root, -)
738657
%if %(test "%{_prefix}" = "/usr" && echo 1 || echo 0)
739658
%{_bindir}/*
@@ -776,19 +695,21 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
776695
# files found in that tree, because rpmbuild may have compressed them
777696
# (e.g., foo.1.gz or foo.1.bz2) -- and we therefore don't know the
778697
# exact filenames.
779-
%files docs -f docs.files
698+
%files docs
780699
%defattr(-, root, root, -)
781700
%{_mandir}
782701

783-
%endif
784-
785702

786703
#############################################################################
787704
#
788705
# Changelog
789706
#
790707
#############################################################################
791708
%changelog
709+
* Mon Jun 29 2026 Mitch Zhu <mitchzhu@microsoft.com> - 3:4.1.9a1-2
710+
- Build Open MPI runtime in the main package with split devel and docs
711+
- Restore Open MPI environment modulefile
712+
792713
* Mon May 11 2026 Azure Linux Team - 3:4.1.9a1-1
793714
- Upgrade to DOCA 3.3.0 (OFED 26.01-1.0.0.0)
794715

0 commit comments

Comments
 (0)