-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathinstall-EasyBuild-sprint.sh
executable file
·143 lines (110 loc) · 4.11 KB
/
install-EasyBuild-sprint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env bash
# Stop in case of error
set -e
###########################
# Helpers functions
###########################
# Print script help
print_usage()
{
echo "Usage: $0 <github_username> <install_dir> <easyconfigs_branch>"
echo
echo " github_username: username on GitHub for which the EasyBuild repositories should be cloned"
echo
echo " install_dir: directory were all the EasyBuild files will be installed"
echo
echo " easyconfigs_branch: easybuild-easyconfigs branch to check out"
echo
}
# Clone one branch
github_clone_branch()
{
REPO="$1"
BRANCH="$2"
cd "${INSTALL_DIR}"
# Check if BRANCH already exists in the ${GITHUB_USRENAME}/${REPO}
if [[ ! -z $(git ls-remote --heads "git@github.com:${GITHUB_USERNAME}/${REPO}.git" "${BRANCH}") ]]; then
echo "=== Cloning ${GITHUB_USERNAME}/${REPO} branch ${BRANCH} ..."
git clone --branch "${BRANCH}" "git@github.com:${GITHUB_USERNAME}/${REPO}.git"
echo "=== Adding and fetching EasyBuilders GitHub repository @ easybuilders/${REPO} ..."
cd "${REPO}"
git remote add "github_easybuilders" "git@github.com:easybuilders/${REPO}.git"
git fetch github_easybuilders
git branch --set-upstream-to "github_easybuilders/${BRANCH}" "${BRANCH}"
else
echo "=== Cloning ${GITHUB_USERNAME}/${REPO} ..."
git clone "git@github.com:${GITHUB_USERNAME}/${REPO}.git"
echo "=== Adding and fetching EasyBuilders GitHub repository @ easybuilders/${REPO} ..."
cd "${REPO}"
git remote add "github_easybuilders" "git@github.com:easybuilders/${REPO}.git"
git fetch github_easybuilders
git checkout -b "${BRANCH}" "github_easybuilders/${BRANCH}"
fi
}
# Print the content of the module
print_devel_module()
{
cat <<EOF
#%Module
proc ModulesHelp { } {
puts stderr { EasyBuild is a software build and installation framework
written in Python that allows you to install software in a structured,
repeatable and robust way. - Homepage: https://easybuilders.github.io/easybuild/
This module provides the development version of EasyBuild.
}
}
module-whatis {EasyBuild is a software build and installation framework
written in Python that allows you to install software in a structured,
repeatable and robust way. - Homepage: https://easybuilders.github.io/easybuild/
This module provides the development version of EasyBuild.
}
set root "${INSTALL_DIR}"
conflict EasyBuild
prepend-path PATH "\$root/easybuild-framework"
prepend-path PYTHONPATH "\$root/easybuild-framework"
prepend-path PYTHONPATH "\$root/easybuild-easyblocks"
prepend-path PYTHONPATH "\$root/easybuild-easyconfigs"
EOF
}
###########################
# Beginning of the script
###########################
# Check for 'help' argument
if [ "$1" = "-h" -o "$1" = "--help" ] ; then
print_usage
exit 0
fi
# Check the number of parameters
if [ $# -ne 3 ] ; then
echo "Error: invalid arguments"
echo
print_usage
exit 1
fi
# Read parameters
GITHUB_USERNAME="$1"
INSTALL_DIR="$2"
EASYCONFIGS_BRANCH="$3"
# Create install directory
mkdir -p "${INSTALL_DIR}"
cd "${INSTALL_DIR}"
INSTALL_DIR="${PWD}" # get the full path
# Clone code repositories with the 'develop' branch
github_clone_branch "easybuild-framework" "develop"
github_clone_branch "easybuild-easyblocks" "develop"
github_clone_branch "easybuild-easyconfigs" "${EASYCONFIGS_BRANCH}"
# Clone wiki repository with the 'master' branch
#github_clone_branch "easybuild-wiki" "master"
# Create the module file
EB_DEVEL_MODULE_NAME="EasyBuild-develop"
MODULES_INSTALL_DIR=${INSTALL_DIR}/modules
EB_DEVEL_MODULE="${MODULES_INSTALL_DIR}/${EB_DEVEL_MODULE_NAME}"
mkdir -p ${MODULES_INSTALL_DIR}
print_devel_module > "${EB_DEVEL_MODULE}"
echo
echo "=== Run 'module use ${MODULES_INSTALL_DIR}' and 'module load ${EB_DEVEL_MODULE_NAME}' to use your development version of EasyBuild."
echo "=== (you can append ${MODULES_INSTALL_DIR} to your MODULEPATH to make this module always available for loading)"
echo
echo "=== To update each repository, run 'git pull origin' in each subdirectory of ${INSTALL_DIR}"
echo
exit 0