Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions pkg/reporegistry/reporegistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ func (r *RepoRegistry) ReposByImageTypeName(distro, arch, imageType string) ([]r
return repositories, nil
}

// reposByArchName returns a slice of rpmmd.RepoConfig instances, which should be used for building image types for the
// ReposByArchName returns a slice of rpmmd.RepoConfig instances, which should be used for building image types for the
// specific architecture and distribution. This includes by default all repositories without any image type tags specified.
// Depending on the `includeTagged` argument value, repositories with image type tags set will be added to the returned
// slice or not.
//
// The method does not verify if the given architecture name is actually part of the specific distribution definition.
//
// Note that using ReposByImageTypeName() is most likely what you want to use.
func (r *RepoRegistry) ReposByArchName(distro, arch string, includeTagged bool) ([]rpmmd.RepoConfig, error) {
var repositories []rpmmd.RepoConfig

archRepos, err := r.DistroHasRepos(distro, arch)
archRepos, err := r.reposByDistroArch(distro, arch)
if err != nil {
return nil, err
}
Expand All @@ -97,8 +99,8 @@ func (r *RepoRegistry) ReposByArchName(distro, arch string, includeTagged bool)
return repositories, nil
}

// DistroHasRepos returns the repositories for the distro+arch, and a found flag
func (r *RepoRegistry) DistroHasRepos(distro, arch string) ([]rpmmd.RepoConfig, error) {
// reposByDistroArch returns the repositories for the distro+arch
func (r *RepoRegistry) reposByDistroArch(distro, arch string) ([]rpmmd.RepoConfig, error) {
// compatibility layer to support old repository definition filenames
// without a dot to separate major and minor release versions
stdDistroName, err := distroidparser.DefaultParser.Standardize(distro)
Expand All @@ -118,6 +120,12 @@ func (r *RepoRegistry) DistroHasRepos(distro, arch string) ([]rpmmd.RepoConfig,
return repos, nil
}

// (deprecated) DistroHasRepos is just here for compatbility with weldr which could
// use `ReposByArchName(distro, arch, true)` instead.
func (r *RepoRegistry) DistroHasRepos(distro, arch string) ([]rpmmd.RepoConfig, error) {
return r.reposByDistroArch(distro, arch)
}

Comment on lines +123 to +128

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why keep it and not fix the Weldr API to use ReposByArchName()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point, I should have linked tohttps://github.com/osbuild/osbuild-composer/pull/4910 - sorry for that. Once that is in I can drop this compat wrapper.

// ListDistros returns a list of all distros which have a repository defined
// in the registry.
func (r *RepoRegistry) ListDistros() []string {
Expand Down