Skip to content

Commit e3b827f

Browse files
authored
Merge pull request #425 from sourceryinstitute/add-package-url
Add -u/--from-url option for install.sh Fixes #424
2 parents 3282568 + f3ca216 commit e3b827f

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ info "-n (--no-color): ${arg_n}"
164164
info "-o (--only-download): ${arg_o}"
165165
info "-p (--package): ${arg_p}"
166166
info "-P (--print-path): ${arg_P}"
167+
info "-u (--from-url): ${arg_u}"
167168
info "-U (--print-url): ${arg_U}"
168169
info "-v (--version): ${arg_v}"
169170
info "-V (--print-version): ${arg_V}"

install.sh-usage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
-o --only-download Download (without building) the source for the package specified by -p or --package.
1818
-p --package [arg] Install specified package. Default="opencoarrays"
1919
-P --print-path [arg] Print installation directory for specified package.
20+
-u --from-url [arg] Specify a URL to use for downloading a package.
2021
-U --print-url [arg] Print download location for specified package.
2122
-v --version Print OpenCoarrays version number.
2223
-V --print-version [arg] Print version number for specified package.

prerequisites/build-functions/set_or_print_url.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
# shellcheck shell=bash
12
# If -p, -D, -P, or -V specifies a package, set package_url
23
# If -U specifies a package, print the package_url and exit with normal status
34
# shellcheck disable=SC2154
45
set_or_print_url()
56
{
67
# Verify requirements
7-
[ ! -z "${arg_U}" ] && [ ! -z "${arg_D:-${arg_p:-${arg_P:-${arg_V:-${arg_B}}}}}" ] &&
8+
[[ -n "${arg_U}" && -n "${arg_D:-${arg_p:-${arg_P:-${arg_V:-${arg_B}}}}}" ]] &&
89
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
910

1011
# Get package name from argument passed with -p, -D, -P, -V, or -U
1112
package_to_build="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}"
1213

14+
if [[ -n "${arg_u:-}" ]]; then
15+
# User specified a URL from which to download the package
16+
url_tail="${arg_u##*/}" # set url_tail to text_after_final_slash, greedy expansion needed
17+
url_head="${arg_u%${url_tail}}" # set url_head text before url_tail
18+
else
19+
1320
if [[ "${package_to_build}" == 'cmake' ]]; then
1421
major_minor="${version_to_build%.*}"
1522
elif [[ "${package_to_build}" == "gcc" ]]; then
@@ -35,7 +42,7 @@ set_or_print_url()
3542
KEY="${package%%;*}"
3643
VALUE="${package##*;}"
3744
info "KEY=${KEY} VALUE=${VALUE}"
38-
45+
3946
if [[ "${package_to_build}" == "${KEY}" ]]; then
4047
# We recognize the package name so we set the URL head:
4148
url_head="${VALUE}"
@@ -81,10 +88,12 @@ set_or_print_url()
8188
emergency "Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
8289
fi
8390

91+
fi # end if [[ -n "${arg_u:-}" ]]; then
92+
8493
package_url="${url_head}""${url_tail}"
8594

8695
# If a printout of the package URL was requested, then print it and exit with normal status
87-
if [[ ! -z "${arg_U:-}" ]]; then
96+
if [[ -n "${arg_U:-}" ]]; then
8897
printf "%s\n" "${package_url}"
8998
exit 0
9099
fi

prerequisites/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ info "-n (--no-color): ${arg_n} "
107107
info "-p (--package): ${arg_p}"
108108
info "-P (--print-path): ${arg_P} "
109109
info "-t (--with-tau): ${arg_t} "
110+
info "-u (--from-url): ${arg_u} "
110111
info "-U (--print-url): ${arg_U} "
111112
info "-v (--version): ${arg_v} "
112113
info "-V (--print-version): ${arg_V} "

prerequisites/build.sh-usage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-P --print-path [arg] Print installation path for package specified in argument.
2020
-t --with-tau [arg] Use the specified TAU parallel performance utilities installation. Default="tauf90"
2121
-T --install-tau [arg] Install TAU in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/${package_name:-}/${version_to_build:-}/"
22+
-u --from-url [arg] Specify a URL from which to download a package.
2223
-U --print-url [arg] Print URL for package specified in argument.
2324
-v --version Print OpenCoarrays version number.
2425
-V --print-version [arg] Print installation version for package specified in argument.

0 commit comments

Comments
 (0)