Skip to contentSkip to conversation

buildcfg: Print bitbake branch and revision when it is in a separate repo

PATCH In review [email protected] 2 participants 5 messages Sep 4, 2024 – Sep 11, 2024

lore
Share & tools
lore
#0 lore raw

cover buildcfg: Print bitbake branch and revision when it is in a separate repo

From: Robert Yang <[email protected]>

The following changes since commit 94ff1be36a1eeef7ddceb4fcf20425a03cd052de:

devtool: remove obsolete SRCTREECOVEREDTASKS handling (2024-09-04 12:36:43 +0100)

are available in the Git repository at:

https://github.com/robertlinux/yocto rbt/buildcfg
https://github.com/robertlinux/yocto/tree/rbt/buildcfg

Robert Yang (1):
buildcfg: Print bitbake branch and revision when it is in a separate
repo

 meta/lib/oe/buildcfg.py | 6 ++++++
 1 file changed, 6 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 buildcfg: Print bitbake branch and revision when it is in a separate repo

From: Robert Yang <[email protected]>

Clone https://git.openembedded.org/bitbake into poky/bitbake Before the patch:
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

Now:
bitbake = "master:5bd0c65c217394cde4c8e382eba6cf7f4b909c97"
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

---
 meta/lib/oe/buildcfg.py | 6 ++++++
 1 file changed, 6 insertions(+)
meta/lib/oe/buildcfg.py +6 -0
index 4b22f18f36..5e2de15127 100644
@@ -73,6 +73,12 @@ def is_layer_modified(path):
 
 def get_layer_revisions(d):
     layers = (d.getVar("BBLAYERS") or "").split()
+    # bitbake may in a separate git repo
+    bitbake_dir = bb.__file__.rsplit('/', 3)[0]
+    bitbake_git_dir = os.path.join(bitbake_dir, '.git')
+    if os.path.exists(bitbake_git_dir):
+        layers.insert(0, bitbake_dir)
+
     revisions = []
     for i in layers:
         revisions.append((i, os.path.basename(i), get_metadata_git_branch(i).strip(), get_metadata_git_revision(i), is_layer_modified(i)))
Signature · 1 line
2.25.1
#2 lore raw

I don't think putting this into get_layer_revisions() is correct. Bitbake is not a layer, and obtaining its revision should be in a separate pair of functions:

is_bitbake_in_separate_repo()
get_bitbake_revision()

Alex

Quoted 49 lines · Robert Yang via lists.openembedded.org

From: Robert Yang <[email protected]>

Clone https://git.openembedded.org/bitbake into poky/bitbake Before the patch:
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

Now:
bitbake = "master:5bd0c65c217394cde4c8e382eba6cf7f4b909c97"
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

---
 meta/lib/oe/buildcfg.py | 6 ++++++
 1 file changed, 6 insertions(+)
meta/lib/oe/buildcfg.py +6 -1
index 4b22f18f36..5e2de15127 100644
@@ -73,6 +73,12 @@ def is_layer_modified(path):
 
 def get_layer_revisions(d):
     layers = (d.getVar("BBLAYERS") or "").split()
+    # bitbake may in a separate git repo
+    bitbake_dir = bb.__file__.rsplit('/', 3)[0]
+    bitbake_git_dir = os.path.join(bitbake_dir, '.git')
+    if os.path.exists(bitbake_git_dir):
+        layers.insert(0, bitbake_dir)
+
     revisions = []
     for i in layers:
         revisions.append((i, os.path.basename(i), get_metadata_git_branch(i).strip(), get_metadata_git_revision(i), is_layer_modified(i)))
--

2.25.1

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

#3 lore raw
Quoted 6 lines · Alexander Kanavin

I don't think putting this into get_layer_revisions() is correct. Bitbake is not a layer, and obtaining its revision should be in a separate pair of functions:

is_bitbake_in_separate_repo()
get_bitbake_revision()

Makes sense, I will send a V2 for it.

// Robert

Quoted 54 lines

Alex

Quoted 49 lines · Robert Yang via lists.openembedded.org

From: Robert Yang <[email protected]>

Clone https://git.openembedded.org/bitbake into poky/bitbake Before the patch:
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

Now:
bitbake = "master:5bd0c65c217394cde4c8e382eba6cf7f4b909c97"
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

---
  meta/lib/oe/buildcfg.py | 6 ++++++
  1 file changed, 6 insertions(+)
meta/lib/oe/buildcfg.py +6 -1
index 4b22f18f36..5e2de15127 100644
@@ -73,6 +73,12 @@ def is_layer_modified(path):
 
  def get_layer_revisions(d):
      layers = (d.getVar("BBLAYERS") or "").split()
+    # bitbake may in a separate git repo
+    bitbake_dir = bb.__file__.rsplit('/', 3)[0]
+    bitbake_git_dir = os.path.join(bitbake_dir, '.git')
+    if os.path.exists(bitbake_git_dir):
+        layers.insert(0, bitbake_dir)
+
      revisions = []
      for i in layers:
          revisions.append((i, os.path.basename(i), get_metadata_git_branch(i).strip(), get_metadata_git_revision(i), is_layer_modified(i)))
--

2.25.1

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

#4 lore raw
In reply to Alexander Kanavin

Hi Alexander,

Quoted 3 lines · Alexander Kanavin

I don't think putting this into get_layer_revisions() is correct. Bitbake is not a layer, and obtaining its revision should be in a separate pair of functions:

After more thoughts, I think always print bitbake branch and revision is better, this is can make the output consistent whenever bitbake is in a separate repo or not.

I've sent a V2 for it.

// Robert

Quoted 57 lines

is_bitbake_in_separate_repo()
get_bitbake_revision()

Alex

Quoted 49 lines · Robert Yang via lists.openembedded.org

From: Robert Yang <[email protected]>

Clone https://git.openembedded.org/bitbake into poky/bitbake Before the patch:
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

Now:
bitbake = "master:5bd0c65c217394cde4c8e382eba6cf7f4b909c97"
meta
meta-poky
meta-yocto-bsp = "master:377fd06d86f5f3be80a927ee19c30d9557077a7f"

---
  meta/lib/oe/buildcfg.py | 6 ++++++
  1 file changed, 6 insertions(+)
meta/lib/oe/buildcfg.py +6 -1
index 4b22f18f36..5e2de15127 100644
@@ -73,6 +73,12 @@ def is_layer_modified(path):
 
  def get_layer_revisions(d):
      layers = (d.getVar("BBLAYERS") or "").split()
+    # bitbake may in a separate git repo
+    bitbake_dir = bb.__file__.rsplit('/', 3)[0]
+    bitbake_git_dir = os.path.join(bitbake_dir, '.git')
+    if os.path.exists(bitbake_git_dir):
+        layers.insert(0, bitbake_dir)
+
      revisions = []
      for i in layers:
          revisions.append((i, os.path.basename(i), get_metadata_git_branch(i).strip(), get_metadata_git_revision(i), is_layer_modified(i)))
--

2.25.1

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