-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·140 lines (116 loc) · 4.46 KB
/
build.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
#!/bin/bash
# hints:
# this script is executed INSIDE of the container by "do.sh" script.
# parse arguments:
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--easybuild_sourcepath)
easybuild_sourcepath="$2"
shift # past argument
shift # past value
;;
--easybuild_buildpath)
easybuild_buildpath="$2"
shift # past argument
shift # past value
;;
--custom_easybuilds_dir)
custom_easybuilds_dir="$2"
shift # past argument
shift # past value
;;
--develop_upstream_dir)
develop_upstream_dir="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# check if we have all mandatory arguments
echo "checking mandatory arguments.."
if [ -d "${easybuild_sourcepath}" ]; then
echo "--easybuild_sourcepath (EB download location) defined as ${easybuild_sourcepath} .. LGFM"
export EASYBUILD_SOURCEPATH=${easybuild_sourcepath} # from CLI argument
else
echo "--easybuild_sourcepath (EB download location) undefined/it's not directory. BAD"
exit 1
fi
if [ -d "${easybuild_buildpath}" ]; then
echo "--easybuild_buildpath defined as ${easybuild_buildpath} .. LGFM"
else
echo "--easybuild_buildpath undefined/it's not directory. BAD"
exit 1
fi
# https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
SCRIPT=$(readlink -f $0) # Absolute path to this script.
SCRIPTPATH=$(dirname $SCRIPT) # Absolute path this script is in. /home/user/bin
# reset the module cache, just for case:
rm ~/.lmod.d/.cache -rf
# load the EasyBuild environment
module purge
module use $EASYBUILD_PREFIX/modules/all
module load EasyBuild #this will load latest EB available
# deal with licenses
export INTEL_LICENSE_FILE="/home/soft/intel/license.lic"
#
# stable software:
# - we can use the upstream easyconfigs
#
stable_list_file="${SCRIPTPATH}/easybuild_stable.swlist"
stable_path_prefix=$(readlink -f ${EBROOTEASYBUILD}/lib/python2.7/site-packages/easybuild_easyconfigs-*/easybuild/easyconfigs)
echo "processing ${stable_list_file}"
while IFS='' read -r line || [[ -n "$line" ]]; do
#echo "line: $line"
[[ "$line" =~ ^#.*$ ]] && continue # regexp matching '#' = commented lines we don't care
command="eb -r --buildpath=${easybuild_buildpath} ${stable_path_prefix}/${line}"
echo "================================================================================"
echo "command: ${command}"
eval ${command}
done < "${stable_list_file}"
#
# easyconfigs from develop branch of upstream..:
#
if [ -d "${develop_upstream_dir}" ]; then
echo "--develop_upstream_dir specified to ${develop_upstream_dir} .. let's process upstream easyconfigs."
upstream_list_file="${SCRIPTPATH}/easybuild_upstream.swlist"
echo "processing ${SCRIPTPATH}/easybuild_upstream.swlist as upstream_list_file.."
# process the lines in the list..:
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "line: $line"
[[ "$line" =~ ^#.*$ ]] && continue # regexp matching '#' = commented lines we don't care
command="eb -r ${develop_upstream_dir} --buildpath=${easybuild_buildpath} ${develop_upstream_dir}/${line}"
echo "================================================================================"
echo "command: ${command}"
eval ${command}
done < "${upstream_list_file}"
else
echo "--develop_upstream_dir - not specified.."
fi
#
# site-specific and unstable software:
# - we use easyconfigs cloned from git.
#
if [ -d "${custom_easybuilds_dir}" ]; then
echo "--custom_easybuilds_dir specified to ${custom_easybuilds_dir} .. let's process custom easyconfigs too."
else
echo "--custom_easybuilds_dir - not specified, we're done."
exit 0
fi
# exit 0 #TODO: exit for now.. perhaps we could have some swtich for this...
site_specific_list_file="${SCRIPTPATH}/easybuild_specific.swlist"
echo "processing ${specific_list_file}"
while IFS='' read -r line || [[ -n "$line" ]]; do
#echo "line: $line"
[[ "$line" =~ ^#.*$ ]] && continue # regexp matching '#' = commented lines we don't care
command="eb --buildpath=${easybuild_buildpath} -r ${custom_easybuilds_dir} ${custom_easybuilds_dir}/${line}"
echo "================================================================================"
echo "command: ${command}"
eval ${command}
done < "${site_specific_list_file}"