diff options
| -rwxr-xr-x | scripts/oe-go-mod-fetcher.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/oe-go-mod-fetcher.py b/scripts/oe-go-mod-fetcher.py index 74459204..c17582b8 100755 --- a/scripts/oe-go-mod-fetcher.py +++ b/scripts/oe-go-mod-fetcher.py | |||
| @@ -2754,13 +2754,19 @@ def resolve_pseudo_version_commit(vcs_url: str, timestamp_str: str, short_commit | |||
| 2754 | # Fetch failed, try to use existing clone anyway | 2754 | # Fetch failed, try to use existing clone anyway |
| 2755 | pass | 2755 | pass |
| 2756 | else: | 2756 | else: |
| 2757 | # Clone repository (bare clone for efficiency) | 2757 | # Clone repository as a mirror so `git fetch --all` can later |
| 2758 | # refresh refs. A plain `git clone --bare` does NOT install a | ||
| 2759 | # remote.origin.fetch refspec, so subsequent `git fetch --all` | ||
| 2760 | # exits 0 but updates nothing — the cache stays frozen at the | ||
| 2761 | # initial clone, and pseudo-version expansion silently fails | ||
| 2762 | # for any commit newer than the first clone time. --mirror | ||
| 2763 | # sets up the refspec `+refs/*:refs/*` so fetches stay current. | ||
| 2758 | if clone_dir.exists(): | 2764 | if clone_dir.exists(): |
| 2759 | shutil.rmtree(clone_dir) | 2765 | shutil.rmtree(clone_dir) |
| 2760 | clone_dir.mkdir(parents=True, exist_ok=True) | 2766 | clone_dir.mkdir(parents=True, exist_ok=True) |
| 2761 | 2767 | ||
| 2762 | subprocess.run( | 2768 | subprocess.run( |
| 2763 | ['git', 'clone', '--bare', '--quiet', try_url, str(clone_dir)], | 2769 | ['git', 'clone', '--mirror', '--quiet', try_url, str(clone_dir)], |
| 2764 | capture_output=True, | 2770 | capture_output=True, |
| 2765 | check=True, | 2771 | check=True, |
| 2766 | timeout=300, # 5 minute timeout | 2772 | timeout=300, # 5 minute timeout |
| @@ -4419,6 +4425,22 @@ def load_discovered_modules(discovered_modules_path: Path) -> Optional[List[Dict | |||
| 4419 | 4425 | ||
| 4420 | print(f" Expanded {expanded} short hashes, {failed} failed ") | 4426 | print(f" Expanded {expanded} short hashes, {failed} failed ") |
| 4421 | 4427 | ||
| 4428 | # A 12-char vcs_hash left in any module will trip bitbake's git | ||
| 4429 | # fetcher (sha1_re requires 40 chars) and trigger a confusing | ||
| 4430 | # "Unable to resolve" parse error. Surface this even outside | ||
| 4431 | # VERBOSE_MODE so the user catches it before the build fails. | ||
| 4432 | if failed: | ||
| 4433 | still_short = [m for m in short_hash_modules | ||
| 4434 | if len(m.get('vcs_hash', '')) != 40] | ||
| 4435 | if still_short: | ||
| 4436 | print(f"\n⚠️ {len(still_short)} module(s) still have 12-char hashes after expansion:") | ||
| 4437 | for m in still_short[:10]: | ||
| 4438 | print(f" - {m['module_path']}@{m.get('version', '')} ({m['vcs_hash']})") | ||
| 4439 | if len(still_short) > 10: | ||
| 4440 | print(f" ... and {len(still_short) - 10} more") | ||
| 4441 | print(f" These will cause bitbake parse errors. Common cause: a stale") | ||
| 4442 | print(f" clone_cache_dir entry. Try: rm -rf {CLONE_CACHE_DIR}") | ||
| 4443 | |||
| 4422 | # Filter out modules with empty vcs_hash - these are typically pre-Go 1.18 | 4444 | # Filter out modules with empty vcs_hash - these are typically pre-Go 1.18 |
| 4423 | # modules lacking Origin metadata (e.g. pre-release pseudo-versions) that | 4445 | # modules lacking Origin metadata (e.g. pre-release pseudo-versions) that |
| 4424 | # cannot be fetched from git. They are usually transitive dependencies that | 4446 | # cannot be fetched from git. They are usually transitive dependencies that |
