diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-18 17:29:30 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-18 17:33:43 +0000 |
| commit | d5ffe93d2b4ba8e12a2a643e00caeb3ed51ad48e (patch) | |
| tree | cb8048695ea3a558f7b7ef1f97f4cfd95143413c /scripts | |
| parent | c5efa4ec5cfee3bc312bdd521f7d0cb4fa9efdd4 (diff) | |
| download | meta-virtualization-d5ffe93d2b4ba8e12a2a643e00caeb3ed51ad48e.tar.gz | |
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 <bruce.ashfield@gmail.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/oe-go-mod-fetcher.py | 10 |
1 files changed, 10 insertions, 0 deletions
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[ | |||
| 3929 | 3929 | ||
| 3930 | # Trust the ref_hint from discovery - it will be validated/corrected during | 3930 | # Trust the ref_hint from discovery - it will be validated/corrected during |
| 3931 | # the verification pass if needed (e.g., force-pushed tags are auto-corrected) | 3931 | # the verification pass if needed (e.g., force-pushed tags are auto-corrected) |
| 3932 | # BUT: for pseudo-versions, Go's Origin.Ref is the "nearest tag" used to derive | ||
| 3933 | # the pseudo-version, NOT a tag that points to this commit. Using it as a tag= | ||
| 3934 | # in SRC_URI causes BitBake to resolve the tag to a different commit and fail. | ||
| 3932 | ref_hint = module.get('vcs_ref', '') | 3935 | ref_hint = module.get('vcs_ref', '') |
| 3936 | version = module.get('version', '') | ||
| 3937 | if ref_hint and parse_pseudo_version_tag(version): | ||
| 3938 | # Pseudo-version: the vcs_ref is the base tag, not a ref pointing to this commit | ||
| 3939 | ref_hint = '' | ||
| 3933 | 3940 | ||
| 3934 | entry = repo_info['commits'][commit_hash] | 3941 | entry = repo_info['commits'][commit_hash] |
| 3935 | entry['modules'].append(module) | 3942 | entry['modules'].append(module) |
| @@ -3951,6 +3958,9 @@ def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[ | |||
| 3951 | vcs_url = module['vcs_url'] | 3958 | vcs_url = module['vcs_url'] |
| 3952 | commit_hash = module['vcs_hash'] | 3959 | commit_hash = module['vcs_hash'] |
| 3953 | ref_hint = module.get('vcs_ref', '') | 3960 | ref_hint = module.get('vcs_ref', '') |
| 3961 | # For pseudo-versions, vcs_ref is the nearest tag, not a ref pointing to this commit | ||
| 3962 | if ref_hint and parse_pseudo_version_tag(module.get('version', '')): | ||
| 3963 | ref_hint = '' | ||
| 3954 | 3964 | ||
| 3955 | print(f" • verifying [{index}/{total_modules}] {module['module_path']}@{module['version']} -> {commit_hash[:12]}") | 3965 | print(f" • verifying [{index}/{total_modules}] {module['module_path']}@{module['version']} -> {commit_hash[:12]}") |
| 3956 | 3966 | ||
