Skip to contentSkip to conversation

Interaction between SITE_METHOD=LOCAL and .patch files

Buildroot Grant Edwards 4 participants 7 messages Feb 6, 2017 – Feb 8, 2017

lore
Share & tools
lore
#0 lore raw

I've been chasing a bug in a package for a couple days, and have been baffled because the executable failed with segfault when it was built from a local package.tar.gz file located in thepackage directory (where the package.mk file is). However, if I unpack package.tar.gz and then set the SITE_METHOD to LOCAL, the executable works fine.

After comparing build trees that worked with build trees that failed, I finallythat setting SITE_METHOD = LOCAL prevents the application of the .patch files present in the package directory.

I don't find this behavior documented anywhere. The description of SITE_METHOD only says it affects how the sources are fetched. It doesn't say anything about it controlling whether or not patches are applied. Is it interaction intentional, or is it a bug?

[FWIW, the package in question is the most recent version of the ipkg package, and the 0001-fix-musl-build.patch is what breaks it. Since that package has already been removed, I won't bother to file a bug report.]

Signature · 3 lines
Grant Edwards               grant.b.edwards        Yow! Are we wet yet?
                                  at               
                              gmail.com            
#1 lore raw
Quoted 9 lines · Grant Edwards

I've been chasing a bug in a package for a couple days, and have been baffled because the executable failed with segfault when it was built from a local package.tar.gz file located in thepackage directory (where the package.mk file is). However, if I unpack package.tar.gz and then set the SITE_METHOD to LOCAL, the executable works fine.

After comparing build trees that worked with build trees that failed, I finallythat setting SITE_METHOD = LOCAL prevents the application of the .patch files present in the package directory.

It does. The technical reason for that is that SITE_METHOD = local is
implemented using _OVERRIDE_SRCDIR, and for that we don't want to apply patches because the typical use case is to build some different version to which the patches wouldn't apply anyway.

Also, when you set SITE_METHOD = local, there should be no reason to apply
patches because you can just as well apply them in your custom tarball.

Quoted 4 lines

I don't find this behavior documented anywhere. The description of SITE_METHOD only says it affects how the sources are fetched. It doesn't say anything about it controlling whether or not patches are applied. Is it interaction intentional, or is it a bug?

Indeed, it should be documented. Care to send a patch?

Regards,
Arnout

Quoted 6 lines

[FWIW, the package in question is the most recent version of the ipkg package, and the 0001-fix-musl-build.patch is what breaks it. Since that package has already been removed, I won't bother to file a bug report.]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw
Quoted 4 lines · Arnout Vandecappelle
Quoted 3 lines

After comparing build trees that worked with build trees that failed, I finallythat setting SITE_METHOD = LOCAL prevents the application of the .patch files present in the package directory.

Quoted 8 lines

It does. The technical reason for that is that SITE_METHOD = local is implemented using _OVERRIDE_SRCDIR, and for that we don't want to apply patches because the typical use case is to build some different version to which the patches wouldn't apply anyway.

Also, when you set SITE_METHOD = local, there should be no reason to apply patches because you can just as well apply them in your custom tarball.

Can SITE_METHOD = local be used with a custom tarball? My understanding from the docs is that it requires an unpacked source directory tree [in which, as you said, one can easily apply whatever patches are required].

I agree that for the unpacked source directory tree use case, not appying patches makes the most sense.

Quoted 1 line

Indeed, it should be documented. Care to send a patch?

Will do.

Signature · 4 lines
Grant Edwards               grant.b.edwards        Yow! Somewhere in Tenafly,
                                  at               New Jersey, a chiropractor
                              gmail.com            is viewing "Leave it to
                                                   Beaver"!
#3 lore raw
Quoted 11 lines · Grant Edwards
Quoted 7 lines · Arnout Vandecappelle
Quoted 3 lines

After comparing build trees that worked with build trees that failed, I finallythat setting SITE_METHOD = LOCAL prevents the application of the .patch files present in the package directory.

It does.

Indeed, it should be documented. Care to send a patch?

Will do.

Is it just the .patch files found in the package directory that are skipped in the [FOO_SITE_METHOD = local] case? Or are all patches skipped (also skipping those specified by FOO_PATCH and BR2_GLOBAL_PATCH_DIR)?

Signature · 4 lines
Grant Edwards               grant.b.edwards        Yow! Alright, you!!
                                  at               Imitate a WOUNDED SEAL
                              gmail.com            pleading for a PARKING
                                                   SPACE!!
#4 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Grant" == Grant Edwards <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Indeed, it should be documented. Care to send a patch?

Will do.

Is it just the .patch files found in the package directory that are skipped in the [FOO_SITE_METHOD = local] case? Or are all patches skipped (also skipping those specified by FOO_PATCH and BR2_GLOBAL_PATCH_DIR)?

All patches, it skips directly to to the configure step.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw
In reply to Grant Edwards

Hello,

Quoted 1 line · Grant Edwards

Can SITE_METHOD = local be used with a custom tarball?

No. Arnout got it wrong here. You've got the following choices:

<pkg>_SITE_METHOD = local
<pkg>_SITE = /path/to/directory

*OR*

<pkg>_SITE_METHOD = file
<pkg>_SITE = /path/to/local/tarball.tar.gz

So the "local" site method points to a directory, and patches are *NOT* applied. The "file" site method points to a local tarball, and patches *ARE* applied.

Quoted 3 lines

My understanding from the docs is that it requires an unpacked source directory tree [in which, as you said, one can easily apply whatever patches are required].

Your understanding is correct.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#5 lore raw
In reply to Peter Korsgaard

Hello,

Quoted 6 lines · Peter Korsgaard
Quoted 4 lines

Is it just the .patch files found in the package directory that are skipped in the [FOO_SITE_METHOD = local] case? Or are all patches skipped (also skipping those specified by FOO_PATCH and BR2_GLOBAL_PATCH_DIR)?

All patches, it skips directly to to the configure step.

Just to clarify things:

* For all site methods (except local/OVERRIDE_SRCDIR), the steps through which a package go are:

source -> extract -> patch -> configure -> build -> install

* For the local site method and OVERRIDE_SRCDIR, the steps through which a package go are:

rsync -> configure -> build -> install

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com