distro: pass all repos to initializeManifest

Pass through all repos to the initalizeManifest() function.  Each
pipeline will then select which repositories it needs based on the
PackageSets field of each repository.

Before, we only passed global repos down to the manifest generators and
pipeline-specific repositories would only be used if they were attached
to package sets and were handled explicitly by a pipeline generator.

The repositories of the "blueprint" package set are explicitly added to
the workload and returned by the "os" pipeline.
The repositories of the "installer" package set are explicitly added to
the "anaconda-tree" pipeline.

If a repository was specified for any other pipeline, for example
"build", the repositories for the that package set were never added to
the pipeline.

Fixes #3290
This commit is contained in:
Achilleas Koutsou 2023-02-16 13:14:03 +01:00 committed by Tomáš Hozza
parent c7e0b69704
commit 2a4cd1966d
4 changed files with 6 additions and 24 deletions

View file

@ -559,7 +559,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// amend with repository information
globalRepos := make([]rpmmd.RepoConfig, 0)
for _, repo := range repos {
if len(repo.PackageSets) > 0 {
// only apply the repo to the listed package sets
@ -568,10 +567,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
ps.Repositories = append(ps.Repositories, repo)
packageSets[psName] = ps
}
} else {
// no package sets were listed, so apply the repo
// to all package sets
globalRepos = append(globalRepos, repo)
}
}
@ -610,7 +605,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// create a manifest object and instantiate it with the computed packageSetChains
manifest, err := t.initializeManifest(&bp, options, globalRepos, packageSets, containers, 0)
manifest, err := t.initializeManifest(&bp, options, repos, packageSets, containers, 0)
if err != nil {
// TODO: handle manifest initialization errors more gracefully, we
// refuse to initialize manifests with invalid config.

View file

@ -409,7 +409,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// amend with repository information
globalRepos := make([]rpmmd.RepoConfig, 0)
for _, repo := range repos {
if len(repo.PackageSets) > 0 {
// only apply the repo to the listed package sets
@ -418,10 +417,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
ps.Repositories = append(ps.Repositories, repo)
packageSets[psName] = ps
}
} else {
// no package sets were listed, so apply the repo
// to all package sets
globalRepos = append(globalRepos, repo)
}
}
@ -442,13 +437,14 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// create a manifest object and instantiate it with the computed packageSetChains
manifest, err := t.initializeManifest(&bp, options, globalRepos, packageSets, containers, 0)
manifest, err := t.initializeManifest(&bp, options, repos, packageSets, containers, 0)
if err != nil {
// TODO: handle manifest initialization errors more gracefully, we
// refuse to initialize manifests with invalid config.
logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err)
return nil
}
return overridePackageNamesInSets(manifest.GetPackageSetChains())
}

View file

@ -256,7 +256,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// amend with repository information
globalRepos := make([]rpmmd.RepoConfig, 0)
for _, repo := range repos {
if len(repo.PackageSets) > 0 {
// only apply the repo to the listed package sets
@ -265,10 +264,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
ps.Repositories = append(ps.Repositories, repo)
packageSets[psName] = ps
}
} else {
// no package sets were listed, so apply the repo
// to all package sets
globalRepos = append(globalRepos, repo)
}
}
@ -307,13 +302,14 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// create a manifest object and instantiate it with the computed packageSetChains
manifest, err := t.initializeManifest(&bp, options, globalRepos, packageSets, containers, 0)
manifest, err := t.initializeManifest(&bp, options, repos, packageSets, containers, 0)
if err != nil {
// TODO: handle manifest initialization errors more gracefully, we
// refuse to initialize manifests with invalid config.
logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err)
return nil
}
return overridePackageNamesInSets(manifest.GetPackageSetChains())
}

View file

@ -256,7 +256,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// amend with repository information
globalRepos := make([]rpmmd.RepoConfig, 0)
for _, repo := range repos {
if len(repo.PackageSets) > 0 {
// only apply the repo to the listed package sets
@ -265,10 +264,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
ps.Repositories = append(ps.Repositories, repo)
packageSets[psName] = ps
}
} else {
// no package sets were listed, so apply the repo
// to all package sets
globalRepos = append(globalRepos, repo)
}
}
@ -307,7 +302,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
}
// create a manifest object and instantiate it with the computed packageSetChains
manifest, err := t.initializeManifest(&bp, options, globalRepos, packageSets, containers, 0)
manifest, err := t.initializeManifest(&bp, options, repos, packageSets, containers, 0)
if err != nil {
// TODO: handle manifest initialization errors more gracefully, we
// refuse to initialize manifests with invalid config.