Skip to content

Commit a7e2bb4

Browse files
authored
Merge pull request #7264 from jsquyres/pr/linux-specfile-fixes
openmpi.spec: update modulefile_path behavior
2 parents 1b93a17 + 352e575 commit a7e2bb4

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

contrib/dist/linux/openmpi.spec

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# University of Stuttgart. All rights reserved.
1010
# Copyright (c) 2004-2005 The Regents of the University of California.
1111
# All rights reserved.
12-
# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved.
12+
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2013 Mellanox Technologies, Inc.
1414
# All rights reserved.
1515
# Copyright (c) 2015 Research Organization for Information Science
@@ -51,7 +51,10 @@
5151
#############################################################################
5252

5353
# Define this if you want to make this SRPM build in
54-
# /opt/NAME/VERSION-RELEASE instead of the default /usr/.
54+
# /opt/NAME/VERSION-RELEASE instead of the default /usr/. Note that
55+
# Open MPI will be *entirely* installed in /opt. One possible
56+
# exception is the modulefile -- see the description of
57+
# modulefile_path, below.
5558
# type: bool (0/1)
5659
%{!?install_in_opt: %define install_in_opt 0}
5760

@@ -67,8 +70,15 @@
6770
# Define this to 1 if you want this RPM to install a modulefile.
6871
# type: bool (0/1)
6972
%{!?install_modulefile: %define install_modulefile 0}
70-
# type: string (root path to install modulefiles)
71-
%{!?modulefile_path: %define modulefile_path /usr/share/Modules/modulefiles}
73+
74+
# Root path to install modulefiles. If the value modulefile_path is
75+
# set, that directory is the root path for where the modulefile will
76+
# be installed there (assuming install_modulefile==1), even if
77+
# install_in_opt==1. type: string (root path to install modulefile)
78+
#
79+
# NOTE: modulefile_path is not actually defined here, because we have
80+
# to check/process install_in_opt first.
81+
7282
# type: string (subdir to install modulefile)
7383
%{!?modulefile_subdir: %define modulefile_subdir %{name}}
7484
# type: string (name of modulefile)
@@ -152,21 +162,31 @@
152162
%define _libdir /opt/%{name}/%{version}/lib
153163
%define _includedir /opt/%{name}/%{version}/include
154164
%define _mandir /opt/%{name}/%{version}/man
165+
155166
# Note that the name "openmpi" is hard-coded in
156167
# opal/mca/installdirs/config for pkgdatadir; there is currently no
157168
# easy way to have OMPI change this directory name internally. So we
158169
# just hard-code that name here as well (regardless of the value of
159170
# %{name} or %{_name}).
160171
%define _pkgdatadir /opt/%{name}/%{version}/share/openmpi
172+
161173
# Per advice from Doug Ledford at Red Hat, docdir is supposed to be in
162174
# a fixed location. But if you're installing a package in /opt, all
163175
# bets are off. So feel free to install it anywhere in your tree. He
164176
# suggests $prefix/doc.
165177
%define _defaultdocdir /opt/%{name}/%{version}/doc
166-
# Also put the modulefile in /opt.
167-
%define modulefile_path /opt/%{name}/%{version}/share/openmpi/modulefiles
178+
179+
# Also put the modulefile in /opt (unless the user already specified
180+
# where they want it to go -- the modulefile is a bit different in
181+
# that the user may want it outside of /opt).
182+
%{!?modulefile_path: %define modulefile_path /opt/%{name}/%{version}/share/openmpi/modulefiles}
168183
%endif
169184

185+
# Now that we have processed install_in_opt, we can see if
186+
# modulefile_path was not set. If it was not, then set it to a
187+
# default value.
188+
%{!?modulefile_path: %define modulefile_path /usr/share/Modules/modulefiles}
189+
170190
%if !%{build_debuginfo_rpm}
171191
%define debug_package %{nil}
172192
%endif

0 commit comments

Comments
 (0)