Patchwork [1/1] UBUNTU: linux-tools -- pull out the perf binary into a binary package

login
register
mail settings
Submitter Andy Whitcroft
Date March 15, 2010, 6:45 p.m.
Message ID <1268678711-7738-1-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/47778/
State Superseded
Delegated to: Andy Whitcroft
Headers show

Comments

Andy Whitcroft - March 15, 2010, 6:45 p.m.
We are getting complex dependancies on the linux-image package as a result
of including the perf binary in the package.  This ties us to the versions
of binutils and libc on the build release, which limits the installability
of that kernel on older releases.  This is a problem for testing.

Move the binary over to a release and architecture specific binary package
linux-tools-VERSION-ABI.  Rename the current linux-tools package over to
linux-tools-common and depend the binary packages on it.  We will also
need to add a new linux-tools meta package to the linux-meta package.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian.master/control.stub.in    |   15 ++++++++--
 debian/rules.d/0-common-vars.mk  |    3 +-
 debian/rules.d/2-binary-arch.mk  |   59 +++++++++++++++++++++++++++-----------
 debian/rules.d/3-binary-indep.mk |    6 ++--
 debian/tools/perf                |    6 ++-
 5 files changed, 63 insertions(+), 26 deletions(-)
Andy Whitcroft - March 15, 2010, 7:01 p.m.
I have got a slightly reordered patch which is identical in
functionality but much easier to review.  Will send it out shortly.

-apw

Patch

diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in
index 4b507ae..afb4ae9 100644
--- a/debian.master/control.stub.in
+++ b/debian.master/control.stub.in
@@ -45,13 +45,12 @@  Description: Linux kernel specific documentation for version PKGVER
  /usr/share/doc/SRCPKGNAME-doc/00-INDEX for a list of what is
  contained in each file.
 
-Package: SRCPKGNAME-tools
+Package: SRCPKGNAME-tools-common
 Architecture: all
 Section: admin
 Priority: optional
 Depends: ${misc:Depends}
-Conflicts: SRCPKGNAME-tools-2.6
-Replaces: SRCPKGNAME-tools-2.6
+Replaces: SRCPKGNAME-tools (<= 2.6.32-16.25)
 Description: Linux kernel specific tools for version PKGVER
  This package provides the various tools in the PKGVER kernel source.
 
@@ -77,3 +76,13 @@  Description: Linux Kernel Headers for development
  are used by the installed headers for GNU glibc and other system
  libraries. They are NOT meant to be used to build third-party modules for
  your kernel. Use SRCPKGNAME-headers-* packages for that.
+
+Package: linux-tools-PKGVER-ABINUM
+Architecture: i386 amd64 lpia ia64 powerpc sparc armel
+Section: devel
+Priority: optional
+Depends: ${misc:Depends}, ${shlibs:Depends}, linux-tools-common
+Description: Linux kernel tools for version PKGVER-ABINUM
+ This package provides kernel tools for version PKGVER-ABINUM on
+ DESC.
+
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index d069cad..5e064d1 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -127,7 +127,8 @@  do_tools=false
 ifneq ($(wildcard $(CURDIR)/tools),)
 do_tools=true
 endif
-tools_pkg_name=$(src_pkg_name)-tools
+tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
+tools_common_pkg_name=$(src_pkg_name)-tools-common
 
 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
 #
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 4caf3bd..de3ea72 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -24,15 +24,8 @@  $(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(arc
 	cat $^ | sed -e 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(release)$(extraversion)"/' > $(builddir)/build-$*/.config
 	find $(builddir)/build-$* -name "*.ko" | xargs rm -f
 	$(build_cd) $(kmake) $(build_O) silentoldconfig prepare scripts
-ifeq ($(do_tools),true)
-	install -d $(builddir)/tools-$*
-	for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools-$*/; done
-	rm $(builddir)/tools-$*/tools
-	rsync -a tools/ $(builddir)/tools-$*/tools/
-endif
 	touch $@
 
-
 # Do the actual build, including image and modules
 build-%: $(stampdir)/stamp-build-%
 	@# Empty for make to be happy
@@ -41,10 +34,16 @@  $(stampdir)/stamp-build-%: prepare-%
 	@echo "Building $*..."
 	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image)
 	$(build_cd) $(kmake) $(build_O) $(conc_level) modules
+	@touch $@
+
+install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
+install-perarch: $(stampdir)/stamp-build-perarch
+	# Add the tools.
 ifeq ($(do_tools),true)
-	cd $(builddir)/tools-$*/tools/perf && make
+	install -d $(toolspkgdir)/usr/bin
+	install -s -m755 $(builddir)/tools-$*/tools/perf/perf \
+		$(toolspkgdir)/usr/bin/perf_$(abi_release)
 endif
-	@touch $@
 
 # Install the finished build
 install-%: pkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*
@@ -102,13 +101,6 @@  endif
 		$(pkgdir)/lib/modules/$(abi_release)-$*/initrd/; \
 	fi
 
-	# Add the tools.
-ifeq ($(do_tools),true)
-	install -d $(pkgdir)/usr/bin
-	install -s -m755 $(builddir)/tools-$*/tools/perf/perf \
-		$(pkgdir)/usr/bin/perf_$(abi_release)-$*
-endif
-
 	# Now the image scripts
 	install -d $(pkgdir)/DEBIAN
 	for script in postinst postrm preinst prerm; do				\
@@ -336,7 +328,40 @@  endif
 $(stampdir)/stamp-flavours:
 	@echo $(flavours) > $@
 
-binary-debs: $(stampdir)/stamp-flavours $(addprefix binary-,$(flavours))
+#
+# per-architecture packages
+#
+$(stampdir)/stamp-prepare-perarch:
+	@echo "Preparing perarch ..."
+ifeq ($(do_tools),true)
+	install -d $(builddir)/tools-$*
+	for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools-$*/; done
+	rm $(builddir)/tools-$*/tools
+	rsync -a tools/ $(builddir)/tools-$*/tools/
+endif
+	touch $@
+
+$(stampdir)/stamp-build-perarch: prepare-perarch
+ifeq ($(do_tools),true)
+	cd $(builddir)/tools-$*/tools/perf && make
+endif
+	@touch $@
+
+binary-perarch: toolspkg = $(tools_pkg_name)
+binary-perarch: install-perarch
+ifeq ($(do_tools),true)
+	dh_installchangelogs -p$(toolspkg)
+	dh_installdocs -p$(toolspkg)
+	dh_compress -p$(toolspkg)
+	dh_fixperms -p$(toolspkg)
+	dh_shlibdeps -p$(toolspkg)
+	dh_installdeb -p$(toolspkg)
+	dh_gencontrol -p$(toolspkg)
+	dh_md5sums -p$(toolspkg)
+	dh_builddeb -p$(toolspkg)
+endif
+
+binary-debs: binary-perarch $(stampdir)/stamp-flavours $(addprefix binary-,$(flavours))
 
 build-arch:  $(addprefix build-,$(flavours))
 
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index 9a99736..c670e5f 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -62,9 +62,9 @@  ifeq ($(do_source_package_content),true)
 	rm -rf $(srcdir)
 endif
 
-toolspkg = $(tools_pkg_name)
-toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
-toolsman = $(CURDIR)/debian/$(toolspkg)/usr/share/man
+install-tools: toolspkg = $(tools_common_pkg_name)
+install-tools: toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
+install-tools: toolsman = $(CURDIR)/debian/$(toolspkg)/usr/share/man
 install-tools:
 	dh_testdir
 	dh_testroot
diff --git a/debian/tools/perf b/debian/tools/perf
index cfc2f87..1a9915f 100644
--- a/debian/tools/perf
+++ b/debian/tools/perf
@@ -1,2 +1,4 @@ 
-#!/bin/sh
-exec perf_`uname -r` "$@"
+#!/bin/bash
+version=`uname -r`
+version=${version%-*}
+exec "perf_$version" "$@"