From 6ed22e289acb40fc77ea5a639318c3227d558d46 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 30 Oct 2024 19:11:04 +0100 Subject: [PATCH] fixup! move newRepoRegistry() into it's own file --- cmd/image-builder/list_images.go | 22 ---------------------- cmd/image-builder/repos.go | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 cmd/image-builder/repos.go diff --git a/cmd/image-builder/list_images.go b/cmd/image-builder/list_images.go index 18892747ea..44d5d35001 100644 --- a/cmd/image-builder/list_images.go +++ b/cmd/image-builder/list_images.go @@ -2,32 +2,10 @@ package main import ( "io" - "os" - "strings" "github.com/osbuild/images/pkg/distrofactory" - "github.com/osbuild/images/pkg/reporegistry" ) -// XXX: copied from "composer", should be exported there so -// that we keep this in sync -// XXX2: means we need to depend on osbuild-composer-common or something -var repositoryConfigs = []string{ - "/etc/osbuild-composer", - "/usr/share/osbuild-composer", -} - -// XXX: move to pkg/reporegistry -func newRepoRegistry() (*reporegistry.RepoRegistry, error) { - // useful for development/debugging, e.g. run: - // go build && IMAGE_BUILDER_EXTRA_REPOS_PATH=../../test/data ./image-builder - if extraReposPath := os.Getenv("IMAGE_BUILDER_EXTRA_REPOS_PATH"); extraReposPath != "" { - repositoryConfigs = append(repositoryConfigs, strings.Split(extraReposPath, ":")...) - } - - return reporegistry.New(repositoryConfigs) -} - func getFilteredImages(filterExprs []string) ([]FilterResult, error) { repos, err := newRepoRegistry() if err != nil { diff --git a/cmd/image-builder/repos.go b/cmd/image-builder/repos.go new file mode 100644 index 0000000000..b1e38a269b --- /dev/null +++ b/cmd/image-builder/repos.go @@ -0,0 +1,27 @@ +package main + +import ( + "os" + "strings" + + "github.com/osbuild/images/pkg/reporegistry" +) + +// XXX: copied from "composer", should be exported there so +// that we keep this in sync +// XXX2: means we need to depend on osbuild-composer-common or something +var repositoryConfigs = []string{ + "/etc/osbuild-composer", + "/usr/share/osbuild-composer", +} + +// XXX: move this new env into pkg/reporegistry? +func newRepoRegistry() (*reporegistry.RepoRegistry, error) { + // useful for development/debugging, e.g. run: + // go build && IMAGE_BUILDER_EXTRA_REPOS_PATH=../../test/data ./image-builder + if extraReposPath := os.Getenv("IMAGE_BUILDER_EXTRA_REPOS_PATH"); extraReposPath != "" { + repositoryConfigs = append(repositoryConfigs, strings.Split(extraReposPath, ":")...) + } + + return reporegistry.New(repositoryConfigs) +}