Skip to content

Commit 4830a05

Browse files
committed
Introduce "retrieve_package" functional to manage package downloading
1 parent 99430a7 commit 4830a05

18 files changed

Lines changed: 58 additions & 123 deletions

toolchain/scripts/get_openblas_arch.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,8 @@ source "${INSTALLDIR}"/toolchain.env
4949
cd "${BUILDDIR}"
5050

5151
echo "==================== Getting proc arch info using OpenBLAS tools ===================="
52-
if [ -f ${openblas_pkg} ]; then
53-
echo "${openblas_pkg} is found"
54-
else
55-
# using codeload.github
56-
url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}"
57-
download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}"
58-
fi
52+
url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}"
53+
retrieve_package "${openblas_sha256}" "${openblas_pkg}" "${url}"
5954
# if toolchain run in pack-run mode, do exit
6055
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6156
echo "--pack-run mode specified, skip arch detection"

toolchain/scripts/stage0/install_cmake.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ cd "${BUILDDIR}"
7171
case "${with_cmake}" in
7272
__INSTALL__)
7373
echo "==================== Installing CMake ===================="
74-
cmake_ext="sh"
7574
if [ "${OPENBLAS_ARCH}" = "arm64" ]; then
7675
if [ "$(uname -s)" = "Darwin" ]; then
7776
cmake_arch="macos-universal"
78-
cmake_ext="tar.gz"
7977
elif [ "$(uname -s)" = "Linux" ]; then
8078
cmake_arch="linux-aarch64"
8179
else
@@ -92,28 +90,24 @@ case "${with_cmake}" in
9290
pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}"
9391
#pkg_install_dir="${HOME}/apps/cmake/${cmake_ver}"
9492
install_lock_file="${pkg_install_dir}/install_successful"
95-
cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}"
93+
cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.tar.gz"
9694
if verify_checksums "${install_lock_file}"; then
9795
echo "cmake-${cmake_ver} is already installed, skipping it."
9896
else
99-
if [ -f $cmake_pkg ]; then
100-
echo "$cmake_pkg is found"
101-
else
102-
#download_pkg_from_ABACUS_org "${cmake_sha256}" "$cmake_pkg"
103-
url="https://cmake.org/files/v${cmake_ver%.*}/${cmake_pkg}"
104-
download_pkg_from_url "${cmake_sha256}" "${cmake_pkg}" "${url}"
105-
fi
97+
url="https://cmake.org/files/v${cmake_ver%.*}/${cmake_pkg}"
98+
retrieve_package "${cmake_sha256}" "${cmake_pkg}" "${url}"
10699
if [ "${PACK_RUN}" = "__TRUE__" ]; then
107100
echo "--pack-run mode specified, skip installation"
108101
exit 0
109102
fi
110103
echo "Installing from scratch into ${pkg_install_dir}"
111104
mkdir -p ${pkg_install_dir}
112105
if [ "${cmake_arch}" = "macos-universal" ]; then
113-
tar --strip-components=3 -xvf $cmake_pkg -C ${pkg_install_dir} > install.log 2>&1 || tail -n ${LOG_LINES} install.log
106+
strip_components=3
114107
else
115-
/bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log
108+
strip_components=1
116109
fi
110+
tar --strip-components=${strip_components} -xvf ${cmake_pkg} -C ${pkg_install_dir} > install.log 2>&1 || tail_excerpt install.log
117111
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
118112
fi
119113
;;

toolchain/scripts/stage0/install_gcc.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,8 @@ case "${with_gcc}" in
5959
tar -xzf "${repack_filename}"
6060
echo "Successfully extracted ${repack_filename}"
6161
else
62-
if [ -f gcc-${gcc_ver}.tar.gz ]; then
63-
echo "gcc-${gcc_ver}.tar.gz is found"
64-
else
65-
#download_pkg_from_ABACUS_org "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz"
66-
url=https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-${gcc_ver}/gcc-${gcc_ver}.tar.gz
67-
download_pkg_from_url "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz" "${url}"
68-
fi
62+
url=https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-${gcc_ver}/gcc-${gcc_ver}.tar.gz
63+
retrieve_package "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz" "${url}"
6964
fi
7065
[ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver}
7166
tar -xzf gcc-${gcc_ver}.tar.gz

toolchain/scripts/stage1/install_mpich.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ case "${with_mpich}" in
5050
if verify_checksums "${install_lock_file}"; then
5151
echo "mpich-${mpich_ver} is already installed, skipping it."
5252
else
53-
if [ -f ${mpich_pkg} ]; then
54-
echo "${mpich_pkg} is found"
55-
else
56-
#download_pkg_from_ABACUS_org "${mpich_sha256}" "${mpich_pkg}"
57-
download_pkg_from_url "${mpich_sha256}" "${mpich_pkg}" "${url}"
58-
fi
53+
retrieve_package "${mpich_sha256}" "${mpich_pkg}" "${url}"
5954
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6055
echo "--pack-run mode specified, skip installation"
6156
exit 0

toolchain/scripts/stage1/install_openmpi.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ case "${with_openmpi}" in
5252
if verify_checksums "${install_lock_file}"; then
5353
echo "openmpi-${openmpi_ver} is already installed, skipping it."
5454
else
55-
if [ -f ${openmpi_pkg} ]; then
56-
echo "${openmpi_pkg} is found"
57-
else
58-
download_pkg_from_url "${openmpi_sha256}" "${openmpi_pkg}" "${url}"
59-
fi
55+
retrieve_package "${openmpi_sha256}" "${openmpi_pkg}" "${url}"
6056
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6157
echo "--pack-run mode specified, skip installation"
6258
exit 0

toolchain/scripts/stage2/install_openblas.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,8 @@ case "${with_openblas}" in
5050
if verify_checksums "${install_lock_file}"; then
5151
echo "openblas-${openblas_ver} is already installed, skipping it."
5252
else
53-
if [ -f ${openblas_pkg} ]; then
54-
echo "${openblas_pkg} is found"
55-
else
56-
# using codeload.github
57-
url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}"
58-
download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}"
59-
fi
53+
url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}"
54+
retrieve_package "${openblas_sha256}" "${openblas_pkg}" "${url}"
6055
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6156
echo "--pack-run mode specified, skip installation"
6257
exit 0

toolchain/scripts/stage3/install_elpa.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ case "$with_elpa" in
7474
else
7575
require_env MATH_LIBS
7676
url="https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/${elpa_ver}/${elpa_pkg}"
77-
if [ -f ${elpa_pkg} ]; then
78-
echo "${elpa_pkg} is found"
79-
else
80-
download_pkg_from_url "${elpa_sha256}" "${elpa_pkg}" "${url}"
81-
fi
77+
retrieve_package "${elpa_sha256}" "${elpa_pkg}" "${url}"
8278
if [ "${PACK_RUN}" = "__TRUE__" ]; then
8379
echo "--pack-run mode specified, skip installation"
8480
exit 0

toolchain/scripts/stage3/install_fftw.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ case "$with_fftw" in
4949
if verify_checksums "${install_lock_file}"; then
5050
echo "fftw-${fftw_ver} is already installed, skipping it."
5151
else
52-
if [ -f ${fftw_pkg} ]; then
53-
echo "${fftw_pkg} is found"
54-
else
55-
url="http://www.fftw.org/${fftw_pkg}"
56-
download_pkg_from_url "${fftw_sha256}" "${fftw_pkg}" "${url}"
57-
fi
52+
url="http://www.fftw.org/${fftw_pkg}"
53+
retrieve_package "${fftw_sha256}" "${fftw_pkg}" "${url}"
5854
if [ "${PACK_RUN}" = "__TRUE__" ]; then
5955
echo "--pack-run mode specified, skip installation"
6056
exit 0

toolchain/scripts/stage3/install_libxc.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,8 @@ case "$with_libxc" in
5151
if verify_checksums "${install_lock_file}"; then
5252
echo "libxc-${libxc_ver} is already installed, skipping it."
5353
else
54-
if [ -f ${libxc_pkg} ]; then
55-
echo "${libxc_pkg} is found"
56-
else
57-
#download_pkg_from_ABACUS_org "${libxc_sha256}" "${libxc_pkg}"
58-
libxc_url="https://gitlab.com/libxc/libxc/-/archive/${libxc_ver}/${libxc_pkg}"
59-
download_pkg_from_url "${libxc_sha256}" "${libxc_pkg}" "${libxc_url}"
60-
fi
54+
libxc_url="https://gitlab.com/libxc/libxc/-/archive/${libxc_ver}/${libxc_pkg}"
55+
retrieve_package "${libxc_sha256}" "${libxc_pkg}" "${libxc_url}"
6156
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6257
echo "--pack-run mode specified, skip installation"
6358
exit 0

toolchain/scripts/stage3/install_scalapack.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,8 @@ case "${with_scalapack}" in
4949
echo "scalapack-${scalapack_ver} is already installed, skipping it."
5050
else
5151
require_env MATH_LIBS
52-
if [ -f ${scalapack_pkg} ]; then
53-
echo "${scalapack_pkg} is found"
54-
else
55-
url="https://codeload.github.com/Reference-ScaLAPACK/scalapack/tar.gz/v${scalapack_ver}"
56-
download_pkg_from_url "${scalapack_sha256}" "${scalapack_pkg}" "${url}"
57-
#download_pkg_from_ABACUS_org "${scalapack_sha256}" "${scalapack_pkg}"
58-
fi
52+
url="https://codeload.github.com/Reference-ScaLAPACK/scalapack/tar.gz/v${scalapack_ver}"
53+
retrieve_package "${scalapack_sha256}" "${scalapack_pkg}" "${url}"
5954
if [ "${PACK_RUN}" = "__TRUE__" ]; then
6055
echo "--pack-run mode specified, skip installation"
6156
exit 0

0 commit comments

Comments
 (0)