[PATCH 1/2] UBUNTU: add hooks to prepare the source tree

Andy Whitcroft apw at canonical.com
Mon Jan 19 14:46:52 UTC 2009


When we package the source for building we do it in one of two ways.
During early cycle where we have no original tarball to base from uploads
contain the entire source.  Once we base on a released kernel version
the uploadds contain a base tarball and a diff delta.  In the latter
case all of the ubuntu delta is represented as a diff and this diff
cannot carry any permission information including the executable bits.
This leads us to lose any executable status on any added scripts.

There are two solutions to this problem, two places at which we might
fix any permissions issues.  We can either fix all consumers of the
master source tree such that after installing the files they also fix
any permissions.  Or we can fix the master source tree itself before
any of the targets consumes it.  The master source tree is consumed in a
number of targets the source, docs, headers, and binary headers packages.
We could modify each of these to fix the permissions of the files that
they installed.  However each of these takes a different subset of the
source and each uses its own code incantation; each of these would need
to be manually maintained.  Therefore it seems sensible to pre-repair
the source tree.

This patch introduces a new preparation phase which performs any
required source tree repair.  This phase is added as a pre-requisite
for all installer phases allowing any source file to be modified in this
preparation phase.  We also connect this to the rule 'patch' target which
is the official manual interface for ensuring your source tree is ready
for use.  Note that this only needed when using the source from an apt-get
source download, permission are maintained in our git tree.

Signed-off-by: Andy Whitcroft <apw at canonical.com>
---
 debian/rules                     |    8 ++++++++
 debian/rules.d/2-binary-arch.mk  |    2 +-
 debian/rules.d/3-binary-indep.mk |    6 +++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/rules b/debian/rules
index f661442..4af7fca 100755
--- a/debian/rules
+++ b/debian/rules
@@ -49,6 +49,8 @@ clean: debian/control
 	# This gets rid of the d-i packages in control
 	cp -f debian/control.stub debian/control
 
+patch: prepare-master-source
+
 # Builds the image, arch headers and debug packages
 include debian/rules.d/2-binary-arch.mk
 
@@ -145,3 +147,9 @@ debian/control: debian/control.stub
 	fi
 
 	kernel-wedge gen-control > debian/control
+
+# Ensure that the master source tree is ready for building from, use this
+# to ensure executable files in our delta are still executable and the like.
+.PHONY: prepare-master-source
+prepare-master-source:
+	chmod +x scripts/test-suspend
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 800c9b0..6244a1b 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -32,7 +32,7 @@ install-%: dbgpkgdir = $(CURDIR)/debian/linux-image-debug-$(abi_release)-$*
 install-%: basepkg = linux-headers-$(abi_release)
 install-%: hdrdir = $(CURDIR)/debian/$(basepkg)-$*/usr/src/$(basepkg)-$*
 install-%: target_flavour = $*
-install-%: $(stampdir)/stamp-build-% checks-%
+install-%: $(stampdir)/stamp-build-% checks-% prepare-master-source
 	dh_testdir
 	dh_testroot
 	dh_clean -k -plinux-image-$(abi_release)-$*
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index c25f10f..7bf4e01 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -2,7 +2,7 @@ build-indep:
 
 docpkg = linux-doc-$(release)
 docdir = $(CURDIR)/debian/$(docpkg)/usr/share/doc/$(docpkg)
-install-doc:
+install-doc: prepare-master-source
 	dh_testdir
 	dh_testroot
 	dh_clean -k -p$(docpkg)
@@ -24,7 +24,7 @@ install-doc:
 
 indep_hdrpkg = linux-headers-$(abi_release)
 indep_hdrdir = $(CURDIR)/debian/$(indep_hdrpkg)/usr/src/$(indep_hdrpkg)
-install-headers:
+install-headers: prepare-master-source
 	dh_testdir
 	dh_testroot
 	dh_clean -k -p$(indep_hdrpkg)
@@ -42,7 +42,7 @@ install-headers:
 
 srcpkg = linux-source-$(release)
 srcdir = $(CURDIR)/debian/$(srcpkg)/usr/src/$(srcpkg)
-install-source:
+install-source: prepare-master-source
 	dh_testdir
 	dh_testroot
 	dh_clean -k -p$(srcpkg)
-- 
1.6.1.258.g7ff14





More information about the kernel-team mailing list