summaryrefslogtreecommitdiffstats
path: root/classes/go-mod-discovery.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* go-mod-fetcher: fix shallow clone handling, duplicates, and discovery workflowBruce Ashfield2026-01-041-2/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | oe-go-mod-fetcher.py: - Remove BB_GIT_SHALLOW_EXTRA_REFS generation - refs must be present in ALL repositories which isn't the case for module dependencies. Instead, use tag= parameter in individual SRC_URI entries. - Add tag=<tagname> to SRC_URI when ref is a tag, allowing BitBake's shallow clone to include the necessary tag (with BB_GIT_SHALLOW=1) - Remove premature _ref_points_to_commit() check that was clearing ref_hints before repos were fetched, preventing tag= from being added - Fix pseudo-version verification: only use shallow fetch for actual tags (refs/tags/...), not branch refs. Pseudo-versions with branch refs (refs/heads/...) now correctly use unshallow path to reach historical commits that aren't fetchable with depth=1 oe-go-mod-fetcher-hybrid.py: - Fix duplicate SRC_URI entries when multiple modules share the same git repo/commit (e.g., errdefs and errdefs/pkg). Track added vcs_hashes to skip duplicates. - Add --discovery-cache option to calculate module sizes from discovery cache .zip files, enabling size recommendations during discover_and_generate go-mod-discovery.bbclass: - Add automatic hybrid mode recommendations after generate_modules, showing module sizes and suggested --git prefixes for conversion - Add GO_MOD_DISCOVERY_SKIP_VERIFY variable to skip commit verification on retries (useful after fixing verification issues) - Pass --discovery-cache to hybrid script for accurate size calculations Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
* go-mod-discovery: support multi-patckage buildBruce Ashfield2025-12-081-1/+5
| | | | | | | When building multiple packages (./... or multiple targets), go build requires the output to be a directory. Create the directory and use it. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
* go-mod-discovery: move patching after discovery buildBruce Ashfield2025-12-081-2/+5
| | | | | | | | | | | | When updating a SRCREV and then running discovery, we expect that some patches will fail. We don't want that to block discovery as these patches are not normally ADDING dependencies that would be found. So we move discovery before patch and patch failures can be dealt with on a full build. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
* discover: manage go.* filesBruce Ashfield2025-12-081-0/+15
| | | | | | | | | | | | | | The discovery repository can be in an incosistent state after a build. By restoring the go.* files, we ensure a stable start point. Add automatic removal of go.sum files from git-fetched dependencies in vcs_cache during do_create_module_cache. This prevents checksum mismatch errors caused by stale go.sum files in dependencies having different checksums than the git-sourced modules. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
* go-mod-discovery: split into more tasksBruce Ashfield2025-12-081-214/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make it easier to run individual components of the go module discovery and generation process, we add invidual tasks as well as a combined task: AVAILABLE TASKS: bitbake <recipe> -c discover_modules Build project and download modules from proxy.golang.org This populates the discovery cache but does NOT extract or generate bitbake <recipe> -c extract_modules Extract module metadata from discovery cache to modules.json Requires: discover_modules to have been run first bitbake <recipe> -c generate_modules Generate go-mod-git.inc and go-mod-cache.inc from modules.json Requires: extract_modules to have been run first bitbake <recipe> -c discover_and_generate Run all three steps: discover -> extract -> generate This is the "do everything" convenience task bitbake <recipe> -c show_upgrade_commands Show copy-pasteable command lines without running anything bitbake <recipe> -c clean_discovery Remove the persistent discovery cache Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
* classes: add go-mod-vcs and go-mod-discovery for Go module buildsBruce Ashfield2025-12-081-0/+441
Add two new bbclass files that enable building Go applications using git-based module resolution instead of network proxy fetches: go-mod-vcs.bbclass: - Provides do_create_module_cache task to build GOMODCACHE from git sources - Implements pure Python h1: hash calculation with go-dirhash-native fallback - Creates properly structured module zip files and hash files - Handles module path transformations and case encoding go-mod-discovery.bbclass: - Runs module discovery using the oe-go-mod-fetcher tool - Generates go-mod-git.inc and go-mod-cache.inc files - Supports bootstrap mode for initial recipe conversion Together these classes enable fully offline, reproducible Go builds by fetching module sources via git and constructing the module cache during the build rather than relying on network access to module proxies. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>