Skip to contentSkip to conversation

devtool: Compare abspath of both B and S

PATCH In review Ola x Nilsson 2 participants 2 messages May 30, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtool: Compare abspath of both B and S

Either both or none of the paths must be passed through os.path.abspath or things like 'A//B', 'A/./B/', and 'A/B/' in S will cause unintentional mismatches even when B = "${S}".

Using os.path.abspath for both seems more likely to be correct as that will also handle the case where ${B} != ${S} but the abspaths are equal.

---
 scripts/lib/devtool/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/__init__.py +1 -1
index d646b0cf63..29c4c05071 100644
@@ -191,7 +191,7 @@ def use_external_build(same_dir, no_same_dir, d):
         logger.info('Using source tree as build directory since --same-dir specified')
     elif bb.data.inherits_class('autotools-brokensep', d):
         logger.info('Using source tree as build directory since recipe inherits autotools-brokensep')
-    elif d.getVar('B') == os.path.abspath(d.getVar('S')):
+    elif os.path.abspath(d.getVar('B')) == os.path.abspath(d.getVar('S')):
         logger.info('Using source tree as build directory since that would be the default for this recipe')
     else:
         b_is_s = False
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw

scripts/lib/devtool/

Quoted 14 lines · NZST Ola x Nilsson

Either both or none of the paths must be passed through os.path.abspath or things like 'A//B', 'A/./B/', and 'A/B/' in S will cause unintentional mismatches even when B = "${S}".

Using os.path.abspath for both seems more likely to be correct as that will also handle the case where ${B} != ${S} but the abspaths are equal.

---
 scripts/lib/devtool/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/ renamed from scripts/lib/devtool/__init__.py +0 -0

__init__.py

scripts/lib/devtool/__init__.py def use_external_build(same_dir, no_same_dir, d): · line 191

Quoted 5 lines

index d646b0cf63..29c4c05071 100644

scripts/lib/devtool/__init__.py +0 -0
@@ -191,7 +191,7 @@ def use_external_build(same_dir, no_same_dir, d):
         logger.info('Using source tree as build directory since --same-dir 

specified')

scripts/lib/devtool/__init__.py def use_external_build(same_dir, no_same_dir, d): · line 193

Quoted 2 lines
scripts/lib/devtool/__init__.py +0 -0
     elif bb.data.inherits_class('autotools-brokensep', d):
         logger.info('Using source tree as build directory since recipe 

inherits autotools-brokensep')

scripts/lib/devtool/__init__.py def use_external_build(same_dir, no_same_dir, d):

Quoted 3 lines
scripts/lib/devtool/__init__.py +1 -1
-    elif d.getVar('B') == os.path.abspath(d.getVar('S')):
+    elif os.path.abspath(d.getVar('B')) == os.path.abspath(d.getVar('S')):
         logger.info('Using source tree as build directory since that would 

be the default for this recipe')

scripts/lib/devtool/__init__.py def use_external_build(same_dir, no_same_dir, d): · line 197

Quoted 3 lines
scripts/lib/devtool/__init__.py +0 -0
     else:
         b_is_s = False

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre