Skip to content

Commit

Permalink
Add check for failed repo downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 committed Nov 28, 2023
1 parent e3ebc69 commit 00d47d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
6 changes: 3 additions & 3 deletions config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ PYTHON_VERSION=3.8
# Tag to use for getting the layouts and manage/deploy scripts
# See: https://github.com/dmwm/deployment/tags
#DMWM_GIT_URL=https://github.com/dmwm/deployment
DMWM_GIT_TAG=debug
DMWM_GIT_URL=https://github.com/nothingface0/cms_dmwm_deployment
DMWM_GIT_TAG=debug

# DQMGUI tag to use, see https://github.com/cms-DQM/dqmgui_prod/tags
#DQMGUI_GIT_TAG=9.8.0
DQMGUI_GIT_TAG=python3_backup
DQMGUI_GIT_URL=https://github.com/cms-DQM/dqmgui_prod
DQMGUI_GIT_TAG=python3_backup

# Boost.GIL. At most version 1.67!! The API changed radically after that.
BOOST_GIL_GIT_URL=https://github.com/boostorg/gil
BOOST_GIL_GIT_TAG=boost-1.66.0

# OLD rotoglup code. Commit was found with lots of pain, so that the patch
# applies: https://github.com/cms-sw/cmsdist/blob/comp_gcc630/dqmgui-rtgu.patch
ROTOGLUP_GIT_TAG=d8ce23aecd0b1fb7d45c9bedb615abdab27a5494
ROTOGLUP_GIT_URL=https://github.com/rotoglup/rotoglup-scratchpad
ROTOGLUP_GIT_TAG=d8ce23aecd0b1fb7d45c9bedb615abdab27a5494

# Yahoo!(TM) UI
YUI_GIT_URL=https://github.com/yui/yui2
Expand Down
29 changes: 26 additions & 3 deletions download_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ _clone_from_git() {

}

download_repo() {
download_and_compress_repo() {
set -x
repo=$1
download_repo_flag_name=do_download_$repo
Expand Down Expand Up @@ -120,11 +120,13 @@ find_compatible_python_version() {
if which "$python_executable" 2>&1 1>&/dev/null; then
if _check_python_version $(which "$python_executable"); then
echo $(which "$python_executable")
return 0
fi
fi
done
echo
}

### Main script

# Check for python version, just to be sure
Expand All @@ -135,6 +137,7 @@ if [ -z "$python_exe" ]; then
else
echo "Using python $python_exe"
fi

# For GitHub repos, clone the source on a specific branch/tag/ref, then make a tar.
declare -a repos_to_download=(rotoglup boost_gil dmwm dqmgui yui extjs d3 jsroot root)

Expand All @@ -156,10 +159,30 @@ for ARGUMENT in "$@"; do
done

# Download all repos in parallel
declare -a backround_pids=()
declare -a repos_failed_to_download=()
for repo in "${repos_to_download[@]}"; do
download_repo "$repo" &
download_and_compress_repo "$repo" &
backround_pids+=("$!") # Keep the PID of the process to monitor it
done

download_python_packages "$python_exe"
wait

# Wait for bacgkround tasks to complete
for i in "${!backround_pids[@]}"; do
# Try to find the pid in the currently running processes
while ps -p "${backround_pids[i]}" | tail -1 | grep "${backround_pids[i]}"; do
sleep 1
done
# Process stopped, check for on-zero exit code
if ! wait "${backround_pids[i]}"; then
repos_failed_to_download+=("${repos_to_download[i]}")
fi
done

if [ "${#repos_failed_to_download[*]}" -gt 0 ]; then
echo "Failed to download the following repos: ${repos_failed_to_download[*]}"
exit 1
fi

echo "INFO: Done!"

0 comments on commit 00d47d9

Please sign in to comment.