Skip to content

Commit 687a560

Browse files
author
Michael Heinz
committed
buildrpm.sh no longer respects the value of rpmtopdir
In OMPI 2.1.2, buildrpm.sh could work with a value of rpmtopdir that was set in the environment. In newer versions this is no longer true, causing such values to be ignored. This patch adds a new argument to buildrpm.sh, -R, which allows the user to specify where to build the RPMs. Signed-off-by: Michael Heinz <michael.william.heinz@intel.com>
1 parent 5d2200a commit 687a560

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

contrib/dist/linux/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ Please, do NOT set the same settings with parameters and config vars.
8686
file from the tarball specified on the command line. By default,
8787
the script will look for the specfile in the current directory.
8888

89+
-R directory
90+
Specifies the top level RPM build direcotry.
91+
8992
-h
9093
Prints script usage information.
9194

contrib/dist/linux/buildrpm.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
# file from the tarball specified on the command line. By default,
5959
# the script will look for the specfile in the current directory.
6060
#
61+
# -R directory
62+
# Specifies the top level RPM build direcotry.
63+
#
6164
# -h
6265
# Prints script usage information.
6366
#
@@ -107,7 +110,7 @@ orig_param="$@"
107110
#
108111
# usage information
109112
#
110-
usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location] tarball
113+
usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location][-R directory] tarball
111114
112115
-b
113116
build all-in-one binary RPM only (required for all other flags to work)
@@ -146,6 +149,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo
146149
-r parameter
147150
add custom RPM build parameter
148151
152+
-R directory
153+
Specifies the top level RPM build direcotry.
154+
149155
-h print this message and exit
150156
151157
tarball path to Open MPI source tarball
@@ -155,8 +161,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo
155161
# parse args
156162
#
157163
libfabric_path=""
164+
rpmtopdir=
158165

159-
while getopts bn:omif:t:dc:r:sh flag; do
166+
while getopts bn:omif:t:dc:r:sR:h flag; do
160167
case "$flag" in
161168
b) build_srpm="no"
162169
build_single="yes"
@@ -180,6 +187,8 @@ while getopts bn:omif:t:dc:r:sh flag; do
180187
;;
181188
r) configure_options="$rpmbuild_options $OPTARG"
182189
;;
190+
R) rpmtopdir="$OPTARG"
191+
;;
183192
s) unpack_spec="1"
184193
;;
185194
h) echo "$usage" 1>&2
@@ -267,10 +276,16 @@ fi
267276
# Find where the top RPM-building directory is
268277
#
269278

270-
file=~/.rpmmacros
271-
if test -r $file; then
272-
rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"}
279+
# if the user did not specify an $rpmtopdir, check for an .rpmmacros file.
280+
if test "$rpmtopdir" == ""; then
281+
file=~/.rpmmacros
282+
if test -r $file; then
283+
rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"}
284+
fi
273285
fi
286+
287+
# If needed, initialize the $rpmtopdir directory. If no $rpmtopdir was
288+
# specified, try various system-level defaults.
274289
if test "$rpmtopdir" != ""; then
275290
rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'"
276291
if test ! -d "$rpmtopdir"; then

0 commit comments

Comments
 (0)