[Build-common-hackers] Bug#576967: cdbs: Splits CC into multiple env-var words

Anders Kaseorg andersk at MIT.EDU
Thu Apr 29 07:20:41 UTC 2010

reassign 576967 cdbs
tags 576967 +patch

How can you suggest that a multiword CC is “abuse” and okay to break, when 
by your own logic (bug 523642), CDBS “has a well defined current behaviour 
that users rely on”?

This change also broke one of my packages that does some cross compiling 
by setting CC = gcc -m32.  This is a perfectly legitimate use of CC; for 
example, the libc6 packaging does this to cross-compile libc6-i386 on 

But in fact, the CDBS change that introduced this regression (commit 
ee9bbf5 in version 0.4.77) doesn’t even correctly do what it was 
_intended_ to do.  The $(origin) function is supposed to be called with a 
variable name, not with the contents of a variable. 

So, can you please apply this patch, which fixes both of these bugs and 
should make everyone happy?


diff --git a/1/rules/buildvars.mk.in b/1/rules/buildvars.mk.in
index cbca47b..535ca74 100644
--- a/1/rules/buildvars.mk.in
+++ b/1/rules/buildvars.mk.in
@@ -121,10 +121,10 @@ cdbs_expand_branches = $(subst WORDDELIMITER,$3,$(subst BRANCHDELIMITER,$4,$(cal
 cdbs_findargs-path-or-name = $(if $(findstring /,$(firstword $(1))),-path './$(patsubst ./%,%,$(firstword $(1)))',-name '$(firstword $(1))') $(foreach obj,$(wordlist 2,$(words $(1)),$(1)),-or $(if $(findstring /,$(obj)),-path './$(obj:./%=%)',-name '$(obj)'))
 # Resolve VAR only if declared explicitly in makefile or environment
-cdbs_expand_nondefaultvar = $(if $(filter-out $(origin $1),default),$1)
+cdbs_expand_nondefaultvar = $(if $(filter-out $(origin $1),default),$1="$($1)")
 # Declare (shell-style) variables to itself if explicitly declared
-cdbs_set_nondefaultvars = $(foreach var,$1,$(patsubst %,$(var)="%",$(call cdbs_expand_nondefaultvar,$($(var)))))
+cdbs_set_nondefaultvars = $(foreach var,$1,$(call cdbs_expand_nondefaultvar,$(var)))
 # Return non-empty if build system is different from host system
 cdbs_crossbuild = $(if $(call cdbs_streq,$(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)),,yes)

More information about the Build-common-hackers mailing list