blob: 13fd1b07938a9492eea98954915818f58ae17e3a (
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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
#!/bin/bash
set -x
set -e
shopt -s extglob
# add directory containing this script to PATH
#
export PATH="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )":$PATH
# exit with error message and bad exit status
#
carp()
{
echo $1
exit -1
}
# warn about something but do not exit
#
warn()
{
echo "WARNING: $1"
true
}
# exit with message and good exit status
#
infoexit()
{
echo -e $1
exit 0
}
# echo message if being verbose
#
verbose_info()
{
test "$verbose" && echo $1
true
}
cleanup()
{
echo nothing to do
}
usage()
{
echo hmmm
}
pvar()
{
verbose_info "$1 = ${!1}"
}
fdr()
{
fakeroot ./debian/rules $@
}
must_be_set()
{
test "${!1}" || carp "$1 must be set in env"
}
should_be_set()
{
test "${!1}" || warn "$1 should be set "\
"using default ${!2} from $2"
}
check_settings()
{
must_be_set "kernel_repo"
must_be_set "kernel_branch"
must_be_set "linaro_ubuntu_packaging_repo"
must_be_set "linaro_ubuntu_packaging_branch"
must_be_set "ubuntu_and_base_config_repo"
must_be_set "ubuntu_and_base_config_branch"
must_be_set "distribution"
must_be_set "SOCFLAVOUR"
must_be_set "SOCVENDOR"
must_be_set "SOCFAMILY"
must_be_set "SAMPLEBOARDS"
should_be_set "board_config_repo" "kernel_repo"
should_be_set "board_config_branch" "kernel_branch"
: ${linaro_base_config_frag:="linaro/configs/linaro-base.conf"}
: ${ubuntu_config_frag:="linaro/configs/ubuntu.conf"}
: ${board_config_frag:="linaro/configs/$(echo $SOCFLAVOUR | sed s/lt-//).conf"}
: ${third_version_digit:=0}
}
setup_kernel_git()
{
test -d kernel_build || {
mkdir -p kernel_build
git clone -b $kernel_branch $nearby_git kernel_build
}
cd kernel_build
for r in $(git remote)
do
git remote rm $r
done
kernel_desc="Kernel"
git remote add -t $kernel_branch \
kernel_remote \
$kernel_repo
linaro_ubuntu_packaging_desc="Packaging template"
git remote add -t $linaro_ubuntu_packaging_branch \
linaro_ubuntu_packaging_remote \
$linaro_ubuntu_packaging_repo
board_config_desc="Board config fragment"
git remote add -t $board_config_branch \
board_config_remote \
$board_config_repo
ubuntu_and_base_config_desc="Ubuntu and Linaro Base config fragments"
git remote add -t $ubuntu_and_base_config_branch \
ubuntu_and_base_config_remote \
$ubuntu_and_base_config_repo
git remote update
git checkout -f working_branch ||
git checkout -b working_branch \
remotes/kernel_remote/$kernel_branch
git reset --hard remotes/kernel_remote/$kernel_branch
git clean -d -f -x
test -d debian && git rm -r debian
test -d debian.linaro && git rm -r debian.linaro
git checkout remotes/linaro_ubuntu_packaging_remote/$linaro_ubuntu_packaging_branch \
-- \
debian \
debian.linaro
git checkout remotes/board_config_remote/$board_config_branch \
-- \
$board_config_frag
git checkout remotes/ubuntu_and_base_config_remote/$ubuntu_and_base_config_branch \
-- \
$linaro_base_config_frag \
$ubuntu_config_frag
git commit -s -m "added packaging template and linaro/configs"
}
fixup_socflavour_contents()
{
for f in $(grep -r -l SOCFLAVOUR debian.linaro/) debian/rules.d/0-common-vars.mk
do
sed -i -e "s/SOCFLAVOUR/$SOCFLAVOUR/g" $f
git add -f $f
done
}
fixup_socflavour_filenames()
{
for f in $(find debian.linaro/ -type f -name '*SOCFLAVOUR*')
do
nf=$(echo $f | sed "s/SOCFLAVOUR/$SOCFLAVOUR/")
git mv $f $nf
done
}
fixup_vars_file()
{
f=debian.linaro/control.d/vars.linaro-$SOCFLAVOUR
sed -i \
-e "s/SOCFLAVOUR/$SOCFLAVOUR/g" \
-e "s/SOCVENDOR/$SOCVENDOR/g" \
-e "s/SOCFAMILY/$SOCFAMILY/g" \
-e "s/SAMPLEBOARDS/$SAMPLEBOARDS/g" \
$f
git add $f
}
add_config()
{
: ${linaroconfigsboardflavour:=$(echo $SOCFLAVOUR | sed s/lt-//)}
ARCH=arm ./scripts/kconfig/merge_config.sh \
$linaro_base_config_frag \
$ubuntu_config_frag \
$board_config_frag
cp .config debian.linaro/config/armel/config.flavour.linaro-$SOCFLAVOUR
cp .config debian.linaro/config/armhf/config.flavour.linaro-$SOCFLAVOUR
fdr clean
fdr defaultconfigs
git add debian.linaro/config
}
sourceinfo()
{
for r in \
kernel \
board_config \
ubuntu_and_base_config \
linaro_ubuntu_packaging
do
desc=${r}_desc
repo=${r}_repo
branch=${r}_branch
remote=${r}_remote
echo
echo "${!desc}:"
echo "Repo: ${!repo}:"
echo "Branch: ${!branch}:"
case $r in
board_config)
echo "Config frag:"
echo " $board_config_frag"
;;
ubuntu_and_base_config)
echo "Config frags:"
echo " $linaro_base_config_frag"
echo " $ubuntu_config_frag"
;;
esac
echo "Head:"
git log -1 "${!remote}/${!branch}" | sed 's/^/ /'
done | sed 's/^/ /'
}
finish()
{
dch -c debian.linaro/changelog -t \
"Packaged version of $SOCFLAVOUR kernel created from:==BODY=="
perl -i -pe "s#==BODY==#$(sourceinfo)#" \
debian.linaro/changelog
sed -i \
-e "1 s/)/~$(date --utc +%y%m%d%H%M%S))/" \
-e "s/UNRELEASED/$distribution/" \
debian.linaro/changelog
git add debian.linaro/changelog
git commit -s -m "LINARO: instantiate packaging template for $SOCFLAVOUR"
git clean -d -f -x
git reset --hard HEAD
true
}
export scriptname=$(basename $0)
trap cleanup EXIT
# process command line arguments
#
while (( $# > 0 )) ; do
echo arg is $1
case $1 in
-h|--help|-?)
usage
;;
--config)
echo "sourcing $2"
source $2
shift
;;
+([[:alpha:]_])*([[:word:]])=+([[:word:]:/]))
eval "export $1"
;;
esac
shift
done
check_settings
setup_kernel_git
fixup_socflavour_contents
fixup_socflavour_filenames
fixup_vars_file
add_config
finish
exit 0
|