forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-cmssw-validation-with-patch
executable file
·91 lines (78 loc) · 3.67 KB
/
build-cmssw-validation-with-patch
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
#!/bin/sh -ex
ARCHITECTURE=$1
RELEASE_FORMAT=$2
REPOSITORY=$3
BASE_PACKAGE_NAME=$4
PKGTOOLS_HASH=$5
CMSDIST_HASH=$6
CMSSW_RELEASE_BASE=$7
SUBPACKAGE_DEBUG=$8
# 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
case $ARCHITECTURE in
*_mic_*) export BUILD_ARCH=`echo $ARCHITECTURE | cut -f1,2 -d_` ;;
esac
# If you find a squid process, use it, assuming it has the default port.
if pgrep squid >/dev/null ; then
export http_proxy=http://localhost:3128
fi
RELEASE_NAME=`date +$RELEASE_FORMAT`
DAY=`date +%Y-%m-%d`
HOUR=`echo $RELEASE_NAME | sed -e's|.*-\([0-9][0-9]\)00|\1|'`
RELEASE_QUEUE=`echo $RELEASE_NAME | sed 's/\(CMSSW_[0-9][0-9]*_[0-9][0-9]*.*_X\).*/\1/'`
CMSDIST_REPO=cms-sw
cd "$WORKSPACE"
rm -rf CMSDIST cms PKGTOOLS
git clone git://github.com/$CMSDIST_REPO/cmsdist.git CMSDIST
pushd CMSDIST
DEFAULT_CMSDIST_TAG="`git rev-parse HEAD`"
popd
CMSDIST_REPO=cms-sw
PKGTOOLS_REPO=cms-sw
CONFIG_MAP_URL="https://raw.githubusercontent.com/cms-sw/cms-bot/HEAD/config.map"
eval `curl -s -k $CONFIG_MAP_URL | grep "SCRAM_ARCH=$ARCHITECTURE;" | grep "RELEASE_QUEUE=$RELEASE_QUEUE;"`
# Use git clone -b to avoid ambiguities between branch and refs.
# Cleanup before checking out
rm -rf CMSDIST PKGTOOLS
git clone -b $CMSDIST_TAG git@github.com:$CMSDIST_REPO/cmsdist.git CMSDIST
git clone -b $PKGTOOLS_TAG git@github.com:$PKGTOOLS_REPO/pkgtools.git PKGTOOLS
# Use these in case github dies of an horrible death.
# git clone https://:@git.cern.ch/kerberos/PKGTOOLS.git PKGTOOLS
# git clone https://:@git.cern.ch/kerberos/CMSDIST.git CMSDIST
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
# We checkout a few files from the default branch in any case.
pushd CMSDIST
git checkout $DEFAULT_CMSDIST_TAG -- cmssw-validation.spec
git checkout $DEFAULT_CMSDIST_TAG -- cmssw-ib.spec
git checkout $DEFAULT_CMSDIST_TAG -- das-cache.file
DEBUG_SUBPACKS="cmssw.spec coral.spec cmssw-patch.spec"
if [ "X$SUBPACKAGE_DEBUG" = X ]; then
perl -p -i -e 's/^[\s]*%define[\s]+subpackageDebug[\s]+./#subpackage debug disabled/' $DEBUG_SUBPACKS
fi
popd
echo "### RPM cms dummy `date +%%s`\n%prep\n%build\n%install\n" > CMSDIST/dummy.spec
perl -p -i -e "s/### RPM cms cmssw.*/### RPM cms cmssw $CMSSW_RELEASE_BASE/" CMSDIST/cmssw.spec
perl -p -i -e "s/### RPM cms cmssw-validation .*/### RPM cms cmssw-validation $RELEASE_NAME/" CMSDIST/cmssw-validation.spec
perl -p -i -e "s/### RPM cms cmssw-patch.*/### RPM cms cmssw-patch $RELEASE_NAME/" CMSDIST/cmssw-patch.spec
perl -p -i -e "s/BuildRequires: cmssw /BuildRequires: $BASE_PACKAGE_NAME /" CMSDIST/cmssw-validation.spec
CMSSW_BUILD_ROOT=`echo ${BASE_PACKAGE_NAME}_ROOT | tr "[:lower:]-" "[:upper:]_"`
perl -p -i -e "s/CMSSW_ROOT/$CMSSW_BUILD_ROOT/" CMSDIST/cmssw-validation.spec
perl -p -i -e "s/%define baserelver[\s].*/%define baserelver $CMSSW_RELEASE_BASE/" CMSDIST/cmssw-patch-build.file
perl -p -i -e "s/%define baserelqueue[\s].*/%define baserelqueue $CMSSW_RELEASE_BASE/" CMSDIST/cmssw-patch-build.file
echo " " >> CMSDIST/cmssw-validation.spec
PKGTOOLS/cmsBuild --debug -k --builders 2 -j 20 --repository $REPOSITORY --architecture $ARCHITECTURE --work-dir cms `buildtype="build cmssw-validation" ; echo $PKGTOOLS_TAG | grep 'V00-16' > /dev/null && ( echo -e "[$buildtype]\npriority: 20 \n[bootstrap]\npriority: 10\ndoNotBootstrap: True" > cmsBuild.cfg && echo --cfg cmsBuild.cfg ) || echo $buildtype`