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
|
#!/usr/bin/env bash
# Utility to get basic "startup" files for Platform's CBI Build
# this localBuildProperties.shsource file is to ease local builds to override some variables.
# It should not be used for production builds.
source localBuildProperties.shsource 2>/dev/null
export GIT_HOST=${GIT_HOST:-"git.eclipse.org"}
export BUILD_HOME=${BUILD_HOME:-/shared/eclipse/builds}
if [[ -z "${BRANCH}" ]]
then
export BRANCH=master
printf "\n\tWARNING: %s\n" "BRANCH was not defined. 'master' was assumed"
fi
# A constant, in Platform builds
export AGGR_REPO_NAME=eclipse.platform.releng.aggregator
# contrary to intuition (and previous behavior, bash 3.1) do NOT use quotes around right side of expression.
if [[ "${STREAM}" =~ ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$ ]]
then
export STREAMMajor=${BASH_REMATCH[1]}
export STREAMMinor=${BASH_REMATCH[2]}
export STREAMService=${BASH_REMATCH[3]}
else
echo "STREAM must contain major, minor, and service versions, such as 4.3.0"
echo " but found ${STREAM}"
exit 1
fi
if [[ ! "${BUILD_TYPE}" =~ [IMNPXYU] ]]
then
echo "BUILD_TYPE must by I,M, N, P, U, X, or Y"
echo " but found ${BUILD_TYPE}"
exit 1
fi
# if not defined "externally", we use default for eclipse.org
if [[ -z $REPO_AND_ACCESS ]]
then
# unless we are on 'build' machine
if [[ "build" == "$(hostname)" || "$(hostname)" =~ ^hipp[[:digit:]]+$ ]]
then
export REPO_AND_ACCESS=file:///gitroot
else
export REPO_AND_ACCESS=git://git.eclipse.org/gitroot
fi
fi
export BUILD_ROOT=${BUILD_ROOT:-${BUILD_HOME}/${STREAMMajor}${BUILD_TYPE}}
echo "Exporting production scripts ... "
echo " STREAM: $STREAM"
echo " STREAMMajor: $STREAMMajor"
echo " STREAMMinor: $STREAMMinor"
echo " STREAMService: $STREAMService"
echo " BUILD_TYPE: $BUILD_TYPE"
echo " BUILD_ROOT: $BUILD_ROOT"
echo " BUILD_HOME: $BUILD_HOME"
echo " REPO_AND_ACCESS: $REPO_AND_ACCESS"
# We put these in build_root in case two builds get started at once.
# (such as N and I build, both from master).
# TODO: could maybe do pull here, if already exists?
rm -fr $BUILD_ROOT/tmp/${AGGR_REPO_NAME} 2>/dev/null
if [[ $? != 0 ]]
then
echo "[ERROR] Exiting, since could not remove $BUILD_ROOT/tmp/${AGGR_REPO_NAME} as expected."
exit 1
fi
# Make dir in case first run (note: this must be after the above "removes",
# or else first time through they will remove this directory itself.
mkdir -p ${BUILD_ROOT}/tmp
if [[ $? != 0 ]]
then
echo "[ERROR] Exiting, since could not make $BUILD_ROOT/tmp, as expected."
exit 1
fi
function makeProductionDirectoryOnBuildMachine ()
{
# NOTE: master of production scripts used for all branch builds
git clone --depth=1 -b master ${REPO_AND_ACCESS}/platform/${AGGR_REPO_NAME} $BUILD_ROOT/tmp/${AGGR_REPO_NAME}
RC=$?
if [[ $RC != 0 ]]
then
echo "Could not clone repo as expected"
exit $RC
fi
echo " PRODUCTION_SCRIPTS_DIR: $PRODUCTION_SCRIPTS_DIR"
#remove any previous production scripts, to make sure completely fresh
rm -fr $BUILD_ROOT/${PRODUCTION_SCRIPTS_DIR} 2>/dev/null
# cp whole script directory "up" so directly under build_root, in constant place
cp -r $BUILD_ROOT/tmp/${AGGR_REPO_NAME}/${PRODUCTION_SCRIPTS_DIR} ${BUILD_ROOT}
if [[ $? != 0 ]]
then
echo "Exiting, since could not copy production scripts, as expected."
exit 1
fi
chmod +x ${BUILD_ROOT}/${PRODUCTION_SCRIPTS_DIR}/*.sh
if [[ $? != 0 ]]
then
echo "Could not chmod of production scripts to executable. Running under wrong id?"
exit 1
fi
}
|