Skip to contentSkip to conversation

buildconf: compare abspath

PATCH In review Adrian Freihofer 3 participants 3 messages Oct 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildconf: compare abspath

We have something like ${TOPDIR}/../../poky/meta in the bblayers.conf file. This does not work without normalizing the path for comparison.

---
 meta/lib/bblayers/buildconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/bblayers/buildconf.py +1 -1
index e07fc534e1..ccab332adf 100644
@@ -64,7 +64,7 @@ TEMPLATECONF={} . {}/oe-init-build-env build-try-{}"""
         oecore = None
 
         for l in layers:
-            if l[0] == os.path.abspath(args.layerpath):
+            if os.path.abspath(l[0]) == os.path.abspath(args.layerpath):
                 targetlayer = l[0]
             if l[1] == 'meta':
                 oecore = os.path.dirname(l[0])
Signature · 1 line
2.37.3
#1 lore raw

Hi Adrian,

Adrian Freihofer <[email protected]> escreveu no dia sexta, 14/10/2022 à(s) 07:53:

Quoted 14 lines

We have something like ${TOPDIR}/../../poky/meta in the bblayers.conf file. This does not work without normalizing the path for comparison.

---
 meta/lib/bblayers/buildconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/bblayers/buildconf.py +0 -0
index e07fc534e1..ccab332adf 100644

meta/lib/bblayers/buildconf.py TEMPLATECONF={} . {}/oe-init-build-env build-try-{}""" · line 69

Quoted 7 lines
meta/lib/bblayers/buildconf.py +1 -1
@@ -64,7 +64,7 @@ TEMPLATECONF={} . {}/oe-init-build-env build-try-{}"""
         oecore = None
 
         for l in layers:
-            if l[0] == os.path.abspath(args.layerpath):
+            if os.path.abspath(l[0]) == os.path.abspath(args.layerpath):
                 targetlayer = l[0]
 

Maybe can be better to have the abspath of layerpath in targetlayer

layerpath = os.path.abspath(args.layerpath)
if os.path.abspath(l[0]) == layerpath:
targetlayer = layerpath

Jose

             if l[1] == 'meta':
Quoted 16 lines
meta/lib/bblayers/buildconf.py +0 -1
                 oecore = os.path.dirname(l[0])
--

2.37.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#171725):
https://lists.openembedded.org/g/openembedded-core/message/171725
Mute This Topic: https://lists.openembedded.org/mt/94321973/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma
#2 lore raw
Quoted 11 lines · Jose Quaresma

meta/lib/bblayers/buildconf.py TEMPLATECONF={} . {}/oe-init-build-env build-try-{}""" · line 68

Quoted 4 lines

for l in layers:

meta/lib/bblayers/buildconf.py +1 -1
-            if l[0] == os.path.abspath(args.layerpath):
+            if os.path.abspath(l[0]) == os.path.abspath(args.layerpath):
                 targetlayer = l[0]

Maybe can be better to have the abspath of layerpath in targetlayer

layerpath = os.path.abspath(args.layerpath)
if os.path.abspath(l[0]) == layerpath:
targetlayer = layerpath

I prefer Adrian's version. 'layerpath' is not a good name, and targetlayer does not need to be absolute. If you'd like to refactor this, doing this with a boolean variable 'has_targetlayer' would be better.

Alex