Message ID | 1416244750-24256-2-git-send-email-guido@vanguardiasur.com.ar |
---|---|
State | Superseded |
Headers | show |
On 17/11/14 18:19, Guido Martínez wrote: > Some packages and BR itself create files and directories on the target > with cp/mkdir/etc which depend on the umask at the time of building. > > To fix this, use a trick inside the Makefile which wraps all rules when > the umask is not 0022. This sets the umask at the top level, and then > the building process continues as usual. > > Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> > --- > Makefile | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/Makefile b/Makefile > index 471edf9..5ad8235 100644 > --- a/Makefile > +++ b/Makefile > @@ -24,6 +24,19 @@ > # You shouldn't need to mess with anything beyond this point... > #-------------------------------------------------------------- > > +# Trick for always running with a fixed umask > +UMASK=0022 > +ifneq ($(shell umask),$(UMASK)) > +.PHONY:* What is this * supposed to do? It will expand to all existing files and directories in the buildroot directory... Don't you mean: .PHONY: all $(MAKECMDGOALS) ? Otherwise, looks good. BTW wouldn't it be nice to add the umask setting to the generated Makefile in the $(O) directory, to avoid another level of make? Regards, Arnout > + > +all: > + @umask $(UMASK) && make --no-print-directory > + > +%: > + @umask $(UMASK) && make --no-print-directory $@ > + > +else # umask > + > # This is our default rule, so must come first > all: > > @@ -932,3 +945,5 @@ include docs/manual/manual.mk > -include $(BR2_EXTERNAL)/docs/*/*.mk > > .PHONY: $(noconfig_targets) > + > +endif #umask >
Guido, All, On 2014-11-17 14:19 -0300, Guido Martínez spake thusly: > Some packages and BR itself create files and directories on the target > with cp/mkdir/etc which depend on the umask at the time of building. > > To fix this, use a trick inside the Makefile which wraps all rules when > the umask is not 0022. This sets the umask at the top level, and then > the building process continues as usual. > > Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> > --- > Makefile | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/Makefile b/Makefile > index 471edf9..5ad8235 100644 > --- a/Makefile > +++ b/Makefile > @@ -24,6 +24,19 @@ > # You shouldn't need to mess with anything beyond this point... > #-------------------------------------------------------------- > > +# Trick for always running with a fixed umask > +UMASK=0022 > +ifneq ($(shell umask),$(UMASK)) > +.PHONY:* > + > +all: > + @umask $(UMASK) && make --no-print-directory You should use $(MAKE) instead of just 'make'. I'm not too fond of --no-print-directory, because it is gonna be inherited by all sub-makes, and especially the sub-makes that actually build the packages. I don't care we have an extra "Entering directory" message. Also, did you check how that plays with top-level parallel builds? I'm not too fond of it, but some users want to use it. See the comment a bit further in the Makefile. > + > +%: > + @umask $(UMASK) && make --no-print-directory $@ Ditto. Regards, Yann E. MORIN. > +else # umask > + > # This is our default rule, so must come first > all: > > @@ -932,3 +945,5 @@ include docs/manual/manual.mk > -include $(BR2_EXTERNAL)/docs/*/*.mk > > .PHONY: $(noconfig_targets) > + > +endif #umask > -- > 2.1.3 >
On 17/11/14 22:36, Yann E. MORIN wrote: > Guido, All, > > On 2014-11-17 14:19 -0300, Guido Martínez spake thusly: >> Some packages and BR itself create files and directories on the target >> with cp/mkdir/etc which depend on the umask at the time of building. >> >> To fix this, use a trick inside the Makefile which wraps all rules when >> the umask is not 0022. This sets the umask at the top level, and then >> the building process continues as usual. >> >> Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> >> --- >> Makefile | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> >> diff --git a/Makefile b/Makefile >> index 471edf9..5ad8235 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -24,6 +24,19 @@ >> # You shouldn't need to mess with anything beyond this point... >> #-------------------------------------------------------------- >> >> +# Trick for always running with a fixed umask >> +UMASK=0022 >> +ifneq ($(shell umask),$(UMASK)) >> +.PHONY:* >> + >> +all: >> + @umask $(UMASK) && make --no-print-directory > > You should use $(MAKE) instead of just 'make'. > > I'm not too fond of --no-print-directory, because it is gonna be > inherited by all sub-makes, and especially the sub-makes that actually > build the packages. I don't care we have an extra "Entering directory" > message. Note that the generated Makefile in $(O) does add --no-print-directory... Regards, Arnout > > Also, did you check how that plays with top-level parallel builds? I'm > not too fond of it, but some users want to use it. See the comment a bit > further in the Makefile. > >> + >> +%: >> + @umask $(UMASK) && make --no-print-directory $@ > > Ditto. > > Regards, > Yann E. MORIN. > >> +else # umask >> + >> # This is our default rule, so must come first >> all: >> >> @@ -932,3 +945,5 @@ include docs/manual/manual.mk >> -include $(BR2_EXTERNAL)/docs/*/*.mk >> >> .PHONY: $(noconfig_targets) >> + >> +endif #umask >> -- >> 2.1.3 >> >
Arnout, All, On 2014-11-17 22:41 +0100, Arnout Vandecappelle spake thusly: > On 17/11/14 22:36, Yann E. MORIN wrote: > > On 2014-11-17 14:19 -0300, Guido Martínez spake thusly: [--SNIP--] > >> +all: > >> + @umask $(UMASK) && make --no-print-directory [--SNIP--] > > I'm not too fond of --no-print-directory, because it is gonna be > > inherited by all sub-makes, and especially the sub-makes that actually > > build the packages. I don't care we have an extra "Entering directory" > > message. > > Note that the generated Makefile in $(O) does add --no-print-directory... And guess who added that generated file? # git blame support/scripts/mkmakefile [...] aefad531 scripts/mkmakefile (Yann E. MORIN 2010-09-26 10:56:12 +0200 31) MAKEFLAGS += --no-print-directory [...] Ok, Ok. :-) Regards, Yann E. MORIN.
diff --git a/Makefile b/Makefile index 471edf9..5ad8235 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,19 @@ # You shouldn't need to mess with anything beyond this point... #-------------------------------------------------------------- +# Trick for always running with a fixed umask +UMASK=0022 +ifneq ($(shell umask),$(UMASK)) +.PHONY:* + +all: + @umask $(UMASK) && make --no-print-directory + +%: + @umask $(UMASK) && make --no-print-directory $@ + +else # umask + # This is our default rule, so must come first all: @@ -932,3 +945,5 @@ include docs/manual/manual.mk -include $(BR2_EXTERNAL)/docs/*/*.mk .PHONY: $(noconfig_targets) + +endif #umask
Some packages and BR itself create files and directories on the target with cp/mkdir/etc which depend on the umask at the time of building. To fix this, use a trick inside the Makefile which wraps all rules when the umask is not 0022. This sets the umask at the top level, and then the building process continues as usual. Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)