go.mod: update images to v0.116.0

This commit is contained in:
Michael Vogt 2025-02-10 13:08:02 +01:00 committed by Achilleas Koutsou
parent 9a2bc91f99
commit 13329ebb2e
7 changed files with 41 additions and 21 deletions

View file

@ -62,8 +62,15 @@ type Progress struct {
// NewStatusScanner returns a StatusScanner that can parse osbuild
// jsonseq monitor status messages
func NewStatusScanner(r io.Reader) *StatusScanner {
scanner := bufio.NewScanner(r)
// osbuild can currently generate very long messages, the default
// 64kb is too small for e.g. the dracut stage (see also
// https://github.com/osbuild/osbuild/issues/1976). Increase for
// but to unblock us.
buf := make([]byte, 0, 512_000)
scanner.Buffer(buf, 512_000)
return &StatusScanner{
scanner: bufio.NewScanner(r),
scanner: scanner,
contextMap: make(map[string]*contextJSON),
stageContextMap: make(map[string]*stageContextJSON),
}

View file

@ -1,13 +1,17 @@
package reporegistry
import "fmt"
import (
"fmt"
"io/fs"
)
// NoReposLoadedError is an error type that is returned when no repositories
// are loaded from the given paths.
type NoReposLoadedError struct {
Paths []string
FSes []fs.FS
}
func (e *NoReposLoadedError) Error() string {
return fmt.Sprintf("no repositories found in the given paths: %v", e.Paths)
return fmt.Sprintf("no repositories found in the given paths: %v/%v", e.Paths, e.FSes)
}

View file

@ -2,6 +2,7 @@ package reporegistry
import (
"fmt"
"io/fs"
"github.com/osbuild/images/pkg/distroidparser"
"github.com/osbuild/images/pkg/rpmmd"
@ -14,10 +15,14 @@ type RepoRegistry struct {
repos rpmmd.DistrosRepoConfigs
}
// New returns a new RepoRegistry instance with the data
// loaded from the given repoConfigPaths
func New(repoConfigPaths []string) (*RepoRegistry, error) {
repositories, err := LoadAllRepositories(repoConfigPaths)
// New returns a new RepoRegistry instance with the data loaded from
// the given repoConfigPaths and repoConfigFS instance. The order is
// important here, first the paths are tried, then the FSes.
//
// Note that the confPaths must point directly to the directory with
// the json repo files.
func New(repoConfigPaths []string, repoConfigFS []fs.FS) (*RepoRegistry, error) {
repositories, err := loadAllRepositories(repoConfigPaths, repoConfigFS)
if err != nil {
return nil, err
}

View file

@ -12,23 +12,24 @@ import (
"github.com/osbuild/images/pkg/rpmmd"
)
// LoadAllRepositories loads all repositories for given distros from the given list of paths.
// loadAllRepositories loads all repositories for given distros from the given list of paths.
// Behavior is the same as with the LoadRepositories() method.
func LoadAllRepositories(confPaths []string) (rpmmd.DistrosRepoConfigs, error) {
var confFSes []fs.FS
func loadAllRepositories(confPaths []string, confFSes []fs.FS) (rpmmd.DistrosRepoConfigs, error) {
var mergedFSes []fs.FS
for _, confPath := range confPaths {
confFSes = append(confFSes, os.DirFS(filepath.Join(confPath, "repositories")))
mergedFSes = append(mergedFSes, os.DirFS(confPath))
}
mergedFSes = append(mergedFSes, confFSes...)
distrosRepoConfigs, err := LoadAllRepositoriesFromFS(confFSes)
distrosRepoConfigs, err := loadAllRepositoriesFromFS(mergedFSes)
if len(distrosRepoConfigs) == 0 {
return nil, &NoReposLoadedError{confPaths}
return nil, &NoReposLoadedError{confPaths, confFSes}
}
return distrosRepoConfigs, err
}
func LoadAllRepositoriesFromFS(confPaths []fs.FS) (rpmmd.DistrosRepoConfigs, error) {
func loadAllRepositoriesFromFS(confPaths []fs.FS) (rpmmd.DistrosRepoConfigs, error) {
distrosRepoConfigs := rpmmd.DistrosRepoConfigs{}
for _, confPath := range confPaths {
@ -89,13 +90,16 @@ func LoadAllRepositoriesFromFS(confPaths []fs.FS) (rpmmd.DistrosRepoConfigs, err
// If there are duplicate distro repositories definitions found in multiple paths, the first
// encounter is preferred. For this reason, the order of paths in the passed list should
// reflect the desired preference.
//
// Note that the confPaths must point directly to the directory with
// the json repo files.
func LoadRepositories(confPaths []string, distro string) (map[string][]rpmmd.RepoConfig, error) {
var repoConfigs map[string][]rpmmd.RepoConfig
path := "/repositories/" + distro + ".json"
path := distro + ".json"
for _, confPath := range confPaths {
var err error
repoConfigs, err = rpmmd.LoadRepositoriesFromFile(confPath + path)
repoConfigs, err = rpmmd.LoadRepositoriesFromFile(filepath.Join(confPath, path))
if os.IsNotExist(err) {
continue
} else if err != nil {
@ -109,7 +113,7 @@ func LoadRepositories(confPaths []string, distro string) (map[string][]rpmmd.Rep
}
if repoConfigs == nil {
return nil, &NoReposLoadedError{confPaths}
return nil, &NoReposLoadedError{confPaths, nil}
}
return repoConfigs, nil

2
vendor/modules.txt vendored
View file

@ -1034,7 +1034,7 @@ github.com/oracle/oci-go-sdk/v54/identity
github.com/oracle/oci-go-sdk/v54/objectstorage
github.com/oracle/oci-go-sdk/v54/objectstorage/transfer
github.com/oracle/oci-go-sdk/v54/workrequests
# github.com/osbuild/images v0.115.0
# github.com/osbuild/images v0.116.0
## explicit; go 1.22.6
github.com/osbuild/images/data/repositories
github.com/osbuild/images/internal/common