diff mbox

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

Message ID 1268679720-8107-1-git-send-email-apw@canonical.com
State Accepted
Delegated to: Andy Whitcroft
Headers show

Commit Message

Andy Whitcroft March 15, 2010, 7:02 p.m. UTC
[Updated patch, same contents better ordering in 2-*.mk which vastly improves
the reviewability.]

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  |   61 ++++++++++++++++++++++++++-----------
 debian/rules.d/3-binary-indep.mk |    6 ++--
 debian/tools/perf                |    6 ++-
 5 files changed, 64 insertions(+), 27 deletions(-)

Comments

Tim Gardner March 16, 2010, 5:26 p.m. UTC | #1
On 03/15/2010 01:02 PM, Andy Whitcroft wrote:
> [Updated patch, same contents better ordering in 2-*.mk which vastly improves
> the reviewability.]
>
> 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>
> ---

Perhaps you could update the description of linux-tools-common to note 
that the package contains the architecture independent part of 
linux-tools. Similarly for linux-tools, i.e., arch dependent.

Acked-by: Tim Gardner <tim.gardner@canonical.com>

rtg
Stefan Bader March 16, 2010, 7:02 p.m. UTC | #2
Andy Whitcroft wrote:
> [Updated patch, same contents better ordering in 2-*.mk which vastly improves
> the reviewability.]
> 
> 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>
Acked-by: Stefan Bader <stefan bader@canonical.com>
> ---
>  debian.master/control.stub.in    |   15 +++++++--
>  debian/rules.d/0-common-vars.mk  |    3 +-
>  debian/rules.d/2-binary-arch.mk  |   61 ++++++++++++++++++++++++++-----------
>  debian/rules.d/3-binary-indep.mk |    6 ++--
>  debian/tools/perf                |    6 ++-
>  5 files changed, 64 insertions(+), 27 deletions(-)
> 
> 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..fea4a11 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,9 +34,6 @@ $(stampdir)/stamp-build-%: prepare-%
>  	@echo "Building $*..."
>  	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image)
>  	$(build_cd) $(kmake) $(build_O) $(conc_level) modules
> -ifeq ($(do_tools),true)
> -	cd $(builddir)/tools-$*/tools/perf && make
> -endif
>  	@touch $@
>  
>  # Install the finished build
> @@ -102,13 +92,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 +319,49 @@ 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 $@
> +
> +install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
> +install-perarch: $(stampdir)/stamp-build-perarch
> +	# Add the tools.
> +ifeq ($(do_tools),true)
> +	install -d $(toolspkgdir)/usr/bin
> +	install -s -m755 $(builddir)/tools-$*/tools/perf/perf \
> +		$(toolspkgdir)/usr/bin/perf_$(abi_release)
> +endif
> +
> +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" "$@"
Andy Whitcroft March 17, 2010, 10:16 a.m. UTC | #3
Modified the descriptions of the linux-tools-common and linux-tools
packages to better describe the contents, including that they are
architecture/non-architecture specific as appropriate.

Applied to Lucid.

-apw
diff mbox

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..fea4a11 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,9 +34,6 @@  $(stampdir)/stamp-build-%: prepare-%
 	@echo "Building $*..."
 	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image)
 	$(build_cd) $(kmake) $(build_O) $(conc_level) modules
-ifeq ($(do_tools),true)
-	cd $(builddir)/tools-$*/tools/perf && make
-endif
 	@touch $@
 
 # Install the finished build
@@ -102,13 +92,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 +319,49 @@  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 $@
+
+install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
+install-perarch: $(stampdir)/stamp-build-perarch
+	# Add the tools.
+ifeq ($(do_tools),true)
+	install -d $(toolspkgdir)/usr/bin
+	install -s -m755 $(builddir)/tools-$*/tools/perf/perf \
+		$(toolspkgdir)/usr/bin/perf_$(abi_release)
+endif
+
+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" "$@"