summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2026-03-19 15:55:42 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2026-03-19 15:56:06 +0000
commitb1a6d274a8cf9b2248ac708f3cd35e0d04540717 (patch)
tree64d3bd02894d714387618ae7fee2a01e929f783b /scripts
parent6f733ac63f82cf6fdd58e2c36342495b1810c2d1 (diff)
downloadmeta-virtualization-b1a6d274a8cf9b2248ac708f3cd35e0d04540717.tar.gz
go-mod-discovery/oe-go-mod-fetcher: add GO_MOD_VCS_EXCLUDE for deleted repos
Some upstream Go module repositories get deleted from GitHub (e.g., github.com/vtolstov/go-ioctl). While the Go module proxy still serves cached archives, VCS mode cannot git clone a deleted repo. This causes both do_fetch failures and generator verification failures. Add GO_MOD_VCS_EXCLUDE recipe variable (space-separated module path prefixes) and corresponding --exclude-module CLI flag. Excluded modules are filtered out before verification and SRC_URI generation. Recipes must provide a gomod:// SRC_URI entry for excluded modules as fallback. Usage in recipe: SRC_URI += "gomod://example.com/deleted-repo;version=v1.0.0;sha256sum=..." GO_MOD_VCS_EXCLUDE = "example.com/deleted-repo" Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-go-mod-fetcher.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/oe-go-mod-fetcher.py b/scripts/oe-go-mod-fetcher.py
index 5c866928..af8cbb03 100755
--- a/scripts/oe-go-mod-fetcher.py
+++ b/scripts/oe-go-mod-fetcher.py
@@ -2079,6 +2079,7 @@ def _execute(args: argparse.Namespace) -> int:
2079 debug_limit=debug_limit, 2079 debug_limit=debug_limit,
2080 skip_verify=args.skip_verify, 2080 skip_verify=args.skip_verify,
2081 verify_jobs=args.verify_jobs, 2081 verify_jobs=args.verify_jobs,
2082 exclude_modules=args.exclude_module,
2082 ) 2083 )
2083 2084
2084 if success: 2085 if success:
@@ -3869,7 +3870,7 @@ def discover_modules(source_dir: Path, gomodcache: Optional[str] = None) -> List
3869def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[Path], 3870def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[Path],
3870 git_repo: str, git_ref: str, validate_only: bool = False, 3871 git_repo: str, git_ref: str, validate_only: bool = False,
3871 debug_limit: Optional[int] = None, skip_verify: bool = False, 3872 debug_limit: Optional[int] = None, skip_verify: bool = False,
3872 verify_jobs: int = 10) -> bool: 3873 verify_jobs: int = 10, exclude_modules: Optional[List[str]] = None) -> bool:
3873 """ 3874 """
3874 Phase 2: Recipe Generation 3875 Phase 2: Recipe Generation
3875 3876
@@ -3897,6 +3898,17 @@ def generate_recipe(modules: List[Dict], source_dir: Path, output_dir: Optional[
3897 3898
3898 unresolved_commits: List[Tuple[str, str, str, str, str]] = [] 3899 unresolved_commits: List[Tuple[str, str, str, str, str]] = []
3899 3900
3901 # Filter out excluded modules (e.g., deleted upstream repos that must use gomod://)
3902 if exclude_modules:
3903 before_count = len(modules)
3904 excluded_prefixes = [e.strip() for e in exclude_modules]
3905 modules = [m for m in modules if not any(
3906 m.get('module_path', '').startswith(prefix) for prefix in excluded_prefixes
3907 )]
3908 excluded_count = before_count - len(modules)
3909 if excluded_count:
3910 print(f"\n⚙️ Excluded {excluded_count} modules matching: {', '.join(excluded_prefixes)}")
3911
3900 total_modules = len(modules) 3912 total_modules = len(modules)
3901 if debug_limit is not None: 3913 if debug_limit is not None:
3902 print(f"\n⚙️ Debug limit active: validating first {debug_limit} modules (total list size {total_modules})") 3914 print(f"\n⚙️ Debug limit active: validating first {debug_limit} modules (total list size {total_modules})")
@@ -4518,6 +4530,13 @@ Examples:
4518 ) 4530 )
4519 4531
4520 parser.add_argument( 4532 parser.add_argument(
4533 "--exclude-module",
4534 metavar="PREFIX",
4535 action="append",
4536 help="Exclude modules matching PREFIX from git:// generation (use gomod:// in recipe instead)"
4537 )
4538
4539 parser.add_argument(
4521 "--version", 4540 "--version",
4522 action="version", 4541 action="version",
4523 version=f"%(prog)s {VERSION}" 4542 version=f"%(prog)s {VERSION}"