Introduce the ability to have hybrid gomod:// and git:// repositories.
This allows SRCREV bumping when fixing bugs, and using the git archiver
for some, all or none of the modules in a go mod project.
Example: k3s Hybrid Conversion
1. Ensure VCS mode works first
bitbake k3s
2. Get recommendations
bitbake k3s -c go_mod_recommend
3. Convert with recommended prefixes (keep containerd, k8s.io as git://)
python3 ./meta-virtualization/scripts/oe-go-mod-fetcher-hybrid.py \
--recipedir ./meta-virtualization/recipes-containers/k3s/ \
--git "github.com/containerd,k8s.io,sigs.k8s.io,github.com/rancher"
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Add the oe-go-mod-fetcher.py tool and supporting files for resolving
Go module dependencies via git repositories instead of module proxies.
oe-go-mod-fetcher.py:
- Parses go.mod and go.sum to identify required modules
- Resolves module paths to git repositories (handles vanity URLs)
- Maps module versions to git commits
- Generates SRC_URI entries for bitbake fetcher
- Creates go-mod-git.inc and go-mod-cache.inc files
- Supports monorepo detection and nested module handling
- Caches resolution results for performance
extract-discovered-modules.py:
- Helper script to extract module information from discovery cache
- Used by go-mod-discovery.bbclass during build
Also adds .gitignore to exclude runtime caches from version control.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>