summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2026-03-26 17:55:14 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2026-03-26 17:55:14 +0000
commitc5670da69b765c4c16bc663cbfb6777ae98f602f (patch)
tree87e45d9e50cee8933a3354ad44f73bb141a9a263
parentc4cf2aa57bf387dd4a334e03f7988835c993bd94 (diff)
downloadmeta-virtualization-c5670da69b765c4c16bc663cbfb6777ae98f602f.tar.gz
go-mod-vcs.bbclass: handle pure hybrid mode gracefully
When a recipe uses only gomod:// fetches with no VCS (git://) modules, GO_MODULE_CACHE_DATA is an empty list. Previously do_create_module_cache would run with nothing to process and do_sync_go_files would fatal with "No modules found in cache". Detect the empty module list and return early with an informational message in both tasks, allowing pure hybrid recipes (like yq) to build without workarounds. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--classes/go-mod-vcs.bbclass8
1 files changed, 7 insertions, 1 deletions
diff --git a/classes/go-mod-vcs.bbclass b/classes/go-mod-vcs.bbclass
index c08894d5..625343ef 100644
--- a/classes/go-mod-vcs.bbclass
+++ b/classes/go-mod-vcs.bbclass
@@ -818,6 +818,11 @@ python do_create_module_cache() {
818 workdir = Path(d.getVar('WORKDIR')) 818 workdir = Path(d.getVar('WORKDIR'))
819 modules_data = json.loads(d.getVar('GO_MODULE_CACHE_DATA')) 819 modules_data = json.loads(d.getVar('GO_MODULE_CACHE_DATA'))
820 820
821 # Pure hybrid mode (all gomod://, no VCS modules) - nothing to do
822 if not modules_data:
823 bb.note("No VCS modules to process (pure hybrid mode) - skipping cache creation")
824 return
825
821 # Remove go.sum files from git-fetched dependencies to prevent checksum conflicts 826 # Remove go.sum files from git-fetched dependencies to prevent checksum conflicts
822 # The module checksums from git sources differ from the proxy checksums, and stale 827 # The module checksums from git sources differ from the proxy checksums, and stale
823 # go.sum files in dependencies can cause "checksum mismatch" errors during build 828 # go.sum files in dependencies can cause "checksum mismatch" errors during build
@@ -1046,7 +1051,8 @@ python do_sync_go_files() {
1046 } 1051 }
1047 1052
1048 if not our_modules: 1053 if not our_modules:
1049 bb.fatal("No modules found in cache - cannot synchronize go.mod/go.sum") 1054 bb.note("No VCS modules in cache (pure hybrid mode) - skipping go.mod/go.sum sync")
1055 return
1050 1056
1051 bb.note(f"Found {len(our_modules)} modules in cache") 1057 bb.note(f"Found {len(our_modules)} modules in cache")
1052 1058