aboutsummaryrefslogtreecommitdiff
path: root/scripts/Backport.job
blob: 4b88efd13655db8cefb84466431be8db7b70a9d3 (plain)
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
#!/bin/bash
#
#   Copyright (C) 2015 Linaro, Inc
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# 

# Improve debug logs
PRGNAME=`basename $0`
PS4='+ $PRGNAME: ${FUNCNAME+"$FUNCNAME : "}$LINENO: '

usage()
{
    # Format this section with 75 columns.
    cat << EOF
  Backport.job [--help] [f|--fileserver 'remote file server'] --target triplet branch
EOF
    return 0
}

abe_dir="${WORKSPACE}/abe"
export CONFIG_SHELL="/bin/bash"

cat << EOF > ${WORKSPACE}/BUILD-INFO.txt
Format-Version: 0.5

Files-Pattern: *
License-Type: open
EOF

rm -fr ${WORKSPACE}/_build/builds/* ${WORKSPACE}/_build/sysroots/*
mkdir -p ${WORKSPACE}/_build
cd ${WORKSPACE}/_build

case ${target} in
    schroot-*)
	schroot_arch=$(echo ${target} | sed -e "s/^schroot-\([^-]*\)-\(.*\)/\1/")
	target=$(echo ${target} | sed -e "s/^schroot-\([^-]*\)-\(.*\)/\2/")
	CONFIG_SHELL="schroot -c tcwg-build-${schroot_arch}-trusty --preserve-environment -- ${CONFIG_SHELL}"
	;;
esac

# If started by a Gerrit Trigger, use that for the branch.
if test x"${GERRIT_TOPIC}" != x; then
    gcc_branch="gcc.git~${GERRIT_TOPIC}"
fi

$CONFIG_SHELL -x ${abe_dir}/test-backport.sh --target ${target} ${gcc_branch}

# force a failure of abe has build problems.
if test $? -gt 0; then
  exit 1
fi