diff mbox

[v7,01/18] package/linux-headers: cleanup installation

Message ID 1457564339-27294-2-git-send-email-s.martin49@gmail.com
State Changes Requested
Headers show

Commit Message

Samuel Martin March 9, 2016, 10:58 p.m. UTC
This patch removes unnecessary files generated during installation, that
also are causing build machine paths leaking into the Buildroot's SDK.

Note that similar cleanup commands can be found in other distributions
(e.g. gentoo [1]); thought this is not a valid reason.

[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-kernel/linux-headers/linux-headers-4.4.ebuild#n36

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v6->v7:
- improve commit log

changes v5->v6:
- new patch
---
 package/linux-headers/linux-headers.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Yann E. MORIN March 9, 2016, 11:09 p.m. UTC | #1
Samuel, All,

On 2016-03-09 23:58 +0100, Samuel Martin spake thusly:
> This patch removes unnecessary files generated during installation, that
> also are causing build machine paths leaking into the Buildroot's SDK.
> 
> Note that similar cleanup commands can be found in other distributions
> (e.g. gentoo [1]); thought this is not a valid reason.
> 
> [1] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-kernel/linux-headers/linux-headers-4.4.ebuild#n36
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v6->v7:
> - improve commit log
> 
> changes v5->v6:
> - new patch
> ---
>  package/linux-headers/linux-headers.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk
> index 0900778..7633257 100644
> --- a/package/linux-headers/linux-headers.mk
> +++ b/package/linux-headers/linux-headers.mk
> @@ -123,6 +123,7 @@ define LINUX_HEADERS_INSTALL_STAGING_CMDS
>  			HOSTCXX="$(HOSTCXX)" \
>  			INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
>  			headers_install)
> +	find $(STAGING_DIR)/usr \( -name .install -o -name ..install.cmd \) -delete

I would further restrict that to $(STAGING_DIR)/usr/include .

Also, Gentoo also has code to get rid of empty directories:
    find $(STAGING_DIR)/usr -depth -type d -delete 2>/dev/null

Although we don't really care about empty dirs in staging, TBH...

Regards,
Yann E. MORIN.

>  endef
>  
>  ifeq ($(BR2_KERNEL_HEADERS_VERSION)$(BR2_KERNEL_HEADERS_AS_KERNEL),y)
> -- 
> 2.7.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Samuel Martin March 12, 2016, 8:46 a.m. UTC | #2
Yann, all,

On Thu, Mar 10, 2016 at 12:09 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Samuel, All,
>
> On 2016-03-09 23:58 +0100, Samuel Martin spake thusly:
>> This patch removes unnecessary files generated during installation, that
>> also are causing build machine paths leaking into the Buildroot's SDK.
>>
>> Note that similar cleanup commands can be found in other distributions
>> (e.g. gentoo [1]); thought this is not a valid reason.
>>
>> [1] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-kernel/linux-headers/linux-headers-4.4.ebuild#n36
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>>
>> ---
>> changes v6->v7:
>> - improve commit log
>>
>> changes v5->v6:
>> - new patch
>> ---
>>  package/linux-headers/linux-headers.mk | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk
>> index 0900778..7633257 100644
>> --- a/package/linux-headers/linux-headers.mk
>> +++ b/package/linux-headers/linux-headers.mk
>> @@ -123,6 +123,7 @@ define LINUX_HEADERS_INSTALL_STAGING_CMDS
>>                       HOSTCXX="$(HOSTCXX)" \
>>                       INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
>>                       headers_install)
>> +     find $(STAGING_DIR)/usr \( -name .install -o -name ..install.cmd \) -delete
>
> I would further restrict that to $(STAGING_DIR)/usr/include . not
Well, I just reuse what is set for INSTALL_HDR_PATH, making any
assumption on what the package's install rules do.

>
> Also, Gentoo also has code to get rid of empty directories:
>     find $(STAGING_DIR)/usr -depth -type d -delete 2>/dev/null
In the Gentoo case, this is run on the package content, whereas in BR,
this would remove all empty directories in the shared sysroot.
So, why doing it for this package and not for the others?
Also, if we want to do this, it would be in the global infra, not here ;-)

>
> Although we don't really care about empty dirs in staging, TBH...
Indeed.

Regards,
Yann E. MORIN March 22, 2016, 10:10 p.m. UTC | #3
Samuel, All,

On 2016-03-12 09:46 +0100, Samuel Martin spake thusly:
> On Thu, Mar 10, 2016 at 12:09 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On 2016-03-09 23:58 +0100, Samuel Martin spake thusly:
> >> This patch removes unnecessary files generated during installation, that
> >> also are causing build machine paths leaking into the Buildroot's SDK.
> >>
> >> Note that similar cleanup commands can be found in other distributions
> >> (e.g. gentoo [1]); thought this is not a valid reason.
> >>
> >> [1] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-kernel/linux-headers/linux-headers-4.4.ebuild#n36
> >>
> >> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> >>
> >> ---
> >> changes v6->v7:
> >> - improve commit log
> >>
> >> changes v5->v6:
> >> - new patch
> >> ---
> >>  package/linux-headers/linux-headers.mk | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk
> >> index 0900778..7633257 100644
> >> --- a/package/linux-headers/linux-headers.mk
> >> +++ b/package/linux-headers/linux-headers.mk
> >> @@ -123,6 +123,7 @@ define LINUX_HEADERS_INSTALL_STAGING_CMDS
> >>                       HOSTCXX="$(HOSTCXX)" \
> >>                       INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
> >>                       headers_install)
> >> +     find $(STAGING_DIR)/usr \( -name .install -o -name ..install.cmd \) -delete
> >
> > I would further restrict that to $(STAGING_DIR)/usr/include . not
> Well, I just reuse what is set for INSTALL_HDR_PATH, making any
> assumption on what the package's install rules do.

Well, this is only installing headers, so in $(STAGING_DIR)/usr/include.

> > Also, Gentoo also has code to get rid of empty directories:
> >     find $(STAGING_DIR)/usr -depth -type d -delete 2>/dev/null
> In the Gentoo case, this is run on the package content, whereas in BR,
> this would remove all empty directories in the shared sysroot.
> So, why doing it for this package and not for the others?
> Also, if we want to do this, it would be in the global infra, not here ;-)
> 
> >
> > Although we don't really care about empty dirs in staging, TBH...
> Indeed.

Yep, I was just pointing this out, since you referenced Gentoo. ;-)

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk
index 0900778..7633257 100644
--- a/package/linux-headers/linux-headers.mk
+++ b/package/linux-headers/linux-headers.mk
@@ -123,6 +123,7 @@  define LINUX_HEADERS_INSTALL_STAGING_CMDS
 			HOSTCXX="$(HOSTCXX)" \
 			INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
 			headers_install)
+	find $(STAGING_DIR)/usr \( -name .install -o -name ..install.cmd \) -delete
 endef
 
 ifeq ($(BR2_KERNEL_HEADERS_VERSION)$(BR2_KERNEL_HEADERS_AS_KERNEL),y)