-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rtm
executable file
·192 lines (163 loc) · 4.85 KB
/
build.rtm
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/bash
# -*- shell-script -*-
PKG_VERSION=`(lua -e "V=require('src/Version'); print(V.tag())")`
echo Making Version: $PKG_VERSION
parallel_make_install()
{
if [ "$BUILD_TYPE" != "EXPERIMENTAL" ]; then
$SUDO $MAKE -j install $MAKE_EXTRA
else
echo "$SUDO $MAKE pre-install $MAKE_EXTRA"
$SUDO $MAKE -j pre-install $MAKE_EXTRA
$SUDO rm -f $BASE_DIR/lmod/EXPERIMENTAL
$SUDO ln -s $PKG_VERSION $BASE_DIR/lmod/EXPERIMENTAL
fi
}
save_old_version()
{
if [ "$SITE_CONTROLLED_PREFIX" != "yes" ]; then
$SUDO rm -rf $BASE_DIR/$pkgName/orig
if [ -d $BASE_DIR/$pkgName/$PKG_VERSION ]; then
$SUDO cp -r $BASE_DIR/$pkgName/$PKG_VERSION $BASE_DIR/$pkgName/orig
$SUDO rm -f $PKG/../$pkgName
$SUDO ln -s orig $PKG/../$pkgName
fi
fi
}
make_symlink()
{
if [ "$SITE_CONTROLLED_PREFIX" = "yes" ]; then
$SUDO rm -f $BASE_DIR/../lmod
$SUDO ln -s $PKG_VERSION $BASE_DIR/../lmod
bb=${BASE_DIR/$PKG_VERSION/lmod}
$SUDO find $BASE_DIR/modulefiles $BASE_DIR/init -type f -exec perl -p -i -e "s|$BASE_DIR|$bb|g" {} \;
fi
}
runMe()
{
local cmdA=("$@")
local j
local jj
local i
local ignoreError
local j=0
for i in "${cmdA[@]}" ; do
ignoreError=
if [ "x${i:0:1}" = x- ]; then
i=${i:1}
ignoreError=1
fi
j=$((j+1))
jj=$(printf "%02d" $j)
echo
echo "%%---------------------------------%%"
echo " " $jj: $i
echo "%%---------------------------------%%"
echo
eval $i
if [ -z "$ignoreError" -a $? != 0 ]; then
break
fi
done
}
BUILD_TYPE="standard"
if [ "$1" = "-e" ]; then
BUILD_TYPE="EXPERIMENTAL"
echo BUILD_TYPE: $BUILD_TYPE
fi
myhost=$(hostname -f)
myhost=${myhost%.tacc.utexas.edu}
myhost=${myhost%.local}
first=${myhost%%.*}
SYSHOST=${myhost#*.}
SUDO=""
if [ -x $HOME/.up/bin/arch.py ]; then
MY_ARCH=$($HOME/.up/bin/arch.py)
MY_ARCH="$MY_ARCH/"
fi
MCLAY=~mclay
cat > /tmp/TACC.build.$$ <<EOF
$MCLAY/l/moduleData/${MY_ARCH}cacheDir:$MCLAY/l/moduleData/${MY_ARCH}system.txt
EOF
if [ -n "$LUA_PATH" ]; then
MAKE_EXTRA="LUA_PATH=$LUA_PATH LUA_CPATH=$LUA_CPATH"
fi
case $SYSHOST in
mijo | vmijo )
SITE_CONTROLLED_PREFIX=yes
SUDO="sudo"
base="/opt/apps/lmod/$PKG_VERSION"
ADMIN_DIR=/opt/moduleData
UPDATE_FN=$ADMIN_DIR/system.txt
CACHEDIRS=$ADMIN_DIR/cacheDir
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN --with-siteControlPrefix=yes --with-module-root-path=/opt/apps/modulefiles --with-silentShellDebugging=yes --with-supportKsh=no"
if [ "$SYSHOST" == "mijo" ]; then
EXTRA="$EXTRA --with-exportedModuleCmd=no"
fi
;;
rios | jedrik | vato | devo | xalt-lmod )
SUDO="sudo"
base="/opt/apps"
ADMIN_DIR=/opt/moduleData
UPDATE_FN=$ADMIN_DIR/system.txt
CACHEDIRS=$ADMIN_DIR/cacheDir
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN --with-silentShellDebugging=yes --with-supportKsh=no"
;;
ls5 | maverick | stampede2 | frontera | longhorn )
base="$HOME/l/pkg"
UPDATE_FN=/tmp/losf_last_update
CACHEDIRS=/tmp/moduleData/cacheDir
if [ $SYSHOST == "stampede" ]; then
if [ -x $HOME/.up/bin/arch.py ]; then
base="$base/$($HOME/.up/bin/arch.py)"
else
base="$base/$(uname -m)"
fi
elif [ $SYSHOST == "ls5" ]; then
UPDATE_FN=/home1/moduleData/cacheDir/tacc_cache_timestamp.txt
CACHEDIRS=/home1/moduleData/cacheDir/tacc
elif [ $SYSHOST == "longhorn" ]; then
UPDATE_FN=/home/moduleData/spider_cache_timestamp.txt
CACHEDIRS=/home/moduleData/cacheDir
fi
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN --with-siteName=TACC --with-silentShellDebugging=yes"
SITE_PKG="contrib/TACC/*.lua"
;;
gligar.os)
ADMIN_DIR=/apps/gent/lmodcache/
UPDATE_FN=$ADMIN_DIR/timestamp
CACHEDIRS=$ADMIN_DIR
EXTRA="--with-cachedLoads=yes --with-autoSwap=no --with-disableNameAutoSwap=yes --with-caseIndependentSorting=yes --with-pinVersions=yes --with-silentShellDebugging=yes"
base="$HOME/l/pkg";;
*)
ADMIN_DIR=$HOME/w/moduleData
UPDATE_FN=$ADMIN_DIR/system.txt
CACHEDIRS=$ADMIN_DIR/cacheDir
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN --with-silentShellDebugging=yes --with-supportKsh=no"
base="$HOME/l/pkg"
;;
esac
BASE_DIR=$base
pkgName=lmod
PKG=$BASE_DIR/$pkgName/$PKG_VERSION
EXTRA_CMD="echo "
if [ -n "$SITE_PKG" ]; then
EXTRA_CMD="$SUDO cp $SITE_PKG $PKG/libexec"
fi
rm -f config.status config.log
MAKE=make
command -v remake 2>&1 > /dev/null
if [ "$?" = 0 ]; then
MAKE=remake
fi
cmdA=("-$MAKE distclean"
"./configure --prefix=$BASE_DIR --with-settarg=yes $EXTRA"
"save_old_version"
"parallel_make_install"
"$EXTRA_CMD"
"make_symlink"
"$SUDO rm -rf $BASE_DIR/$pkgName/orig"
"$MAKE clobber"
)
runMe "${cmdA[@]}"
rm -rf /tmp/TACC.build.$$