aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Rigby <john.rigby@linaro.org>2011-06-02 12:44:57 -0600
committerJohn Rigby <john.rigby@linaro.org>2011-09-23 08:59:50 -0600
commit2cb019ab98462c104d5e54316a2cae3ec08d4ce8 (patch)
tree2a54c858b990321caf685ec23ab414f9c6bd5eca
parentc070180dd819f76b9d1f99e9caa4f8856e322b94 (diff)
LINARO: add flavour splitting script and changes to use it
Signed-off-by: John Rigby <john.rigby@linaro.org>
-rw-r--r--debian.linaro/control.d/flavour-control.stub2
-rw-r--r--debian.linaro/control.stub.in2
-rw-r--r--debian.linaro/rules.d/vars.mk1
-rwxr-xr-xdebian.linaro/scripts/mkflavourbranches123
-rwxr-xr-xdebian/rules6
-rw-r--r--debian/rules.d/0-common-vars.mk9
-rw-r--r--debian/rules.d/1-maintainer.mk1
7 files changed, 137 insertions, 7 deletions
diff --git a/debian.linaro/control.d/flavour-control.stub b/debian.linaro/control.d/flavour-control.stub
index 5ea910a5080..2a97b120d37 100644
--- a/debian.linaro/control.d/flavour-control.stub
+++ b/debian.linaro/control.d/flavour-control.stub
@@ -30,7 +30,7 @@ Pre-Depends: dpkg (>= 1.10.24)
Depends: ${misc:Depends}, ${shlibs:Depends}, initramfs-tools (>= 0.36ubuntu6), coreutils | fileutils (>= 4.0), module-init-tools (>= 3.3-pre11-4ubuntu3), wireless-crda
Conflicts: hotplug (<< 0.0.20040105-1)
Recommends: BOOTLOADER
-Suggests: fdutils, SRCPKGNAME-doc-PKGVER | SRCPKGNAME-source-PKGVER, SRCPKGNAME-tools
+Suggests: fdutils, SRCPKGNAME-doc-PKGVER | SRCPKGNAME-source-PKGVER, COMMONSRCPKGNAME-tools
Description: Linux kernel image for version PKGVER on DESC
This package contains the Linux kernel image for version PKGVER on
DESC.
diff --git a/debian.linaro/control.stub.in b/debian.linaro/control.stub.in
index ce74e04e5fd..47a2caf707f 100644
--- a/debian.linaro/control.stub.in
+++ b/debian.linaro/control.stub.in
@@ -19,7 +19,7 @@ Description: Header files related to Linux kernel version PKGVER
that want the latest kernel headers. Please read
/usr/share/doc/SRCPKGNAME-headers-PKGVER-ABINUM/debian.README.gz for details
-Package: SRCPKGNAME-tools-PKGVER-ABINUM
+Package: COMMONSRCPKGNAME-tools-PKGVER-ABINUM
Architecture: armel
Section: devel
Priority: optional
diff --git a/debian.linaro/rules.d/vars.mk b/debian.linaro/rules.d/vars.mk
new file mode 100644
index 00000000000..37044bc3075
--- /dev/null
+++ b/debian.linaro/rules.d/vars.mk
@@ -0,0 +1 @@
+common_src_pkg_name = linux-linaro
diff --git a/debian.linaro/scripts/mkflavourbranches b/debian.linaro/scripts/mkflavourbranches
new file mode 100755
index 00000000000..1469aa57d33
--- /dev/null
+++ b/debian.linaro/scripts/mkflavourbranches
@@ -0,0 +1,123 @@
+#!/bin/bash
+#set -x
+#set -e
+
+DEBIAN=debian.linaro
+source_pkg_name=$(dpkg-parsechangelog -l${DEBIAN}/changelog|grep Source|sed 's/^.*Source: //')
+source_pkg_version=$(dpkg-parsechangelog -l${DEBIAN}/changelog|grep Version|sed 's/^.*Version: //')
+common_flavour_prefix=linaro
+
+
+function fail {
+ echo $1
+ exit -1
+}
+
+function checkclean {
+ status=$(git status -s)
+ test -z "$status" || fail "Only run this script in a clean repo"
+}
+
+function setup_working_branch {
+ hoser=$(git branch -a | grep " $1$")
+ test -z "$hoser" || fail "$1 already exists"
+ git checkout -b $1
+}
+
+function cleanup {
+ git reset --hard HEAD
+ git clean -d -f -x
+}
+
+flavours=(${DEBIAN}/control.d/vars.*)
+flavours=(${flavours[*]##*vars.${common_flavour_prefix}-})
+firstflavour=${flavours[0]}
+
+function do_flavour_branches {
+ for flavour in ${flavours[*]}; do
+ echo flavour is $flavour
+ otherflavours=(${flavours[*]##$flavour})
+ echo otherflavours are ${otherflavours[*]}
+
+ single_flavour_branch=${working_branch}-$flavour-only
+ git branch -f $single_flavour_branch HEAD
+ git checkout $single_flavour_branch
+
+ sed -i -e "s/^${source_pkg_name}/${source_pkg_name}-$flavour/" ${DEBIAN}/changelog
+ git add ${DEBIAN}/changelog
+
+ for otherflavour in ${otherflavours[*]}; do
+ git rm ${DEBIAN}/config/armel/config.flavour.${common_flavour_prefix}-$otherflavour
+ git rm ${DEBIAN}/control.d/vars.${common_flavour_prefix}-$otherflavour
+ sed -i -e "/${common_flavour_prefix}-$otherflavour/d" ${DEBIAN}/d-i/kernel-versions.in
+ git add ${DEBIAN}/d-i/kernel-versions.in
+ sed -i -e "s/${common_flavour_prefix}-$otherflavour//" ${DEBIAN}/rules.d/armel.mk
+ if [ "$flavour" = "$firstflavour" ]; then
+ # for first flavour only make the common header and tools deb
+ sed -i -e "s/do_common_headers_indep.*=.*/do_common_headers_indep = false/" ${DEBIAN}/rules.d/armel.mk
+ sed -i -e "s/do_tools.*=.*/do_tools = true/" ${DEBIAN}/rules.d/armel.mk
+ else
+ sed -i -e "s/do_common_headers_indep.*=.*/do_common_headers_indep = true/" ${DEBIAN}/rules.d/armel.mk
+ sed -i -e "s/do_tools.*=.*/do_tools = false/" ${DEBIAN}/rules.d/armel.mk
+ fi
+ git add ${DEBIAN}/rules.d/armel.mk
+ done
+
+ git status
+ fakeroot ./debian/rules clean
+ fakeroot ./debian/rules updateconfigs
+ cat >> debian.linaro/config/armel/config.flavour.${common_flavour_prefix}-$flavour << END
+#
+# Single flavour kernel packages have no flavour dependent config options
+# look in ../config.common.ubuntu for full config
+#
+END
+ cat >> debian.linaro/config/armel/config.common.armel << END
+#
+# Single flavour kernel packages have no arch dependent config options
+# look in ../config.common.ubuntu for full config
+#
+END
+ git commit -s -m "LINARO: Cleanup configs after removing other flavours" debian.linaro/config
+ git commit -s -m "LINARO: Linaro-${source_pkg_version} $flavour only"
+ tagname="Linaro-${source_pkg_version}-${flavour}-only"
+ git tag -f -s -m "$tagname" $tagname HEAD
+
+ git push $remote_push -f HEAD:$flavour-only
+ git push $remote_push -f $tagname
+
+ git reset --hard HEAD
+ git checkout $working_branch
+
+ cleanup
+ done
+}
+
+test $# -eq 1 || fail "must provide a pushable remote"
+
+working_branch="tbranch$(dd 2>/dev/null if=/dev/urandom bs=10 count=1 | od -X | awk '{ print $2 }')"
+echo Using $working_branch as working branch name
+
+remote_push=$1
+
+
+orig_branch=$(git symbolic-ref HEAD 2>/dev/null)
+orig_branch=${orig_branch##refs/heads/}
+
+checkclean
+
+setup_working_branch $working_branch
+
+git push $remote_push -f $working_branch:master
+tagname="Linaro-${source_pkg_version}"
+git tag -f -s -m "$tagname" $tagname HEAD
+git push $remote_push -f $tagname
+
+do_flavour_branches
+
+git checkout $orig_branch
+git branch -D $working_branch
+
+
+cleanup
+
diff --git a/debian/rules b/debian/rules
index 92ec033af3e..0d87e2ccd93 100755
--- a/debian/rules
+++ b/debian/rules
@@ -91,16 +91,18 @@ $(DEBIAN)/control.stub: $(DEBIAN)/d-i/kernel-versions.in \
new=`echo $$i | sed 's/\.in$$//'`; \
cat $$i | sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
+ -e 's/COMMONSRCPKGNAME/$(common_src_pkg_name)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
> $$new; \
done
flavours="$(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars)";\
for i in $$flavours; do \
- $(SHELL) $(DROOT)/scripts/control-create $$i | \
+ $(SHELL) $(DROOT)/scripts/control-create $$i | \
sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
+ -e 's/COMMONSRCPKGNAME/$(common_src_pkg_name)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
- >> $(DEBIAN)/control.stub; \
+ >> $(DEBIAN)/control.stub; \
done
cp $(DEBIAN)/control.stub $(DEBIAN)/control
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index 0194db594a1..23ff1bfe0ea 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -2,6 +2,9 @@
# The source package name will be the first token from $(DEBIAN)/changelog
#
src_pkg_name=$(shell sed -n '1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN)/changelog)
+# Allow for overriding common_src_pkg_name when we have perflavour source packages
+-include $(DEBIAN)/rules.d/vars.mk
+common_src_pkg_name?=src_pkg_name
# Get some version info
series := oneiric
@@ -142,7 +145,7 @@ do_doc_package_content=true
ifeq ($(full_build),false)
do_doc_package_content=false
endif
-doc_pkg_name=$(src_pkg_name)-doc
+doc_pkg_name=$(common_src_pkg_name)-doc
#
# Similarly with the linux-source package, you need not build it as a developer. Its
@@ -169,8 +172,8 @@ do_tools?=true
else
do_tools?=false
endif
-tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
-tools_common_pkg_name=$(src_pkg_name)-tools-common
+tools_pkg_name=$(common_src_pkg_name)-tools-$(abi_release)
+tools_common_pkg_name=$(common_src_pkg_name)-tools-common
# The general flavour specific image package.
do_flavour_image_package=true
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 6ed6c147618..2ecac0b7c51 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -52,6 +52,7 @@ updateportsconfigs defaultportsconfigs editportsconfigs genportsconfigs askconfi
printenv:
dh_testdir
@echo "src package name = $(src_pkg_name)"
+ @echo "src package name no flavour = $(common_src_pkg_name)"
@echo "release = $(release)"
@echo "revisions = $(revisions)"
@echo "revision = $(revision)"