diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2025-12-05 19:34:41 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2025-12-08 20:57:44 -0500 |
| commit | 43a9e53dee19c56b79188081ee8adf326d7ddcdb (patch) | |
| tree | bc07fbe5e1c38ed53281105c376fcd2b30ba1e0f | |
| parent | df651f904ee91b3cf9face353af8219223442e6b (diff) | |
| download | meta-virtualization-43a9e53dee19c56b79188081ee8adf326d7ddcdb.tar.gz | |
oe-go-mod-fetcher: use dereferenced tags
Use dereferenced tag (^{}) to get the actual commit hash
For annotated tags, ref_hint returns the tag object hash, not the commit
Example: refs/tags/v1.0.1 -> c49ff274 (tag object)
refs/tags/v1.0.1^{} -> 37c8de36 (actual commit)
current_tag_commit = git_ls_remote(vcs_url, f"{ref_hint}^{{}}")
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rwxr-xr-x | scripts/oe-go-mod-fetcher.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/oe-go-mod-fetcher.py b/scripts/oe-go-mod-fetcher.py index 699255bd..20ceee7c 100755 --- a/scripts/oe-go-mod-fetcher.py +++ b/scripts/oe-go-mod-fetcher.py | |||
| @@ -1067,7 +1067,11 @@ def verify_commit_accessible(vcs_url: str, commit: str, ref_hint: str = "", vers | |||
| 1067 | if ref_hint.startswith('refs/tags/'): | 1067 | if ref_hint.startswith('refs/tags/'): |
| 1068 | try: | 1068 | try: |
| 1069 | # First check if tag has moved using fast ls-remote (cached) | 1069 | # First check if tag has moved using fast ls-remote (cached) |
| 1070 | current_tag_commit = git_ls_remote(vcs_url, ref_hint) | 1070 | # FIX #37: Use dereferenced tag (^{}) to get the actual commit hash |
| 1071 | # For annotated tags, ref_hint returns the tag object hash, not the commit | ||
| 1072 | # Example: refs/tags/v1.0.1 -> c49ff274 (tag object) | ||
| 1073 | # refs/tags/v1.0.1^{} -> 37c8de36 (actual commit) | ||
| 1074 | current_tag_commit = git_ls_remote(vcs_url, f"{ref_hint}^{{}}") | ||
| 1071 | 1075 | ||
| 1072 | if current_tag_commit and current_tag_commit != actual_commit: | 1076 | if current_tag_commit and current_tag_commit != actual_commit: |
| 1073 | # Tag has moved - fetch it to verify and update local repo | 1077 | # Tag has moved - fetch it to verify and update local repo |
| @@ -4298,6 +4302,18 @@ def load_discovered_modules(discovered_modules_path: Path) -> Optional[List[Dict | |||
| 4298 | 4302 | ||
| 4299 | print(f" Expanded {expanded} short hashes, {failed} failed ") | 4303 | print(f" Expanded {expanded} short hashes, {failed} failed ") |
| 4300 | 4304 | ||
| 4305 | # Filter out modules with empty vcs_hash - these are typically pre-Go 1.18 | ||
| 4306 | # modules lacking Origin metadata (e.g. pre-release pseudo-versions) that | ||
| 4307 | # cannot be fetched from git. They are usually transitive dependencies that | ||
| 4308 | # aren't actually needed by the build. | ||
| 4309 | empty_hash_modules = [m for m in modules if not m.get('vcs_hash')] | ||
| 4310 | if empty_hash_modules: | ||
| 4311 | print(f"\n⚠️ Filtering out {len(empty_hash_modules)} modules with empty vcs_hash:") | ||
| 4312 | for m in empty_hash_modules: | ||
| 4313 | print(f" - {m['module_path']}@{m['version']}") | ||
| 4314 | modules = [m for m in modules if m.get('vcs_hash')] | ||
| 4315 | print(f" Remaining modules: {len(modules)}") | ||
| 4316 | |||
| 4301 | return modules | 4317 | return modules |
| 4302 | 4318 | ||
| 4303 | except json.JSONDecodeError as e: | 4319 | except json.JSONDecodeError as e: |
