diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-19 15:55:42 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-03-19 15:56:06 +0000 |
| commit | b1a6d274a8cf9b2248ac708f3cd35e0d04540717 (patch) | |
| tree | 64d3bd02894d714387618ae7fee2a01e929f783b /classes | |
| parent | 6f733ac63f82cf6fdd58e2c36342495b1810c2d1 (diff) | |
| download | meta-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 'classes')
| -rw-r--r-- | classes/go-mod-discovery.bbclass | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/classes/go-mod-discovery.bbclass b/classes/go-mod-discovery.bbclass index d41d70a5..39cc38da 100644 --- a/classes/go-mod-discovery.bbclass +++ b/classes/go-mod-discovery.bbclass | |||
| @@ -122,6 +122,11 @@ GO_MOD_DISCOVERY_RECIPEDIR ?= "${FILE_DIRNAME}" | |||
| 122 | # Usage: GO_MOD_DISCOVERY_SKIP_VERIFY = "1" in local.conf or recipe | 122 | # Usage: GO_MOD_DISCOVERY_SKIP_VERIFY = "1" in local.conf or recipe |
| 123 | GO_MOD_DISCOVERY_SKIP_VERIFY ?= "" | 123 | GO_MOD_DISCOVERY_SKIP_VERIFY ?= "" |
| 124 | 124 | ||
| 125 | # Modules to exclude from git:// generation (space-separated prefixes) | ||
| 126 | # Excluded modules must be fetched via gomod:// in the recipe's SRC_URI | ||
| 127 | # Usage: GO_MOD_VCS_EXCLUDE = "github.com/vtolstov/go-ioctl" | ||
| 128 | GO_MOD_VCS_EXCLUDE ?= "" | ||
| 129 | |||
| 125 | # Empty default for TAGS if not set by recipe (avoids undefined variable errors) | 130 | # Empty default for TAGS if not set by recipe (avoids undefined variable errors) |
| 126 | TAGS ?= "" | 131 | TAGS ?= "" |
| 127 | 132 | ||
| @@ -396,12 +401,18 @@ Or run 'bitbake ${PN} -c show_upgrade_commands' to see manual options." | |||
| 396 | SKIP_VERIFY_FLAG="--skip-verify" | 401 | SKIP_VERIFY_FLAG="--skip-verify" |
| 397 | fi | 402 | fi |
| 398 | 403 | ||
| 404 | EXCLUDE_FLAGS="" | ||
| 405 | for mod in ${GO_MOD_VCS_EXCLUDE}; do | ||
| 406 | EXCLUDE_FLAGS="${EXCLUDE_FLAGS} --exclude-module ${mod}" | ||
| 407 | done | ||
| 408 | |||
| 399 | python3 "${FETCHER_SCRIPT}" \ | 409 | python3 "${FETCHER_SCRIPT}" \ |
| 400 | --discovered-modules "${GO_MOD_DISCOVERY_MODULES_JSON}" \ | 410 | --discovered-modules "${GO_MOD_DISCOVERY_MODULES_JSON}" \ |
| 401 | --git-repo "${GO_MOD_DISCOVERY_GIT_REPO}" \ | 411 | --git-repo "${GO_MOD_DISCOVERY_GIT_REPO}" \ |
| 402 | --git-ref "${GO_MOD_DISCOVERY_GIT_REF}" \ | 412 | --git-ref "${GO_MOD_DISCOVERY_GIT_REF}" \ |
| 403 | --recipedir "${GO_MOD_DISCOVERY_RECIPEDIR}" \ | 413 | --recipedir "${GO_MOD_DISCOVERY_RECIPEDIR}" \ |
| 404 | ${SKIP_VERIFY_FLAG} | 414 | ${SKIP_VERIFY_FLAG} \ |
| 415 | ${EXCLUDE_FLAGS} | ||
| 405 | 416 | ||
| 406 | if [ $? -eq 0 ]; then | 417 | if [ $? -eq 0 ]; then |
| 407 | echo "" | 418 | echo "" |
