aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/package_kernel82
1 files changed, 73 insertions, 9 deletions
diff --git a/scripts/package_kernel b/scripts/package_kernel
index 2e12078..ded4716 100755
--- a/scripts/package_kernel
+++ b/scripts/package_kernel
@@ -64,6 +64,13 @@ fdr()
fakeroot ./debian/rules $@
}
+changelog_get()
+{
+ dpkg-parsechangelog -l$1 \
+ | grep -Po "^$2:.+" \
+ | sed -e "s/$2: //"
+}
+
must_be_set()
{
test "${!1}" || carp "$1 must be set in env"
@@ -73,7 +80,7 @@ should_be_set()
{
test "${!1}" && return 0
warn "$1 should be set \
- using default ${!2} from $2"
+ using default ${!2} from $2"
eval "export $1=${!2}"
}
@@ -234,6 +241,21 @@ sourceinfo()
done
}
+update_vcs_git()
+{
+ git_tag_publish_url="ssh://gh/jcrigby/linaro-ci-kernels.git"
+ git_ro_url=$(echo $git_tag_publish_url | sed s#ssh://gh/#git://github.com/#)
+ release_tag=$(changelog_get debian.linaro/changelog "Source")
+ release_tag+="_"
+ release_tag+=$(changelog_get debian.linaro/changelog "Version")
+ release_tag=$(echo $release_tag | sed 's/~/--/g')
+ sed -i \
+ -e "s#Vcs-Git:.*\$#Vcs-Git: $git_ro_url $release_tag#" \
+ debian.linaro/control.stub.in
+ git add debian.linaro/control.stub.in
+}
+
+
finish_changelog()
{
dch -c debian.linaro/changelog -t \
@@ -245,6 +267,7 @@ finish_changelog()
-e "s/UNRELEASED/$distribution/" \
debian.linaro/changelog
git add debian.linaro/changelog
+ update_vcs_git
git commit -s -m "LINARO: instantiate packaging template for $SOCFLAVOUR"
git clean -d -f -x
git reset --hard HEAD
@@ -257,9 +280,29 @@ create_source_pkg()
debuild --no-lintian -sa -S $keyarg -I -i -aarmhf
}
-#
-# NB from here we are running in kernel_build
-#
+publish_release_tag()
+{
+ # set up ssh for pushing to github
+ grep -q 'Host gh' ~/.ssh/config || {
+ test -e ../../default_git_publish_keyfile && {
+ cp ../../default_git_publish_keyfile ~/.ssh/ghkey
+ chmod 600 ~/.ssh/config ~/.ssh/ghkey
+ cat <<-__END__ >> ~/.ssh/config
+ Host gh
+ Hostname github.com
+ User git
+ IdentityFile ~/.ssh/ghkey
+ StrictHostKeyChecking=no
+__END__
+ }
+ }
+ chmod 600 ~/.ssh/config ~/.ssh/ghkey
+ git remote add tagpush $git_tag_publish_url
+ git tag $release_tag
+ git push tagpush $release_tag
+ exit 0
+}
+
test_build_source_pkg()
{
mkdir -p test_build
@@ -279,15 +322,30 @@ publish_source_pkg()
export scriptname=$(basename $0)
trap cleanup EXIT
-keyarg=""
+# default actions are different if running under
+# jenkins vs standalone
+
+running_standalone="true"
+running_in_jenkins="false"
+
+test "$JENKINS_URL" && {
+ do_merge="true"
+ do_create_source_pkg="true"
+ do_publish_release_tag="true"
+ do_test_build_source_pkg="true"
+ do_publish_source_pkg="true"
+ running_in_jenkins="true"
+ running_standalone="false"
+}
-do_merge="true"
-do_create_source_pkg="true"
-do_test_build_source_pkg="true"
-do_publish_source_pkg="true"
+test "$running_standalone" && {
+ do_merge="true"
+ do_create_source_pkg="true"
+}
# process command line arguments
#
+keyarg=""
while (( $# > 0 )) ; do
echo arg is $1
case $1 in
@@ -331,6 +389,12 @@ test "$do_create_source_pkg" == "true" && {
cd ../..
}
+test "$do_publish_release_tag" == "true" && {
+ cd kernel_build/linux
+ publish_release_tag
+ cd ../..
+}
+
test "$do_test_build_source_pkg" == "true" && {
cd kernel_build
test_build_source_pkg