-
Notifications
You must be signed in to change notification settings - Fork 245
/
build-fwlite-ib
executable file
·65 lines (54 loc) · 3.03 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
61
62
63
64
#!/bin/sh -ex
source $(dirname $0)/cmsrep.sh
source $(dirname $0)/cmssdt.sh
ARCHITECTURE=$1
RELEASE_FORMAT=$2
REPOSITORY=$3
PKGTOOLS_HASH=$4
CMSDIST_HASH=$5
export SCRAM_ARCH=$ARCHITECTURE
# 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 https://github.com/$CMSDIST_REPO/cmsdist.git CMSDIST
git clone -b $PKGTOOLS_TAG https://github.com/$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=`python3 -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=`python3 -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'`
CMSBUILD_ARGS="--server http://${CMSREP_IB_SERVER}/cgi-bin/cmspkg --upload-server ${CMSREP_IB_SERVER}"
PYTHONPATH= PKGTOOLS/cmsBuild ${CMSBUILD_ARGS} -k --builders 2 -j 20 --repository $REPOSITORY --architecture $ARCHITECTURE $(cmsbuild_args "${BUILD_OPTS}" "${MULTIARCH_OPTS}" "${ARCHITECTURE}") --work-dir cms build fwlite
pushd ${WORKSPACE}/cms/WEB/build-logs/${ARCHITECTURE}/${RELEASE_FORMAT}_FWLITE/logs/src
tar xzf src-logs.tgz
${CMS_PYTHON_TO_USE} ${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 cmsbuild@${CMSSDT_SERVER} mkdir -p /data/sdt/buildlogs/${ARCHITECTURE}/fwlite/${RELEASE_FORMAT}/new_FWLITE || true
scp $SSH_OPTS $WORKSPACE/html-logs.zip cmsbuild@${CMSSDT_SERVER}:/data/sdt/buildlogs/${ARCHITECTURE}/fwlite/${RELEASE_FORMAT}/new_FWLITE/ || true