From 5aaf806c8e5137b9ff085a33d42fa1db9cd3ad75 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Dec 2024 09:40:16 +0100 Subject: [PATCH] data: make repositories available via `go:embed` This commit allows us to discover/load repositories via `go:embed`. Note that unlike the `testrepos.go` code this one does not provide a `New()` helper. Instead we will modify the `RepoRegistry` to look for the search paths for repo configuration first and then fallback to the buildin repos (unless disabled via a flag). Embedding also allows us an easy transition path in composer. The rpm specfile will simply need to copy the repository data from `vendor/github.com/osbuild/images/data/repositories` instead of the current location and we can delete the repositories already covered here (composer will still carry the `-no-aux-keys` repos and the symlinks (which sadly cannot be expressed via go:embed)). --- data/repositories/repos.go | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 data/repositories/repos.go diff --git a/data/repositories/repos.go b/data/repositories/repos.go new file mode 100644 index 0000000000..9ccea786ad --- /dev/null +++ b/data/repositories/repos.go @@ -0,0 +1,8 @@ +package repos + +import ( + "embed" +) + +//go:embed *.json +var FS embed.FS