forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release
executable file
·90 lines (72 loc) · 3.29 KB
/
build-release
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
#!/bin/sh -ex
# The release should have been already created in Github
# CMSSW_X_Y_Z: the release to build
# ARCHITECTURE: architecture for the build
# ISSUE_NUMBER: the number of the issue that triggered the build
# DRY_RUN_PARAM: parameter that to use dry-run
# ONLY_BUILD_TOOLCONF: if True, tells me to only build cmssw-tool-conf
HERE=$WORKSPACE/build
BUILD_DIR=$HERE/$CMSSW_X_Y_Z-build
mkdir -p $BUILD_DIR
QUEUE=$CMSSW_QUEUE
if [ "X$ONLY_BUILD_TOOLCONF" = Xtrue ]; then
POST_ACTION='TOOL_CONF_BUILDING'
else
POST_ACTION='BUILDING'
fi
git clone git@github.com:cms-sw/cmsdist.git $BUILD_DIR/CMSDIST
pushd $BUILD_DIR/CMSDIST
eval $(cat $WORKSPACE/config.map | grep "SCRAM_ARCH=$ARCHITECTURE;" | grep "RELEASE_QUEUE=$QUEUE;")
# a patch release uses the same cmsdist tag as its base release
case $CMSSW_X_Y_Z in
*patch*)
BASE_RELEASE=`echo $CMSSW_X_Y_Z | sed 's/_patch[0-9]*//g'`
CMSDIST_TAG=REL/$BASE_RELEASE/$ARCHITECTURE
PATCH='-patch'
;;
esac
git checkout $CMSDIST_TAG
popd
git clone -b $PKGTOOLS_TAG git@github.com:cms-sw/pkgtools.git $BUILD_DIR/PKGTOOLS
BRANCH_DETAILS="CMSDIST Branch: [$CMSDIST_TAG](https://github.com/cms-sw/cmsdist/commits/$CMSDIST_TAG), PKGTOOLS Branch: [$PKGTOOLS_TAG](https://github.com/cms-sw/pkgtools/commits/$PKGTOOLS_TAG)"
WORKER=`hostname -s`
./report-build-release-status ${BUILD_NUMBER} $WORKER $ISSUE_NUMBER $ARCHITECTURE $CMSSW_X_Y_Z $POST_ACTION $DRY_RUN_PARAM -d "$BRANCH_DETAILS"
pushd $BUILD_DIR
# prepare cmssw.spec
if [ "X$ENABLE_DEBUG" = X ] && [ "X$PATCH" = X ]; then
perl -p -i -e 's/^[\s]*%define[\s]+subpackageDebug[\s]+./#subpackage debug disabled/' CMSDIST/cmssw.spec CMSDIST/cmssw-patch.spec CMSDIST/coral.spec
(cd CMSDIST ; git commit -m 'Coherent debug package setup.' cmssw.spec cmssw-patch.spec coral.spec)
fi
sh -e PKGTOOLS/scripts/prepare-cmsdist $CMSSW_X_Y_Z $ARCHITECTURE 2>&1 | tee -a $WORKSPACE/prepare-cmsdist.log
CMS_TAG=""
if [ "X`PKGTOOLS/cmsBuild --help | grep tag=NAME`" != "X" ] ; then
case `uname -s` in
Darwin ) MD5_CMD=md5;;
* ) MD5_CMD=md5sum;;
esac
CMS_TAG="--tag `echo $QUEUE | $MD5_CMD | tr '0123456789' 'ghijklmnop' | cut -b1-6`"
fi
CMSBUILD_CMD="PKGTOOLS/cmsBuild --architecture=$ARCHITECTURE --builders 4 -j $(getconf _NPROCESSORS_ONLN) $CMS_TAG"
$CMSBUILD_CMD --specs-only build cmssw$PATCH
TOOL_CONF_PACKAGES=`grep '^%define \(build\|\)directpkgreqs' SPECS/cms/cmssw$PATCH/*/spec | grep -v '%{nil}' | sed 's|.*directpkgreqs[ \t]*||' | tr ' ' '\n' | cut -f2 -d/ | sort | uniq | tr '\n' ' '`
$CMSBUILD_CMD build $TOOL_CONF_PACKAGES
$CMSBUILD_CMD --sync-back upload $TOOL_CONF_PACKAGES
$CMSBUILD_CMD deprecate-local $TOOL_CONF_PACKAGES
if [ "X$ONLY_BUILD_TOOLCONF" = Xtrue ]; then
echo 'I was asked to build only cmssw-tool-conf, exiting without building cmssw'
pushd $HERE/$CMSSW_X_Y_Z-build/CMSDIST
git tag REL/$CMSSW_X_Y_Z-tool-conf/$ARCHITECTURE
git push origin REL/$CMSSW_X_Y_Z-tool-conf/$ARCHITECTURE
popd
# If it reaches here it is because there were no errors
echo 'ALL_OK'
exit 0
fi
$CMSBUILD_CMD build cmssw$PATCH
popd
pushd $HERE/$CMSSW_X_Y_Z-build/CMSDIST
git tag REL/$CMSSW_X_Y_Z/$ARCHITECTURE
git push origin REL/$CMSSW_X_Y_Z/$ARCHITECTURE
popd
# If it reaches here it is because there were no errors
echo 'ALL_OK'