manifest: helper function for collecting pipeline repos
Function that filters a list of repositories to return only the global repos and any that define a given pipeline or package set name in their list of PackageSets.
This commit is contained in:
parent
50f578924c
commit
a66003e513
1 changed files with 20 additions and 0 deletions
|
|
@ -102,3 +102,23 @@ func (m Manifest) GetExports() []string {
|
|||
}
|
||||
return exports
|
||||
}
|
||||
|
||||
// filterRepos returns a list of repositories that specify the given pipeline
|
||||
// name in their PackageSets list in addition to any global repositories
|
||||
// (global repositories are ones that do not specify any PackageSets).
|
||||
func filterRepos(repos []rpmmd.RepoConfig, plName string) []rpmmd.RepoConfig {
|
||||
filtered := make([]rpmmd.RepoConfig, 0, len(repos))
|
||||
for _, repo := range repos {
|
||||
if len(repo.PackageSets) == 0 {
|
||||
filtered = append(filtered, repo)
|
||||
continue
|
||||
}
|
||||
for _, ps := range repo.PackageSets {
|
||||
if ps == plName {
|
||||
filtered = append(filtered, repo)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue