From d5ffe93d2b4ba8e12a2a643e00caeb3ed51ad48e Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Wed, 18 Mar 2026 17:29:30 +0000 Subject: oe-go-mod-fetcher: fix pseudo-version tag assignment in SRC_URI Go's module cache .info files store Origin.Ref as the "nearest tag" used to derive pseudo-versions (e.g., v0.0.0-20190215142949-d0b11bdaac8a stores Ref: "refs/tags/v0.3.0"). This ref is NOT a tag pointing to the pseudo-version's actual commit - it's just metadata about the base version. The generator was blindly using this ref as tag=v0.3.0;shallow=1 in SRC_URI entries. BitBake resolves the tag to one specific commit, finds it doesn't match the rev= parameter, and fails with: FetchError("The revision the git tag 'v0.3.0' resolved to didn't match the SRCREV in use...") This caused multiple SRC_URI entries for the same repo (e.g., go.googlesource.com/sys) to all claim tag=v0.3.0 but with different rev= values - only one could possibly be correct. Fix by detecting pseudo-versions via parse_pseudo_version_tag() and clearing the ref_hint so these entries use nobranch=1 without a tag, falling back to full clone by commit hash. Tagged versions (real releases) correctly retain their tag= parameter for shallow clones. The docker-compose .inc files are regenerated with the fix applied. Signed-off-by: Bruce Ashfield --- scripts/oe-go-mod-fetcher.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts') diff --git a/scripts/oe-go-mod-fetcher.py b/scripts/oe-go-mod-fetcher.py index 13399a73..5c866928 100755 --- a/scripts/oe-go-mod-fetcher.py +++ b/scripts/oe-go-mod-fetcher.py @@ -3929,7 +3929,14 @@ def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[ # Trust the ref_hint from discovery - it will be validated/corrected during # the verification pass if needed (e.g., force-pushed tags are auto-corrected) + # BUT: for pseudo-versions, Go's Origin.Ref is the "nearest tag" used to derive + # the pseudo-version, NOT a tag that points to this commit. Using it as a tag= + # in SRC_URI causes BitBake to resolve the tag to a different commit and fail. ref_hint = module.get('vcs_ref', '') + version = module.get('version', '') + if ref_hint and parse_pseudo_version_tag(version): + # Pseudo-version: the vcs_ref is the base tag, not a ref pointing to this commit + ref_hint = '' entry = repo_info['commits'][commit_hash] entry['modules'].append(module) @@ -3951,6 +3958,9 @@ def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[ vcs_url = module['vcs_url'] commit_hash = module['vcs_hash'] ref_hint = module.get('vcs_ref', '') + # For pseudo-versions, vcs_ref is the nearest tag, not a ref pointing to this commit + if ref_hint and parse_pseudo_version_tag(module.get('version', '')): + ref_hint = '' print(f" • verifying [{index}/{total_modules}] {module['module_path']}@{module['version']} -> {commit_hash[:12]}") -- cgit v1.2.3-54-g00ecf