Wipe ${S} before unpacking sources
PATCH 1/1 Wipe ${S} before unpacking sources
It would seem reasonable that do_unpack() always results in a pristine source tree. This patch causes ${S} to be removed before unpacking sources.
I didn't quite understand what kind of "investigation" the following code comment in do_unpack() was referring to:
# TODO: Investigate if we can remove
# the entire ${S} in this case.
What kind of special cases might we have? At least qemux86 core-image-sato
builds fine for me.[YOCTO #9064]
Markus Lehtonen (1):
base.bbclass wipe ${S} before unpacking source
meta/classes/base.bbclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.6.2
PATCH 1/1 base.bbclass wipe ${S} before unpacking source
Make sure that we have a pristine source tree after do_unpack.
[YOCTO #9064]
--- meta/classes/base.bbclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
meta/classes/base.bbclass +3 -5
@@ -140,12 +140,10 @@ python base_do_unpack() { rootdir = d.getVar('WORKDIR', True) - # Ensure that we cleanup ${S}/patches - # TODO: Investigate if we can remove - # the entire ${S} in this case. + # Cleanup ${S} s_dir = d.getVar('S', True) - p_dir = os.path.join(s_dir, 'patches') - bb.utils.remove(p_dir, True) + if s_dir != rootdir and not d.getVar("EXTERNALSRC", True): + bb.utils.remove(s_dir, True) try: fetcher = bb.fetch2.Fetch(src_uri, d)
Signature · 1 line
2.6.2
Re: [PATCH] base.bbclass wipe ${S} before unpacking source
Quoted 2 lines · Markus Lehtonen
Make sure that we have a pristine source tree after
do_unpack.
Interestingly this fails on db-native rebuild for me, as db is playing games with S (it's not the top of the tarball). I had a look at the db recipe, screamed a bit, and am testing a patch to make it more idiomatic. Let's throw this at the autobuilder and see what happens...
Ross
Re: [PATCH] base.bbclass wipe ${S} before unpacking source
Quoted 4 lines · Ross
On 23 February 2016 at 11:36, Markus Lehtonen <
[email protected]> wrote:
Quoted 8 lines
Quoted 2 lines
Make sure that we have a pristine source tree after
do_unpack.Interestingly this fails on db-native rebuild for me, as db is playing games with S (it's not the top of the tarball). I had a look at the db recipe, screamed a bit, and am testing a patch to make it more idiomatic. Let's throw this at the autobuilder and see what happens...
db isn't the only recipe doing that. The fetcher unpack method knows where it's unpacking to, I think if anyone should be clearing out the destination first, it should.
Re: [PATCH] base.bbclass wipe ${S} before unpacking source
Quoted 3 lines · Christopher Larson
db isn't the only recipe doing that. The fetcher unpack method knows where it's unpacking to, I think if anyone should be clearing out the destination first, it should.
If that's true for tarballs, I agree. I was also wondering if this should just be unpack[cleandirs] = ${S}
Ross
Re: [PATCH] base.bbclass wipe ${S} before unpacking source
Quoted 8 lines · Ross
On 23 February 2016 at 18:01, Christopher Larson <[email protected]
Quoted 4 lines
wrote:
db isn't the only recipe doing that. The fetcher unpack method knows where it's unpacking to, I think if anyone should be clearing out the destination first, it should.If that's true for tarballs, I agree. I was also wondering if this should just be unpack[cleandirs] = ${S}
The problem is that the fetcher does not now the target directory, i.e. it does not examine the content of tar/zip. Implementing that logic for different archive formats would require a lot more work. Using cleandirs sounds good to me. I.e. something like:
meta/classes/base.bbclass +1 -0
@@ -133,23 +133,15 @@ python base_do_fetch() { addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" +do_unpack[cleandirs] = "${@d.getVar('S', True) if d.getVar('S', True)
!= d.getVar('WORKDIR', True) else ''}"
python base_do_unpack() {
src_uri = (d.getVar('SRC_URI', True) or "").split()
if len(src_uri) == 0:
return- rootdir = d.getVar('WORKDIR', True)
-
- # Ensure that we cleanup ${S}/patches
- # TODO: Investigate if we can remove
- # the entire ${S} in this case.
- s_dir = d.getVar('S', True)
- p_dir = os.path.join(s_dir, 'patches')
- bb.utils.remove(p_dir, True)-
try:
fetcher = bb.fetch2.Fetch(src_uri, d)
- fetcher.unpack(rootdir)
+ fetcher.unpack(d.getVar('WORKDIR', True))
except bb.fetch2.BBFetchException as e:
raise bb.build.FuncFailed(e)
}
Re: [PATCH] base.bbclass wipe ${S} before unpacking source
In reply to Markus LehtonenYou might want to assure that S is a child of WORKDIR before wiping it. Strange things would happen if someone tried setting S=$HOME in a recipe (by mistake or just for experimenting).
Quoted 8 lines · Markus Lehtonen
Make sure that we have a pristine source tree after
do_unpack.[YOCTO #9064]
Signed-off-by Markus Lehtonen <[email protected]>--- meta/classes/base.bbclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
...
Signature · 1 line
Mike Looijmans
2016-02-23 12:36 skrev Markus Lehtonen:
Quoted 1 line
It would seem reasonable
that do_unpack() always results in a pristine source
Quoted 1 line
tree. This patch
causes ${S} to be removed before unpacking sources.
Quoted 2 lines
I didn't quite
understand what kind of "investigation" the following code
Quoted 1 line
comment in
do_unpack() was referring to:
Quoted 2 lines
# TODO: Investigate if we can remove
#
the entire ${S} in this case.
Quoted 1 line
What kind of special cases might we
have? At least qemux86 core-image-sato
Quoted 1 line
builds fine for me.
The text
isn't referring to any investigation already done. But me and Paul Eggleton discussed this matter (removing entire ${S}, not just {$S}/patches) within the scope of another bug. But since this wasn't really the scope for that bug, the TODO was added instead. And happily you have done the investigation and it's seems like ${S} might be able to be removed in this case, after all :)
So please go ahead and you can
remove that TODO comment within the scope of this patch, since if this change gets merged it's not relevant anymore..
BR Petter
Quoted 1 line
[YOCTO
#9064] Markus Lehtonen (1): base.bbclass wipe ${S} before unpacking source meta/classes/base.bbclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.6.2
See inline comments.
Petter
Mabäcker
Technux <[email protected]>
www.technux.se