Patchwork [2/2] UBUNTU: cleanup conditional dependancy handling

login
register
mail settings
Submitter Andy Whitcroft
Date Aug. 5, 2010, 11:02 a.m.
Message ID <1281006172-29467-3-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/60948/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Andy Whitcroft - Aug. 5, 2010, 11:02 a.m.
BugLink: http://bugs.launchpad.net/bugs/603087

We commonly use conditional elements to limit building to specific
sub-systems.  Move to a new model wherein the variables are used directly
in the assignment so that enabled things are placed on foo-true and
disabled things go to foo-false.  Overall simplifying the code.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules.d/2-binary-arch.mk  |   23 +++++++----------------
 debian/rules.d/3-binary-indep.mk |   19 +++++--------------
 2 files changed, 12 insertions(+), 30 deletions(-)
Stefan Bader - Aug. 5, 2010, 2:31 p.m.
Looks more readable to me. Though being very similar to the kernel make magic
probably helps.

On 08/05/2010 01:02 PM, Andy Whitcroft wrote:
> BugLink: http://bugs.launchpad.net/bugs/603087
> 
> We commonly use conditional elements to limit building to specific
> sub-systems.  Move to a new model wherein the variables are used directly
> in the assignment so that enabled things are placed on foo-true and
> disabled things go to foo-false.  Overall simplifying the code.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  debian/rules.d/2-binary-arch.mk  |   23 +++++++----------------
>  debian/rules.d/3-binary-indep.mk |   19 +++++--------------
>  2 files changed, 12 insertions(+), 30 deletions(-)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 6a07d3c..6777b5e 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -377,24 +377,15 @@ endif
>  
>  binary-debs: binary-perarch $(stampdir)/stamp-flavours $(addprefix binary-,$(flavours))
>  
> -build-arch-deps =
> -ifeq ($(do_flavour_image_package),true)
> -build-arch-deps += $(addprefix build-,$(flavours))
> -endif
> -build-arch: $(build-arch-deps)
> +build-arch-deps-$(do_flavour_image_package) += $(addprefix build-,$(flavours))
> +build-arch: $(build-arch-deps-true)
>  
> -ifeq ($(do_flavour_image_package),true)
> -binary-arch-deps = binary-debs
> +binary-arch-deps-$(do_flavour_image_package) = binary-debs
>  ifeq ($(AUTOBUILD),)
> -binary-arch-deps += binary-udebs
> -endif
> -endif
> -ifeq ($(do_libc_dev_package),true)
> -binary-arch-deps += binary-arch-headers
> +binary-arch-deps-$(do_flavour_image_package) += binary-udebs
>  endif
> +binary-arch-deps-$(do_libc_dev_package) += binary-arch-headers
>  ifneq ($(do_common_headers_indep),true)
> -ifeq ($(do_flavour_header_package),true)
> -binary-arch-deps += binary-headers
> -endif
> +binary-arch-deps-$(do_flavour_header_package) += binary-headers
>  endif
> -binary-arch: $(binary-arch-deps)
> +binary-arch: $(binary-arch-deps-true)
> diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
> index c4ac483..793e1e9 100644
> --- a/debian/rules.d/3-binary-indep.mk
> +++ b/debian/rules.d/3-binary-indep.mk
> @@ -95,22 +95,13 @@ install-tools:
>  	install -m644 $(builddir)/tools/tools/perf/Documentation/*.1 \
>  		$(toolsman)/man1
>  
> -install-indep-deps =
>  ifeq ($(do_common_headers_indep),true)
> -ifeq ($(do_flavour_header_package),true)
> -install-indep-deps += install-headers
> +install-indep-deps-$(do_flavour_header_package) += install-headers
>  endif
> -endif
> -ifeq ($(do_doc_package),true)
> -install-indep-deps += install-doc
> -endif
> -ifeq ($(do_source_package),true)
> -install-indep-deps += install-source
> -endif
> -ifeq ($(do_tools),true)
> -install-indep-deps += install-tools
> -endif
> -install-indep: $(install-indep-deps)
> +install-indep-deps-$(do_doc_package) += install-doc
> +install-indep-deps-$(do_source_package) += install-source
> +install-indep-deps-$(do_tools) += install-tools
> +install-indep: $(install-indep-deps-true)
>  
>  # This is just to make it easy to call manually. Normally done in
>  # binary-indep target during builds.

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 6a07d3c..6777b5e 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -377,24 +377,15 @@  endif
 
 binary-debs: binary-perarch $(stampdir)/stamp-flavours $(addprefix binary-,$(flavours))
 
-build-arch-deps =
-ifeq ($(do_flavour_image_package),true)
-build-arch-deps += $(addprefix build-,$(flavours))
-endif
-build-arch: $(build-arch-deps)
+build-arch-deps-$(do_flavour_image_package) += $(addprefix build-,$(flavours))
+build-arch: $(build-arch-deps-true)
 
-ifeq ($(do_flavour_image_package),true)
-binary-arch-deps = binary-debs
+binary-arch-deps-$(do_flavour_image_package) = binary-debs
 ifeq ($(AUTOBUILD),)
-binary-arch-deps += binary-udebs
-endif
-endif
-ifeq ($(do_libc_dev_package),true)
-binary-arch-deps += binary-arch-headers
+binary-arch-deps-$(do_flavour_image_package) += binary-udebs
 endif
+binary-arch-deps-$(do_libc_dev_package) += binary-arch-headers
 ifneq ($(do_common_headers_indep),true)
-ifeq ($(do_flavour_header_package),true)
-binary-arch-deps += binary-headers
-endif
+binary-arch-deps-$(do_flavour_header_package) += binary-headers
 endif
-binary-arch: $(binary-arch-deps)
+binary-arch: $(binary-arch-deps-true)
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index c4ac483..793e1e9 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -95,22 +95,13 @@  install-tools:
 	install -m644 $(builddir)/tools/tools/perf/Documentation/*.1 \
 		$(toolsman)/man1
 
-install-indep-deps =
 ifeq ($(do_common_headers_indep),true)
-ifeq ($(do_flavour_header_package),true)
-install-indep-deps += install-headers
+install-indep-deps-$(do_flavour_header_package) += install-headers
 endif
-endif
-ifeq ($(do_doc_package),true)
-install-indep-deps += install-doc
-endif
-ifeq ($(do_source_package),true)
-install-indep-deps += install-source
-endif
-ifeq ($(do_tools),true)
-install-indep-deps += install-tools
-endif
-install-indep: $(install-indep-deps)
+install-indep-deps-$(do_doc_package) += install-doc
+install-indep-deps-$(do_source_package) += install-source
+install-indep-deps-$(do_tools) += install-tools
+install-indep: $(install-indep-deps-true)
 
 # This is just to make it easy to call manually. Normally done in
 # binary-indep target during builds.