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
This commit is contained in:
parent
1a14f5bae3
commit
0678d8ddfd
1 changed files with 7 additions and 22 deletions
|
|
@ -2,21 +2,18 @@ package main
|
|||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/images/data/repositories"
|
||||
"github.com/osbuild/images/pkg/reporegistry"
|
||||
)
|
||||
|
||||
// defaultDataDirs contains the default search paths to look for repository
|
||||
// data. Note that the repositories are under a repositories/ sub-directory
|
||||
// and 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).
|
||||
// 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",
|
||||
"/usr/share/image-builder",
|
||||
"/etc/image-builder/repositories",
|
||||
"/usr/share/image-builder/repositories",
|
||||
}
|
||||
|
||||
var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
||||
|
|
@ -27,17 +24,5 @@ var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
|||
dataDirs = defaultDataDirs
|
||||
}
|
||||
|
||||
// XXX: think about sharing this with reporegistry?
|
||||
var fses []fs.FS
|
||||
for _, d := range dataDirs {
|
||||
fses = append(fses, os.DirFS(filepath.Join(d, "repositories")))
|
||||
}
|
||||
fses = append(fses, repos.FS)
|
||||
|
||||
// XXX: should we support disabling the build-ins somehow?
|
||||
conf, err := reporegistry.LoadAllRepositoriesFromFS(fses)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return reporegistry.NewFromDistrosRepoConfigs(conf), nil
|
||||
return reporegistry.New(dataDirs, []fs.FS{repos.FS})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue