Skip to contentSkip to conversation

base: improve do_unpack[cleandirs] logic

PATCH In review Ross Burton 2 participants 4 messages Apr 25, 2018 – Apr 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base: improve do_unpack[cleandirs] logic

If a recipe sets S to ${WORKDIR}/ then the S != WORKDIR test doesn't work as expected. Use os.path.samefile() instead of string comparisons to do the right thing.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +1 -1
index bb1f4b75336..7ddf70414a1 100644
@@ -152,7 +152,7 @@ python base_do_fetch() {
 addtask unpack after do_fetch
 do_unpack[dirs] = "${WORKDIR}"
 
-do_unpack[cleandirs] = "${@d.getVar('S') if d.getVar('S') != d.getVar('WORKDIR') else os.path.join('${S}', 'patches')}"
+do_unpack[cleandirs] = "${@os.path.join('${S}', 'patches') if os.path.samefile(d.getVar('S'), d.getVar('WORKDIR')) else d.getVar('S')}"
 
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
Signature · 1 line
2.11.0
#1 lore raw

Retracting this, doesn't work on a clean build dir.

Ross

Quoted 25 lines · Ross Burton

If a recipe sets S to ${WORKDIR}/ then the S != WORKDIR test doesn't work as expected. Use os.path.samefile() instead of string comparisons to do the right thing.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +1 -2
index bb1f4b75336..7ddf70414a1 100644
@@ -152,7 +152,7 @@ python base_do_fetch() {
 addtask unpack after do_fetch
 do_unpack[dirs] = "${WORKDIR}"
 
-do_unpack[cleandirs] = "${@d.getVar('S') if d.getVar('S') != d.getVar('WORKDIR') else os.path.join('${S}', 'patches')}"
+do_unpack[cleandirs] = "${@os.path.join('${S}', 'patches') if os.path.samefile(d.getVar('S'), d.getVar('WORKDIR')) else d.getVar('S')}"
 
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
--

2.11.0

#2 lore raw
Quoted 32 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Burton, Ross
Sent: den 26 april 2018 12:46
To: OE-core <[email protected]>
Subject: Re: [OE-core] [PATCH] base: improve do_unpack[cleandirs] logic

Retracting this, doesn't work on a clean build dir.

Ross

Quoted 1 line · Ross Burton

If a recipe sets S to ${WORKDIR}/ then the S != WORKDIR test doesn't

work as

Quoted 1 line

expected. Use os.path.samefile() instead of string comparisons to do

the right

Quoted 15 lines

thing.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +0 -0
index bb1f4b75336..7ddf70414a1 100644
@@ -152,7 +152,7 @@ python base_do_fetch() {
 addtask unpack after do_fetch
 do_unpack[dirs] = "${WORKDIR}"
 
Quoted 1 line

meta/classes/base.bbclass python base_do_fetch() { · line 155

Quoted 1 line
meta/classes/base.bbclass +0 -1
-do_unpack[cleandirs] = "${@d.getVar('S') if d.getVar('S') != d.getVar('WORKDIR') else os.path.join('${S}', 'patches')}"

This should work even if the paths don't exist:

do_unpack[cleandirs] = "${@d.getVar('S') if os.path.realpath(d.getVar('S')) != os.path.realpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"

Quoted 6 lines
Quoted 6 lines
meta/classes/base.bbclass +1 -1
+do_unpack[cleandirs] = "${@os.path.join('${S}', 'patches') if os.path.samefile(d.getVar('S'), d.getVar('WORKDIR')) else d.getVar('S')}"
 
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
--

2.11.0

//Peter

#3 lore raw

I thought I sent a V2 using normpath() which works a lot better. Looks like I forgot...

Quoted 47 lines · Peter Kjellerstedt
Quoted 32 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Burton, Ross
Sent: den 26 april 2018 12:46
To: OE-core <[email protected]>
Subject: Re: [OE-core] [PATCH] base: improve do_unpack[cleandirs] logic

Retracting this, doesn't work on a clean build dir.

Ross

Quoted 1 line · Ross Burton

If a recipe sets S to ${WORKDIR}/ then the S != WORKDIR test doesn't

work as

Quoted 1 line

expected. Use os.path.samefile() instead of string comparisons to do

the right

Quoted 15 lines

thing.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +0 -0
index bb1f4b75336..7ddf70414a1 100644
@@ -152,7 +152,7 @@ python base_do_fetch() {
 addtask unpack after do_fetch
 do_unpack[dirs] = "${WORKDIR}"
 
Quoted 1 line

meta/classes/base.bbclass python base_do_fetch() { · line 155

Quoted 1 line
meta/classes/base.bbclass +0 -1
-do_unpack[cleandirs] = "${@d.getVar('S') if d.getVar('S') != d.getVar('WORKDIR') else os.path.join('${S}', 'patches')}"

This should work even if the paths don't exist:

do_unpack[cleandirs] = "${@d.getVar('S') if os.path.realpath(d.getVar('S')) != os.path.realpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"

Quoted 6 lines
Quoted 6 lines
meta/classes/base.bbclass +1 -1
+do_unpack[cleandirs] = "${@os.path.join('${S}', 'patches') if os.path.samefile(d.getVar('S'), d.getVar('WORKDIR')) else d.getVar('S')}"
 
 python base_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
--

2.11.0

//Peter