Skip to content

Commit 964360c

Browse files
author
Damian Rouson
authored
Merge pull request #701 from sourceryinstitute/git-clone-gcc
git clone gcc branches (remove all use of svn)
2 parents 52b1dd3 + e5b8dc7 commit 964360c

File tree

8 files changed

+57
-93
lines changed

8 files changed

+57
-93
lines changed

install.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,23 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
113113
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
114114

115115
# shellcheck disable=SC2154
116-
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D:-${arg_B}}}}}" ]]; then
116+
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]]; then
117117
print_debug_only=7
118118
if [ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]; then
119119
debug "Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
120120
suppress_info_debug_messages
121121
fi
122122
fi
123123

124-
[ ! -z "${arg_D}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}" ] &&
124+
[ ! -z "${arg_D}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V}}}" ] &&
125125
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 101]"
126126

127-
[ ! -z "${arg_P}" ] && [ ! -z "${arg_U:-${arg_V:-${arg_B}}}" ] &&
127+
[ ! -z "${arg_P}" ] && [ ! -z "${arg_U:-${arg_V}}" ] &&
128128
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 102]"
129129

130-
[ ! -z "${arg_U}" ] && [ ! -z "${arg_V:-${arg_B}}" ] &&
130+
[ ! -z "${arg_U}" ] && [ ! -z "${arg_V}" ] &&
131131
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 103]"
132132

133-
[ ! -z "${arg_V}" ] && [ ! -z "${arg_B}" ] &&
134-
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 104]"
135-
136133
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
137134
### is at the default value (6) or above.
138135
#####################################################################
@@ -146,7 +143,6 @@ info "__usage: ${__usage}"
146143
info "LOG_LEVEL: ${LOG_LEVEL}"
147144

148145
info "-b (--install-branch): ${arg_b}"
149-
info "-B (--list-branches): ${arg_B}"
150146
info "-c (--with-c): ${arg_c}"
151147
info "-C (--with-cxx): ${arg_C}"
152148
info "-d (--debug): ${arg_d}"
@@ -267,11 +263,10 @@ if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
267263
echo "${opencoarrays_version//[[:space:]]/}"
268264
fi
269265

270-
elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" || "${arg_l}" == "${__flag_present}" ]]; then
266+
elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__flag_present}" ]]; then
271267

272268
# Delegate to build.sh for the packages it builds
273-
build_arg=${arg_B:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_p}}}}}}
274-
[ ! -z "${arg_B}" ] && build_flag="-B"
269+
build_arg=${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_p}}}}}
275270
[ ! -z "${arg_D}" ] && build_flag="-D"
276271
[ ! -z "${arg_P}" ] && build_flag="-P"
277272
[ ! -z "${arg_U}" ] && build_flag="-U"

install.sh-usage

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
-b --install-branch [arg] Install the specified repository development branch (Examples: -b trunk or -b gcc-7-branch).
2-
-B --list-branches [arg] List the available branches in a package's repository (Currently only '-B gcc' is supported).
32
-c --with-c [arg] Use specified C compiler (Example: -c /usr/local/bin/gcc).
43
-C --with-cxx [arg] Use specified C++ compiler (Example: -C /usr/local/bin/g++).
5-
-d --debug Enable debug mode.
4+
-d --debug Enable debug mode.
65
-D --print-downloader [arg] Print download program for package specified in argument (Example: -D gcc).
76
-e --verbose Enable verbose mode, print script as it is executed.
87
-f --with-fortran [arg] Use specified Fortran compiler (Example: -f /usr/local/bin/gfortran).
98
-h --help Print this page.
10-
-i --install-prefix [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/${package_name:-}/${version_to_build:-}"
9+
-i --install-prefix [arg] Install package in specified path. Default="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations/${package_name:-}/${version_to_build:-}"
1110
-I --install-version [arg] Install package version (Example: -I 7.2.0).
1211
-j --num-threads [arg] Number of threads to use when invoking make (Example: -j 8). Default="4"
1312
-l --list-packages Print packages this script can install.

prerequisites/build-functions/download_if_necessary.sh

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,8 @@ download_if_necessary()
2222
args=("-n")
2323
;;
2424
"git" )
25-
args=("clone")
25+
args=("clone" "-b" "${arg_b}")
2626
;;
27-
"svn" )
28-
case "${arg_B:-}" in
29-
"gcc")
30-
args=("ls")
31-
;;
32-
*)
33-
args=("checkout")
34-
;;
35-
esac
36-
;;
3727
"curl" )
3828
first_three_characters=$(echo "${package_url}" | cut -c1-3)
3929
case "${first_three_characters}" in
@@ -68,7 +58,6 @@ download_if_necessary()
6858
;;
6959
esac
7060

71-
7261
if [[ -f "${download_path}/${url_tail}" || -d "${download_path}/${url_tail##*branches/}" && ! -z ${url_tail##*branches/} ]]; then
7362
info "Found '${url_tail##*branches/}' in ${download_path}."
7463
info "If it resulted from an incomplete download, building ${package_name} could fail."
@@ -95,8 +84,8 @@ download_if_necessary()
9584
emergency "Aborting [exit 90]"
9685
else
9786

98-
if [[ "${fetch}" == "svn" || "${fetch}" == "git" ]]; then
99-
package_source_directory="${url_tail}"
87+
if [[ "${fetch}" == "git" ]]; then
88+
package_source_directory="${package_name}"
10089
else
10190
package_source_directory="${package_name}-${version_to_build}"
10291
fi
@@ -107,22 +96,18 @@ download_if_necessary()
10796
pushd "${download_path}"
10897
"${fetch}" ${args[@]:-} "${package_url}"
10998
popd
110-
if [[ ! -z "${arg_B:-}" ]]; then
111-
return
99+
if [[ "${fetch}" == "git" ]]; then
100+
search_path="${download_path}/${package_name}"
112101
else
113-
if [[ "${fetch}" == "svn" ]]; then
114-
search_path="${download_path}/${version_to_build}"
115-
else
116-
search_path="${download_path}/${url_tail}"
117-
fi
118-
if [[ -f "${search_path}" || -d "${search_path}" ]]; then
119-
info "Download succeeded. The ${package_name} source is in the following location:"
120-
info "${search_path}"
121-
else
122-
info "Download failed. The ${package_name} source is not in the following, expected location:"
123-
info "${search_path}"
124-
emergency "Aborting. [exit 110]"
125-
fi
102+
search_path="${download_path}/${url_tail}"
103+
fi
104+
if [[ -f "${search_path}" || -d "${search_path}" ]]; then
105+
info "Download succeeded. The ${package_name} source is in the following location:"
106+
info "${search_path}"
107+
else
108+
info "Download failed. The ${package_name} source is not in the following, expected location:"
109+
info "${search_path}"
110+
emergency "Aborting. [exit 110]"
126111
fi
127112
fi
128113
}

prerequisites/build-functions/set_or_print_default_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set_or_print_default_version()
1313
echo "This script can build the following packages:"
1414
fi
1515
# Get package name from argument passed with -p, -V, -D, or -U
16-
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}" # not needed for -l
16+
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}" # not needed for -l
1717

1818
if [[ "${package_name}" == "ofp" ]]; then
1919
"${OPENCOARRAYS_SRC_DIR}/prerequisites/install-ofp.sh" "${@}"

prerequisites/build-functions/set_or_print_downloader.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
set_or_print_downloader()
77
{
88
# Verify requirements
9-
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}" ] &&
9+
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}" ] &&
1010
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
1111

12-
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}"
12+
package_name="${arg_p:-${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}}"
1313

1414
if [[ "${package_name}" == "ofp" ]]; then
1515
"${OPENCOARRAYS_SRC_DIR}/prerequisites/install-ofp.sh" "${@}"
1616
exit 0
1717
fi
1818

1919
# Choose the first available download mechanism, prioritizing first any absolute requirement
20-
# (svn for gcc development branches) and second robustness:
20+
# (git for gcc development branches) and second robustness:
2121
info "Checking available download mechanisms: ftp, wget, and curl."
22-
info "\${package_name}=${package_name} \${arg_b:-\${arg_B:-}}=${arg_b:-${arg_B:-}}"
22+
info "\${package_name}=${package_name} \${arg_b:-}=${arg_b:-}"
2323

2424
if type curl &> /dev/null; then
2525
gcc_prereqs_fetch=curl
@@ -34,22 +34,18 @@ set_or_print_downloader()
3434
tried="curl, wget, and ftp"
3535
fi
3636

37-
if [[ "${package_name}" == "gcc" && ! -z "${arg_b:-${arg_B:-}}" ]]; then
38-
if type svn &> /dev/null; then
39-
fetch=svn
37+
if [[ "${package_name}" == "gcc" && ! -z "${arg_b}" ]]; then
38+
if type git &> /dev/null; then
39+
fetch=git
4040
else
41-
tried="svn"
41+
tried="git"
4242
fi
4343
else
4444
fetch=${gcc_prereqs_fetch}
4545
fi
4646

4747
if [[ -z "${fetch:-}" ]]; then
48-
if [[ -z "${arg_B:-}" ]]; then
49-
warning "No available download mechanism. Options tried: ${tried}"
50-
else
51-
emergency "No available download mechanism. Option tried: ${tried}"
52-
fi
48+
emergency "No available download mechanism. Option tried: ${tried}"
5349
fi
5450

5551
# If a printout of the download mechanism was requested, then print it and exit with normal status

prerequisites/build-functions/set_or_print_url.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
set_or_print_url()
66
{
77
# Verify requirements
8-
[[ -n "${arg_U}" && -n "${arg_D:-${arg_p:-${arg_P:-${arg_V:-${arg_B}}}}}" ]] &&
8+
[[ -n "${arg_U}" && -n "${arg_D:-${arg_p:-${arg_P:-${arg_V}}}}" ]] &&
99
emergency "Please pass only one of {-B, -D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
1010

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

1414
if [[ -n "${arg_u:-}" ]]; then
1515
# User specified a URL from which to download the package
@@ -20,10 +20,10 @@ else
2020
if [[ "${package_to_build}" == 'cmake' ]]; then
2121
major_minor="${version_to_build%.*}"
2222
elif [[ "${package_to_build}" == "gcc" ]]; then
23-
if [[ -z "${arg_b:-${arg_B}}" ]]; then
23+
if [[ -z "${arg_b}" ]]; then
2424
gcc_url_head="https://ftpmirror.gnu.org/gcc/gcc-${version_to_build}/"
2525
else
26-
gcc_url_head="svn://gcc.gnu.org/svn/gcc/"
26+
gcc_url_head="git://gcc.gnu.org/git/"
2727
fi
2828
fi
2929
package_url_head=(
@@ -52,12 +52,8 @@ else
5252

5353
# Set differing tails for GCC release downloads versus development branch checkouts
5454
if [[ "${package_to_build}" == 'gcc' ]]; then
55-
if [[ "${fetch}" == 'svn' ]]; then
56-
if [[ "${version_to_build:-}" == "trunk" ]]; then
57-
gcc_tail="${version_to_build}"
58-
else
59-
gcc_tail="branches/${version_to_build:-}"
60-
fi
55+
if [[ "${fetch}" == 'git' ]]; then
56+
gcc_tail="gcc"
6157
else
6258
gcc_tail="gcc-${version_to_build}.tar.gz"
6359
fi

prerequisites/build-functions/unpack_if_necessary.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# shellcheck disable=SC2154
33
unpack_if_necessary()
44
{
5-
if [[ "${fetch}" == "svn" || "${fetch}" == "git" ]]; then
6-
package_source_directory="${version_to_build}"
5+
if [[ "${fetch}" == "git" ]]; then
6+
package_source_directory="${package_name}"
77
else
88
if [[ "${url_tail}" == *tar.gz || "${url_tail}" == *tar.bz2 || "${url_tail}" == *.tar.xz ]]; then
99
info "Unpacking ${url_tail}."

prerequisites/build.sh

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ export __flag_present=1
6161
if [[ "${arg_l}" != "${__flag_present}" &&
6262
"${arg_v}" != "${__flag_present}" &&
6363
"${arg_h}" != "${__flag_present}" &&
64-
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V:-${arg_B}}}}}}" ]]; then
64+
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}}" ]]; then
6565
help "${__base}: Insufficient arguments. Please pass either -B, -D, -h, -l, -L, -p, -P, -U, -v, -V, or a longer equivalent."
6666
fi
6767

6868
# Suppress info and debug messages if -B, -l, -P, -U, -V, -D, or their longer equivalent is present:
69-
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D:-${arg_B}}}}}" ]] && suppress_info_debug_messages
69+
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]] && suppress_info_debug_messages
7070

7171
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
7272

@@ -88,7 +88,6 @@ info "__usage: ${__usage}"
8888
info "LOG_LEVEL: ${LOG_LEVEL}"
8989

9090
info "-b (--install-branch): ${arg_b} "
91-
info "-B (--list-branches): ${arg_B} "
9291
info "-c (--with-c): ${arg_c} "
9392
info "-C (--with-cxx): ${arg_C} "
9493
info "-d (--debug): ${arg_d} "
@@ -115,13 +114,11 @@ info "-y (--yes-to-all): ${arg_y} "
115114
info "-Z (--bootstrap): ${arg_Z} "
116115
}
117116

118-
if [[ -z "${arg_B}" ]]; then
119-
# shellcheck source=./build-functions/set_or_print_default_version.sh
120-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
121-
# shellcheck disable=SC2119
122-
set_or_print_default_version
123-
export version_to_build="${arg_I:-${arg_b:-${default_version}}}"
124-
fi
117+
# shellcheck source=./build-functions/set_or_print_default_version.sh
118+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_default_version.sh"
119+
# shellcheck disable=SC2119
120+
set_or_print_default_version
121+
export version_to_build="${arg_I:-${arg_b:-${default_version}}}"
125122

126123
# shellcheck source=./build-functions/set_or_print_downloader.sh
127124
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_downloader.sh"
@@ -135,9 +132,7 @@ set_or_print_url
135132
# shellcheck source=./build-functions/set_or_print_installation_path.sh
136133
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
137134

138-
if [[ -z "${arg_B}" ]]; then
139-
set_or_print_installation_path
140-
fi
135+
set_or_print_installation_path
141136

142137
# shellcheck source=./build-functions/download_if_necessary.sh
143138
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/download_if_necessary.sh"
@@ -159,16 +154,14 @@ else
159154
export bootstrap_build="bootstrap"
160155
fi
161156

162-
if [[ -z "${arg_B}" ]]; then
163-
# shellcheck source=./build-functions/unpack_if_necessary.sh
164-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
165-
unpack_if_necessary
157+
# shellcheck source=./build-functions/unpack_if_necessary.sh
158+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
159+
unpack_if_necessary
166160

167-
# shellcheck source=./build-functions/set_compilers.sh
168-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
169-
set_compilers
161+
# shellcheck source=./build-functions/set_compilers.sh
162+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_compilers.sh"
163+
set_compilers
170164

171-
# shellcheck source=./build-functions/build_and_install.sh
172-
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
173-
build_and_install
174-
fi
165+
# shellcheck source=./build-functions/build_and_install.sh
166+
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/build_and_install.sh"
167+
build_and_install

0 commit comments

Comments
 (0)