-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiotg_next_staging.sh
More file actions
executable file
·184 lines (156 loc) · 5.59 KB
/
iotg_next_staging.sh
File metadata and controls
executable file
·184 lines (156 loc) · 5.59 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash -ex
mydir="$(cd $(dirname $0); pwd)"
source $mydir/bkc_common.sh # Include library of common build functions
exit_usage()
{
cat <<EOF >&2
${0}: reconstitutes the dev-bkc kernel from all the coe-tracker sandboxed branches
USAGE:
$0 [ -p ] [ -o ] [ -s ]
p = push the branches to staging for backup (tracker by default)
o = push the branches to bkc for testing
s = use staging branches
h|? = help (this screen)
EOF
exit 1
}
##########################################
#
# MAIN SCRIPT
#
##########################################
# Parse the commandline parameters
OPT_push=false
OPT_exit_only=false
while getopts "posbrh?" OPTION; do
case $OPTION in
p)
OPT_push=true
;;
h|?)
OPT_exit_only=true
;;
esac
done
$OPT_exit_only && exit_usage
test -n "$YOCTO_SANDBOX_BRANCH" || die "YOCTO_SANDBOX_BRANCH not defined"
test -n "$BASE_SANDBOX_BRANCH_QUILT" || die "BASE_SANDBOX_BRANCH_QUILT not defined"
yocto_sandbox_branch=$(echo $YOCTO_SANDBOX_BRANCH | sed -re 's/\s//' -e 's/^(tracker|origin)\///')
# Create a local copy of the kerne-bkc project, add the
# coe-tracker remote.
echo "Creating/Update working project"
declare repo=kernel-staging
declare repo_url=${KERNEL_REPOS[$repo]}
declare rmt=origin
declare repo_dir=$WORKSPACE/${repo_url##*/}
repo_dir=${repo_dir%\.git}
git_project $repo_url $repo_dir $yocto_sandbox_branch || \
die "Unable to clone/update $repo"
#RT will be "-rt6", "-rt25" or empty, empty means non-RT
RT=$(echo "$YOCTO_SANDBOX_BRANCH" | sed -rn 's/.*(-rt[0-9]+).*/\1/p')
tags=""
pushd $repo_dir
# Checkout the sandbox branch
git checkout $yocto_sandbox_branch
kernel_version=v$(make kernelversion)
kernel_version=${kernel_version/\.0/}
kernel_version="$kernel_version$RT"
echo "kernelversion=$kernel_version"
yocto_staging_tag=iotg-next-${kernel_version}-linux-${datetime}
yocto_staging_branch=staging/iotg-next-linux-${datetime}
if [[ -n $RT ]]; then
yocto_staging_tag=iotg-next-${kernel_version}-preempt-rt-${datetime}
yocto_staging_branch=staging/iotg-next-rt-${datetime}
fi
git tag -a $yocto_staging_tag -m "IKT iotg-next linux kernel $kernel_version $datetime"
# Push the sandbox branch to bkc remote as the staging branch
if [ "$OPT_push" == "true" ] ; then
push_remote $rmt $yocto_sandbox_branch $yocto_staging_branch
echo -e "In repo $repo_url \nNew staging branch has been pushed: $yocto_staging_branch" > $WORKSPACE/message.txt
git push $rmt $yocto_staging_tag
test $? -eq 0 && tags="$tags ${yocto_staging_tag}:1:1"
echo -e "New staging tag has been pushed: $yocto_staging_tag \n" >> $WORKSPACE/message.txt
fi
popd
base_sandbox_branch_quilt=$BASE_SANDBOX_BRANCH_QUILT
quilt_branch=iotg-next
quilt_staging_branch=staging/${quilt_branch}-${kernel_version}-${datetime}
echo "Creating/Update quilt"
declare repo=kernel-dev-quilt
declare repo_url=${KERNEL_REPOS[$repo]}
declare rmt=origin
declare repo_dir=$WORKSPACE/${repo_url##*/}
repo_dir=${repo_dir%\.git}
git_project $repo_url $repo_dir $base_sandbox_branch_quilt || die "Unable to clone/update $repo"
pushd $repo_dir
# Checkout the sandbox branch
git checkout $base_sandbox_branch_quilt
quilt_staging_tag=iotg-next-${kernel_version}-linux-${datetime}
if [[ -n $RT ]]; then
quilt_staging_tag=iotg-next-${kernel_version}-preempt-rt-${datetime}
fi
git tag -a $quilt_staging_tag -m "IKT iotg-next kernel quilt $kernel_version $datetime"
# Push the sandbox branch to quilt remote as the staging branch
if [ "$OPT_push" == "true" ] ; then
push_remote $rmt $base_sandbox_branch_quilt $quilt_staging_branch
echo -e "In repo $repo_url \nNew staging branch has been pushed: $quilt_staging_branch" >> $WORKSPACE/message.txt
git push $rmt $quilt_staging_tag
test $? -eq 0 && tags="$tags ${quilt_staging_tag}:2:1"
echo -e "New staging tag has been pushed: $quilt_staging_tag" >> $WORKSPACE/message.txt
fi
popd
if [[ -z $RT ]]; then
cat <<EO_PROP >$WORKSPACE/new_branch.prop
YOCTO_STAGING_BRANCH=$yocto_staging_branch
STAGING_REV=$yocto_staging_tag
KERNEL_VERSION=$kernel_version
KERNEL_QUILT_TAG=$quilt_staging_tag
KSRC_UPSTREAM_TAG=$kernel_version
KERNEL=iotg-next
EO_PROP
else
cat <<EO_PROP >$WORKSPACE/new_branch.prop
YOCTO_STAGING_BRANCH=$yocto_staging_branch
STAGING_REV=$yocto_staging_tag
KERNEL_VERSION=$kernel_version
KERNEL_QUILT_TAG=$quilt_staging_tag
KSRC_UPSTREAM_TAG=$kernel_version
KERNEL=iotg-next-rt
EO_PROP
fi
if [[ -z $RT ]]; then
cat <<EO_UPROP >$WORKSPACE/overlay_ubuntu.prop
KERNEL_QUILT_TAG=${quilt_staging_tag}
KERNEL_CONFIG_TAG=iotg-next/config
OVERLAY_TARGET_BRANCH=iotg-next/${kernel_version}-ubuntu
OVERLAY_TEMPLATE_TAG=iotg-next-ubuntu
KSRC_UPSTREAM_TAG=${kernel_version}
UPLOAD_DEB_PACKAGE=true
KERNEL_CONFIG_NAME=${KERNEL_CONFIG_NAME}
EO_UPROP
else
cat <<EO_UPROP >$WORKSPACE/overlay_ubuntu.prop
KERNEL_QUILT_TAG=${quilt_staging_tag}
KERNEL_CONFIG_TAG=iotg-next/config
OVERLAY_TARGET_BRANCH=iotg-next-rt/${kernel_version}-ubuntu
OVERLAY_TEMPLATE_TAG=iotg-next-rt-ubuntu
KSRC_UPSTREAM_TAG=${kernel_version}
UPLOAD_DEB_PACKAGE=true
KERNEL_CONFIG_NAME=${KERNEL_CONFIG_NAME}
EO_UPROP
fi
#currently, IOTG-NEXT jobs has no centos overlay build
#cat <<EO_CPROP >$WORKSPACE/overlay_centos.prop
#KERNEL_QUILT_TAG=${quilt_staging_tag}
#KERNEL_CONFIG_TAG=iotg-next/config
#OVERLAY_TARGET_BRANCH=iotg-next/${kernel_version}-centos
#OVERLAY_TEMPLATE_TAG=iotg-next-centos
#KSRC_UPSTREAM_TAG=${kernel_version}
#OVERLAY_NAME=iotg-next
#UPLOAD_RPM_PACKAGE=true
#EO_CPROP
for tag in ${tags}; do
echo "EXTRA_DATA_TAG=$tag"
done
echo -e "\033[0;32m*** Success ***\033[00m"
exit 0