forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-fwlite-ib
executable file
·61 lines (50 loc) · 2.71 KB
/
build-fwlite-ib
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
#!/bin/sh -ex
ARCHITECTURE=$1
RELEASE_FORMAT=$2
REPOSITORY=$3
PKGTOOLS_HASH=$4
CMSDIST_HASH=$5
# Workspace is usually defined by jenkins. If not running in
# jenkins it will assume the current directory is the workspace.
WORKSPACE=${WORKSPACE-$PWD}
echo $WORKSPACE
set -x
export RELEASE_NAME=`date +$RELEASE_FORMAT`
RELEASE_QUEUE=`echo $RELEASE_NAME | sed 's/\(CMSSW_[0-9][0-9]*_[0-9][0-9]*.*_X\).*/\1/'`
cd "$WORKSPACE"
rm -rf CMSDIST cms PKGTOOLS
CMSDIST_REPO=cms-sw
PKGTOOLS_REPO=cms-sw
CONFIG_MAP_URL="${WORKSPACE}/cms-bot/config.map"
eval `cat $CONFIG_MAP_URL | grep "SCRAM_ARCH=$ARCHITECTURE;" | grep "RELEASE_QUEUE=$RELEASE_QUEUE;"`
git clone -b $CMSDIST_TAG [email protected]:$CMSDIST_REPO/cmsdist.git CMSDIST
git clone -b $PKGTOOLS_TAG [email protected]:$PKGTOOLS_REPO/pkgtools.git PKGTOOLS
pushd CMSDIST;
git checkout $CMSDIST_TAG;
# If the hash is specified, use it.
if [ ! "X$CMSDIST_HASH" = X ]; then
git reset --hard $CMSDIST_HASH
fi
popd
pushd PKGTOOLS;
git checkout $PKGTOOLS_TAG;
if [ ! "X$PKGTOOLS_HASH" = X ]; then
git reset --hard $PKGTOOLS_HASH
fi
popd
perl -p -i -e "s/### RPM cms fwlite.*/### RPM cms fwlite ${RELEASE_FORMAT}_FWLITE/" CMSDIST/fwlite.spec
DOW=`python -c "import os;from datetime import datetime;print datetime.strptime(os.environ['RELEASE_NAME'].replace('_X_SLHC_', '_X_').rsplit('_X_')[1], '%Y-%m-%d-%H00').strftime('%a').lower()"`
HOUR=`python -c "import os;from datetime import datetime;print datetime.strptime(os.environ['RELEASE_NAME'].replace('_X_SLHC_', '_X_').rsplit('_X_')[1], '%Y-%m-%d-%H00').strftime('%H').lower()"`
CMSSW_MAJOR_MINOR=`echo $RELEASE_NAME | sed -e 's/CMSSW_\([0-9]*\)_\([0-9]*\).*/\1.\2/g'`
PKGTOOLS/cmsBuild -k --builders 2 -j 20 --repository $REPOSITORY --architecture $ARCHITECTURE --work-dir cms build fwlite
pushd ${WORKSPACE}/cms/WEB/build-logs/${ARCHITECTURE}/${RELEASE_FORMAT}_FWLITE/logs/src
tar xzf src-logs.tgz
python ${WORKSPACE}/cms-bot/buildLogAnalyzer.py -r ${RELEASE_FORMAT}_FWLITE -p ${WORKSPACE}/cms/${ARCHITECTURE}/cms/fwlite/${RELEASE_FORMAT}_FWLITE/src/PackageList.cmssw --logDir ${WORKSPACE}/cms/WEB/build-logs/${ARCHITECTURE}/${RELEASE_FORMAT}_FWLITE/logs/src --topURL "http://cern.ch/cms-sdt/rc/${ARCHITECTURE}/www/${DOW}/${CMSSW_MAJOR_MINOR}-${DOW}-${HOUR}/${RELEASE_FORMAT}/new_FWLITE/"
cd ../html
zip -r ../html-logs.zip ./
cd ..
mv html-logs.zip $WORKSPACE/
popd
SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=60"
ssh $SSH_OPTS [email protected] mkdir -p /data/sdt/buildlogs/${ARCHITECTURE}/fwlite/${RELEASE_FORMAT}/new_FWLITE || true
scp $SSH_OPTS $WORKSPACE/html-logs.zip [email protected]:/data/sdt/buildlogs/${ARCHITECTURE}/fwlite/${RELEASE_FORMAT}/new_FWLITE/ || true