From 9780ec24d070b0638492c0f153a7ed776c150ed5 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 5 Nov 2025 20:06:36 +0100 Subject: bitbake: bitbake-setup: capture revisions while checking out layers When initializing a build setup from a conf.json that only sets 'rev' to a tag or branch, the actual revision would not be captured or logged. To capture the current layer state after an 'init' or 'update', the checkout_layers function is extended to store the revision the bb.fetch.Fetch pulled, and write that information into a sources-fixed-revisions.json file. This file can then be fed back into bitbake-setup init as: --sources-overrides This new 'sources-fixed-revisions.json' is written during 'update_build' and stored alongside the 'config-upstream.json' in the config dir. And put with the later under version control by calling 'commit_config" after 'update_build'. The use of 'deepcopy' is necessary to not modify the original input data - which python passes around as reference. (Bitbake rev: 95866ff03f78e987ae7e47daad053bc0f353eea4) Signed-off-by: Johannes Schneider Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/setup.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py index e18d6fc6ae..767a6298da 100644 --- a/bitbake/lib/bb/tests/setup.py +++ b/bitbake/lib/bb/tests/setup.py @@ -187,6 +187,12 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) bb_conf_path = os.path.join(bb_build_path, 'conf') self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) + with open(os.path.join(setuppath, 'config', "sources-fixed-revisions.json")) as f: + sources_fixed_revisions = json.load(f) + self.assertTrue('test-repo' in sources_fixed_revisions['sources'].keys()) + revision = self.git('rev-parse HEAD', cwd=self.testrepopath).strip() + self.assertEqual(revision, sources_fixed_revisions['sources']['test-repo']['git-remote']['rev']) + if "oe-template" in bitbake_config: with open(os.path.join(bb_conf_path, 'conf-summary.txt')) as f: self.assertEqual(f.read(), bitbake_config["oe-template"]) -- cgit v1.2.3-54-g00ecf