Remove package sources and host only the expected SHA-256 #3
5
.gitignore
vendored
5
.gitignore
vendored
@@ -12,3 +12,8 @@ support/Dockerfile
|
|||||||
version.cpp
|
version.cpp
|
||||||
version.rc
|
version.rc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.tar.gz
|
||||||
|
*.bz2
|
||||||
|
*.xz
|
||||||
|
*.zip
|
||||||
|
*.msi
|
||||||
|
|||||||
71
create_packages.sh
Executable file
71
create_packages.sh
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CURRENT_DIR=$(realpath "$0")
|
||||||
|
CURRENT_DIR=$(dirname "${CURRENT_DIR}")
|
||||||
|
|
||||||
|
. "${CURRENT_DIR}/src/scripts/versions.sh"
|
||||||
|
. "${CURRENT_DIR}/src/scripts/libraries.sh"
|
||||||
|
|
||||||
|
function check_should_update() {
|
||||||
|
local NAME=$1
|
||||||
|
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
|
||||||
|
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
|
||||||
|
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function download_and_update_hash() {
|
||||||
|
local NAME=$1
|
||||||
|
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
|
||||||
|
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
|
||||||
|
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
|
||||||
|
local CLEANUP_LIST=(${PROJECT_CLEANUP[${NAME}]//:/ })
|
||||||
|
if [ "${NAME}" == "GTEST" ]; then
|
||||||
|
CLEANUP_LIST=(${PROJECT_CLEANUP["TESTING"]//:/ })
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ] && [ "${CLEANUP_LIST[0]}" != "" ]; then
|
||||||
|
rm -r ${CURRENT_DIR}/support/${CLEANUP_LIST[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
||||||
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"
|
||||||
|
|
||||||
|
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
|
||||||
|
echo "failed $NAME"
|
||||||
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}"
|
||||||
|
sha256sum ${ITEM_LIST[1]} >${ITEM_LIST[1]}.sha256
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
local HASH=$(cat support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256 | awk '{print $1}')
|
||||||
|
HASH_LIST+=("set(${NAME}_HASH ${HASH})")
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_hashes_cmake() {
|
||||||
|
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
|
||||||
|
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ]; then
|
||||||
|
download_and_update_hash $NAME
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd "${CURRENT_DIR}"
|
||||||
|
HASH_LIST=()
|
||||||
|
create_hashes_cmake
|
||||||
|
|
||||||
|
if check_should_update BOOST || check_should_update BOOST2; then
|
||||||
|
rm -f support/3rd_party/boost_*
|
||||||
|
fi
|
||||||
|
|
||||||
|
download_and_update_hash BOOST
|
||||||
|
download_and_update_hash BOOST2
|
||||||
|
|
||||||
|
(printf "%s\n" "${HASH_LIST[@]}" | sort) >${CURRENT_DIR}/cmake/hashes.cmake
|
||||||
|
popd
|
||||||
@@ -6,66 +6,34 @@ CURRENT_DIR=$(dirname "${CURRENT_DIR}")
|
|||||||
. "${CURRENT_DIR}/src/scripts/versions.sh"
|
. "${CURRENT_DIR}/src/scripts/versions.sh"
|
||||||
. "${CURRENT_DIR}/src/scripts/libraries.sh"
|
. "${CURRENT_DIR}/src/scripts/libraries.sh"
|
||||||
|
|
||||||
function check_should_update() {
|
function download_package() {
|
||||||
local NAME=$1
|
local NAME=$1
|
||||||
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
|
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
|
||||||
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
|
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ]; then
|
||||||
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function download_and_update_hash() {
|
|
||||||
local NAME=$1
|
|
||||||
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
|
|
||||||
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
|
|
||||||
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
|
|
||||||
local CLEANUP_LIST=(${PROJECT_CLEANUP[${NAME}]//:/ })
|
|
||||||
if [ "${NAME}" == "GTEST" ]; then
|
|
||||||
CLEANUP_LIST=(${PROJECT_CLEANUP["TESTING"]//:/ })
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ] && [ "${CLEANUP_LIST[0]}" != "" ]; then
|
|
||||||
rm -r ${CURRENT_DIR}/support/${CLEANUP_LIST[0]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
||||||
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"
|
|
||||||
|
|
||||||
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
|
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
|
||||||
echo "failed $NAME"
|
echo "failed $NAME"
|
||||||
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}"
|
|
||||||
sha256sum ${ITEM_LIST[1]} >${ITEM_LIST[1]}.sha256
|
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}/"
|
||||||
|
if ! sha256sum -c "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"; then
|
||||||
|
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
|
||||||
|
echo "failed sha256 validation: $NAME"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local HASH=$(cat support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256 | awk '{print $1}')
|
|
||||||
HASH_LIST+=("set(${NAME}_HASH ${HASH})")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_hashes_cmake() {
|
function download_packages() {
|
||||||
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
|
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
|
||||||
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ]; then
|
download_package $NAME
|
||||||
download_and_update_hash $NAME
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
pushd "${CURRENT_DIR}"
|
pushd "${CURRENT_DIR}"
|
||||||
HASH_LIST=()
|
download_packages
|
||||||
create_hashes_cmake
|
|
||||||
|
|
||||||
if check_should_update BOOST || check_should_update BOOST2; then
|
|
||||||
rm -f support/3rd_party/boost_*
|
|
||||||
fi
|
|
||||||
|
|
||||||
download_and_update_hash BOOST
|
|
||||||
download_and_update_hash BOOST2
|
|
||||||
|
|
||||||
(printf "%s\n" "${HASH_LIST[@]}" | sort) >${CURRENT_DIR}/cmake/hashes.cmake
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
Reference in New Issue
Block a user