Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contrib/dist/linux/README
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Please, do NOT set the same settings with parameters and config vars.
file from the tarball specified on the command line. By default,
the script will look for the specfile in the current directory.

-R directory
Specifies the top level RPM build direcotry.

-h
Prints script usage information.

Expand Down
50 changes: 32 additions & 18 deletions contrib/dist/linux/buildrpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
# file from the tarball specified on the command line. By default,
# the script will look for the specfile in the current directory.
#
# -R directory
# Specifies the top level RPM build direcotry.
#
# -h
# Prints script usage information.
#
Expand Down Expand Up @@ -107,7 +110,7 @@ orig_param="$@"
#
# usage information
#
usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location] tarball
usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location][-R directory] tarball

-b
build all-in-one binary RPM only (required for all other flags to work)
Expand Down Expand Up @@ -146,6 +149,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo
-r parameter
add custom RPM build parameter

-R directory
Specifies the top level RPM build direcotry.

-h print this message and exit

tarball path to Open MPI source tarball
Expand All @@ -155,8 +161,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo
# parse args
#
libfabric_path=""
rpmtopdir=

while getopts bn:omif:t:dc:r:sh flag; do
while getopts bn:omif:t:dc:r:sR:h flag; do
case "$flag" in
b) build_srpm="no"
build_single="yes"
Expand All @@ -180,6 +187,8 @@ while getopts bn:omif:t:dc:r:sh flag; do
;;
r) configure_options="$rpmbuild_options $OPTARG"
;;
R) rpmtopdir="$OPTARG"
;;
s) unpack_spec="1"
;;
h) echo "$usage" 1>&2
Expand Down Expand Up @@ -267,25 +276,30 @@ fi
# Find where the top RPM-building directory is
#

rpmtopdir=
file=~/.rpmmacros
if test -r $file; then
rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"}
# if the user did not specify an $rpmtopdir, check for an .rpmmacros file.
if test "$rpmtopdir" == ""; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think the use of == is wrong here. Sorry we missed it on the master PR. 😦

I think it works with Linux test, but it fails (IIRC) with BSD flavors of test.

It might be a little better to if test -z "$rpmtopdir"; then ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think this is moot -- this script is for building RPMs. Which is specific to Linux -- not BSD. So the use of == is probably ok here.

I therefore retract my prior comment. 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phew

file=~/.rpmmacros
if test -r $file; then
rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"}
fi
fi

# If needed, initialize the $rpmtopdir directory. If no $rpmtopdir was
# specified, try various system-level defaults.
if test "$rpmtopdir" != ""; then
rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'"
rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'"
if test ! -d "$rpmtopdir"; then
mkdir -p "$rpmtopdir"
mkdir -p "$rpmtopdir/BUILD"
mkdir -p "$rpmtopdir/RPMS"
mkdir -p "$rpmtopdir/RPMS/i386"
mkdir -p "$rpmtopdir/RPMS/i586"
mkdir -p "$rpmtopdir/RPMS/i686"
mkdir -p "$rpmtopdir/RPMS/noarch"
mkdir -p "$rpmtopdir/RPMS/athlon"
mkdir -p "$rpmtopdir/SOURCES"
mkdir -p "$rpmtopdir/SPECS"
mkdir -p "$rpmtopdir/SRPMS"
mkdir -p "$rpmtopdir"
mkdir -p "$rpmtopdir/BUILD"
mkdir -p "$rpmtopdir/RPMS"
mkdir -p "$rpmtopdir/RPMS/i386"
mkdir -p "$rpmtopdir/RPMS/i586"
mkdir -p "$rpmtopdir/RPMS/i686"
mkdir -p "$rpmtopdir/RPMS/noarch"
mkdir -p "$rpmtopdir/RPMS/athlon"
mkdir -p "$rpmtopdir/SOURCES"
mkdir -p "$rpmtopdir/SPECS"
mkdir -p "$rpmtopdir/SRPMS"
fi
need_root=0
elif test -d /usr/src/RPM; then
Expand Down