Skip to content

Commit b9669d3

Browse files
authored
Toolchain: Fix package installing issue (#7315)
* Don't use "short_ver" variable (revert part of #7310) * Use the first seven characters of the commit SHA256 as the version identifier * Apply to CMake FetchContent * Fix remaining issue * Introduce "retrieve_package" functional to manage package downloading * Remove deprecated "download_pkg_from_org" * Update sha256 * Fix behaviors of writing build/setup_PKG to install/setup * Add "--quiet --show-progress" flags to wget to prevent too verbose output
1 parent 22c985e commit b9669d3

24 files changed

Lines changed: 102 additions & 209 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if(ENABLE_RAPIDJSON)
7070
include(FetchContent)
7171
FetchContent_Declare(
7272
rapidjson
73-
URL https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a8b27f42fa16b96fc70aade9106cf7102f
73+
URL https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a
7474
)
7575
set(RAPIDJSON_BUILD_TESTS
7676
OFF

cmake/FindCereal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(NOT CEREAL_INCLUDE_DIR)
1515
include(FetchContent)
1616
FetchContent_Declare(
1717
cereal
18-
URL https://codeload.github.com/USCiLab/cereal/tar.gz/22a1b369f39be918ca79206a83c4facd759f9105
18+
URL https://codeload.github.com/USCiLab/cereal/tar.gz/22a1b36
1919
)
2020
FetchContent_Populate(cereal)
2121
set(CEREAL_INCLUDE_DIR ${cereal_SOURCE_DIR}/include)

cmake/FindLibComm.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(NOT LIBCOMM_DIR)
1616
include(FetchContent)
1717
FetchContent_Declare(
1818
LibComm
19-
URL https://codeload.github.com/abacusmodeling/LibComm/tar.gz/965bf90713ce5598bae4fd957d417065f77ceb42
19+
URL https://codeload.github.com/abacusmodeling/LibComm/tar.gz/965bf90
2020
)
2121
FetchContent_Populate(LibComm)
2222
set(LIBCOMM_DIR ${libcomm_SOURCE_DIR})

cmake/FindLibRI.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(NOT LIBRI_DIR)
1616
include(FetchContent)
1717
FetchContent_Declare(
1818
LibRI
19-
URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0504693d2a464c72b87d3240ce183fd881
19+
URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0
2020
)
2121
FetchContent_Populate(LibRI)
2222
set(LIBRI_DIR ${libri_SOURCE_DIR})

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/package_versions.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ gcc_alt_sha256="af828619dd1970734dda3cfb792ea3f2cba61b5a00170ba8bce4910749d73c07
1818

1919
# CMake (supports dual versions) - main=3.31.7, alt=3.30.5
2020
cmake_main_ver="3.31.7"
21-
cmake_main_sha256_x86_64="b7a5c909cdafc36042c8c9bd5765e92ff1f2528cf01720aa6dc4df294ec7e1a0"
22-
cmake_main_sha256_aarch64="ce8e32b2c1c497dd7f619124c043ac5c28a88677e390c58748dd62fe460c62a2"
21+
cmake_main_sha256_x86_64="14e15d0b445dbeac686acc13fe13b3135e8307f69ccf4c5c91403996ce5aa2d4"
22+
cmake_main_sha256_aarch64="e5b2dc2aefdca10afe09c8fa4ee2bbb4e732665943a94322f99c118781910c3c"
2323
cmake_main_sha256_macos="1cb11aa2edae8551bb0f22807c6f5246bd0eb60ae9fa1474781eb4095d299aca"
2424
cmake_alt_ver="3.30.5"
25-
cmake_alt_sha256_x86_64="83de8839f3fb0d9caf982a0435da3fa8c4fbe2c817dfec99def310dc7e6a8404"
26-
cmake_alt_sha256_aarch64="93c3b8920379585dece1314f113c6c9008eaedfe56023c78d856fc86dad5b8e2"
25+
cmake_alt_sha256_x86_64="f747d9b23e1a252a8beafb4ed2bc2ddf78cff7f04a8e4de19f4ff88e9b51dc9d"
26+
cmake_alt_sha256_aarch64="da7dead2c92c1747b40d506d7f7d68590f5bab175316d2e7af73e48a2e417e48"
2727
cmake_alt_sha256_macos="3d603e507c7579b13518ef752b4ffcf3ed479fba80ee171d7d85da8153e869d0"
2828

2929
# =============================================================================
@@ -100,21 +100,21 @@ libnpy_alt_ver="1.0.1"
100100
libnpy_alt_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44"
101101

102102
# Branch packages cut with specific commits
103-
cereal_ver="22a1b369f39be918ca79206a83c4facd759f9105"
104-
cereal_sha256="ca3d544456f93ea3176eab85e2e7892063af45b20467bb4ad9c1c51068e521c6"
103+
cereal_ver="22a1b36"
104+
cereal_sha256="a8171736e6b553dd6cd37919c13433b01f499d24d45af502975a9439728803e0"
105105

106-
libcomm_ver="965bf90713ce5598bae4fd957d417065f77ceb42"
107-
libcomm_sha256="1d1626b833c51efa7ab844af140e022e063ea64389c9e47b168c24fcc05b7323"
106+
libcomm_ver="965bf90"
107+
libcomm_sha256="d7b991465d98d7b715b484d86880bf3525b9bf0cc62c3e5d38b0f6d140f6b9d4"
108108

109-
libri_ver="e6d78e0504693d2a464c72b87d3240ce183fd881"
110-
libri_sha256="ead14f05b645f3d028e09f715abaa0e8fca3d1d6d61804239c4858b33397286a"
109+
libri_ver="e6d78e0"
110+
libri_sha256="619b49a14047d7a167515d1f1d0fa2d82fbebd63b8cbd3181e07df6ed993a22c"
111111

112-
rapidjson_ver="24b5e7a8b27f42fa16b96fc70aade9106cf7102f"
113-
rapidjson_sha256="2d2601a82d2d3b7e143a3c8d43ef616671391034bc46891a9816b79cf2d3e7a8"
112+
rapidjson_ver="24b5e7a"
113+
rapidjson_sha256="dcb57b11036cb8fc6b2a57a6aded68d52e9cfe543811bf4fa8941087f84e72d0"
114114

115115
# NEP (Neural Evolution Potential) - CPU version
116-
nep_ver="629ec5dda3127e046fde3f8082aedfca8deb915e"
117-
nep_sha256="57803d2e98ca5c8ced09e3e8d21ac1a0dbd61dda1977997864195f8c54b9b1f9"
116+
nep_ver="629ec5d"
117+
nep_sha256="4d4d3c64211a2a39e5d5c795b77befbba987cc809786e0cd6abfa46d0f3bf8cb"
118118

119119
# =============================================================================
120120
# Package Variable Loading Function

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

0 commit comments

Comments
 (0)