From: Alexander Kanavin <alex.kanavin@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: paul@pbarker.dev, Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 3/4] bitbake-setup: use separate functions for git-specific operations
Date: Thu, 11 Dec 2025 15:25:31 +0100 [thread overview]
Message-ID: <20251211142532.983960-3-alex.kanavin@gmail.com> (raw)
In-Reply-To: <20251211142532.983960-1-alex.kanavin@gmail.com>
From: Alexander Kanavin <alex@linutronix.de>
This prepares the code for adding different type of sources than git remotes:
- put git-specific operations into their own functions (no behavior changes)
- call them only if a git-remote entry actually exists in the configuration;
do not assume it is always there.
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
bin/bitbake-setup | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 8d4e9769a..1f83b1b2a 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -90,16 +90,7 @@ def _write_layer_list(dest, repodirs):
json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4)
def checkout_layers(layers, layerdir, d):
- layers_fixed_revisions = copy.deepcopy(layers)
- repodirs = []
- oesetupbuild = None
- print("Fetching layer/tool repositories into {}".format(layerdir))
- for r_name in layers:
- r_data = layers[r_name]
- repodir = r_data.get("path", r_name)
- repodirs.append(repodir)
-
- r_remote = r_data['git-remote']
+ def _checkout_git_remote(r_remote, repodir, layers_fixed_revisions):
rev = r_remote['rev']
branch = r_remote.get('branch', None)
remotes = r_remote['remotes']
@@ -118,6 +109,19 @@ def checkout_layers(layers, layerdir, d):
revision = urldata.revision
layers_fixed_revisions[r_name]['git-remote']['rev'] = revision
+ layers_fixed_revisions = copy.deepcopy(layers)
+ repodirs = []
+ oesetupbuild = None
+ print("Fetching layer/tool repositories into {}".format(layerdir))
+ for r_name in layers:
+ r_data = layers[r_name]
+ repodir = r_data.get("path", r_name)
+ repodirs.append(repodir)
+
+ r_remote = r_data.get('git-remote')
+ if r_remote:
+ _checkout_git_remote(r_remote, repodir, layers_fixed_revisions)
+
if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')):
oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build')
oeinitbuildenvdir = os.path.join(layerdir, repodir)
@@ -563,12 +567,8 @@ def get_diff(file1, file2):
return None
def are_layers_changed(layers, layerdir, d):
- changed = False
- for r_name in layers:
- r_data = layers[r_name]
- repodir = r_data.get("path", r_name)
-
- r_remote = r_data['git-remote']
+ def _is_git_remote_changed(r_remote, repodir):
+ changed = False
rev = r_remote['rev']
branch = r_remote.get('branch', None)
remotes = r_remote['remotes']
@@ -586,6 +586,16 @@ def are_layers_changed(layers, layerdir, d):
if upstream_revision != local_revision:
changed = True
print('Layer repository {} checked out into {} updated revision {} from {} to {}'.format(remotes[remote]["uri"], os.path.join(layerdir, repodir), rev, local_revision, upstream_revision))
+ return changed
+
+ changed = False
+ for r_name in layers:
+ r_data = layers[r_name]
+ repodir = r_data.get("path", r_name)
+
+ git_remote = r_data.get('git-remote', repodir)
+ if git_remote:
+ changed = changed | _is_git_remote_changed(git_remote, repodir)
return changed
--
2.47.3
next prev parent reply other threads:[~2025-12-11 14:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 14:25 [PATCH 1/4] setup-schema/layers.schema.json: correct indentation Alexander Kanavin
2025-12-11 14:25 ` [PATCH 2/4] bitbake-setup: override complete source entries, not just the git-remote properties Alexander Kanavin
2025-12-12 11:31 ` Paul Barker
2025-12-11 14:25 ` Alexander Kanavin [this message]
2025-12-12 11:35 ` [PATCH 3/4] bitbake-setup: use separate functions for git-specific operations Paul Barker
2025-12-11 14:25 ` [PATCH 4/4] bitbake-setup: implement symlinking local sources into builds Alexander Kanavin
2025-12-12 8:11 ` [bitbake-devel] " Antonin Godard
2025-12-12 15:27 ` Alexander Kanavin
2025-12-12 11:27 ` Paul Barker
2025-12-12 15:19 ` Alexander Kanavin
2025-12-12 11:30 ` [PATCH 1/4] setup-schema/layers.schema.json: correct indentation Paul Barker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251211142532.983960-3-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=alex@linutronix.de \
--cc=bitbake-devel@lists.openembedded.org \
--cc=paul@pbarker.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.