linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: fix header installation under fakechroot environment
@ 2017-06-15  8:36 Richard Genoud
  2017-06-16  2:20 ` Masahiro Yamada
  2017-06-22  1:17 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Genoud @ 2017-06-15  8:36 UTC (permalink / raw)
  To: Masahiro Yamada, Nicolas Dichtel
  Cc: Daniel Vetter, Russell King, Mark Salter, Michael Ellerman,
	linux-kbuild, linux-kernel, Richard Genoud

Since commit fcc8487d477a ("uapi: export all headers under uapi
directories") fakechroot make bindeb-pkg fails, mismatching files for
directories:
touch: cannot touch 'usr/include/video/uvesafb.h/.install': Not a
directory

This due to a bug in fakechroot:
when using the function $(wildcard $(srcdir)/*/.) in a makefile, under a
fakechroot environment, not only directories but also files are
returned.

To circumvent that, we are using the functions:
$(sort $(dir $(wildcard $(srcdir)/*/))))

And thanks to Yamada Masahiro who figured out the right
filter-out/patsubst order !

Fixes: fcc8487d477a ("uapi: export all headers under uapi directories")
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 scripts/Makefile.headersinst | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index ce753a408c56..c583a1e1bd3c 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,15 @@ __headers:
 include scripts/Kbuild.include
 
 srcdir        := $(srctree)/$(obj)
-subdirs       := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
+
+# When make is run under a fakechroot environment, the function
+# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular
+# files. So, we are using a combination of sort/dir/wildcard which works
+# with fakechroot.
+subdirs       := $(patsubst $(srcdir)/%/,%,\
+		 $(filter-out $(srcdir)/,\
+		 $(sort $(dir $(wildcard $(srcdir)/*/)))))
+
 # caller may set destination dir (when installing to asm/)
 _dst          := $(if $(dst),$(dst),$(obj))
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: fix header installation under fakechroot environment
  2017-06-15  8:36 [PATCH] kbuild: fix header installation under fakechroot environment Richard Genoud
@ 2017-06-16  2:20 ` Masahiro Yamada
  2017-06-22  1:17 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-06-16  2:20 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Nicolas Dichtel, Daniel Vetter, Russell King, Mark Salter,
	Michael Ellerman, Linux Kbuild mailing list,
	Linux Kernel Mailing List

Hi Richard,


2017-06-15 17:36 GMT+09:00 Richard Genoud <richard.genoud@gmail.com>:
> Since commit fcc8487d477a ("uapi: export all headers under uapi
> directories") fakechroot make bindeb-pkg fails, mismatching files for
> directories:
> touch: cannot touch 'usr/include/video/uvesafb.h/.install': Not a
> directory
>
> This due to a bug in fakechroot:
> when using the function $(wildcard $(srcdir)/*/.) in a makefile, under a
> fakechroot environment, not only directories but also files are
> returned.
>
> To circumvent that, we are using the functions:
> $(sort $(dir $(wildcard $(srcdir)/*/))))
>
> And thanks to Yamada Masahiro who figured out the right
> filter-out/patsubst order !

Sorry if I confused you.

The order of filter-out/patsubst was not a real problem,
but just a matter of taste.

Your original code used $(filter-out ./, ...),
but this could not filter out anything.  This is the root cause.

I will remove this paragraph because it is even confusing.

Thanks for the credit, but it is regular review process,
so it is not mandatory in git-log.  :-)


I will pick up this patch shortly anyway.




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: fix header installation under fakechroot environment
  2017-06-15  8:36 [PATCH] kbuild: fix header installation under fakechroot environment Richard Genoud
  2017-06-16  2:20 ` Masahiro Yamada
@ 2017-06-22  1:17 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-06-22  1:17 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Nicolas Dichtel, Daniel Vetter, Russell King, Mark Salter,
	Michael Ellerman, Linux Kbuild mailing list,
	Linux Kernel Mailing List

2017-06-15 17:36 GMT+09:00 Richard Genoud <richard.genoud@gmail.com>:
> Since commit fcc8487d477a ("uapi: export all headers under uapi
> directories") fakechroot make bindeb-pkg fails, mismatching files for
> directories:
> touch: cannot touch 'usr/include/video/uvesafb.h/.install': Not a
> directory
>
> This due to a bug in fakechroot:
> when using the function $(wildcard $(srcdir)/*/.) in a makefile, under a
> fakechroot environment, not only directories but also files are
> returned.
>
> To circumvent that, we are using the functions:
> $(sort $(dir $(wildcard $(srcdir)/*/))))
>
> And thanks to Yamada Masahiro who figured out the right
> filter-out/patsubst order !
>
> Fixes: fcc8487d477a ("uapi: export all headers under uapi directories")
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---

Applied to linux-kbuild/fixes.  Thanks!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-22  1:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  8:36 [PATCH] kbuild: fix header installation under fakechroot environment Richard Genoud
2017-06-16  2:20 ` Masahiro Yamada
2017-06-22  1:17 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).