debian-forge-cli/cmd/image-builder/repos.go
Michael Vogt 0678d8ddfd main: update for new reporegistry.New() api (c.f. pr#1179)
This commit updates ibcli for the new API in images for the
`reporegistry.New()`. The main incompatible change is that the
`/repositories` part is not longer automatically added inside
the library so we need to add it on the call-site.

This needs https://github.com/osbuild/images/pull/1179
2025-02-10 20:40:56 +01:00

28 lines
738 B
Go

package main
import (
"io/fs"
"github.com/osbuild/images/data/repositories"
"github.com/osbuild/images/pkg/reporegistry"
)
// defaultDataDirs contains the default search paths to look for
// repository data. They contain a bunch of json files of the form
// "$distro_$version".json (but that is an implementation detail that
// the "images" library takes care of).
var defaultDataDirs = []string{
"/etc/image-builder/repositories",
"/usr/share/image-builder/repositories",
}
var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
var dataDirs []string
if dataDir != "" {
dataDirs = []string{dataDir}
} else {
dataDirs = defaultDataDirs
}
return reporegistry.New(dataDirs, []fs.FS{repos.FS})
}