diff --git a/internal/distro/fedora/distro.go b/internal/distro/fedora/distro.go index f0a727b0e..163087d50 100644 --- a/internal/distro/fedora/distro.go +++ b/internal/distro/fedora/distro.go @@ -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. diff --git a/internal/distro/rhel7/distro.go b/internal/distro/rhel7/distro.go index ea5186226..65c12d3c4 100644 --- a/internal/distro/rhel7/distro.go +++ b/internal/distro/rhel7/distro.go @@ -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()) } diff --git a/internal/distro/rhel8/imagetype.go b/internal/distro/rhel8/imagetype.go index cce60dc78..a81089af2 100644 --- a/internal/distro/rhel8/imagetype.go +++ b/internal/distro/rhel8/imagetype.go @@ -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()) } diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index 723b44394..b90365b7a 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -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.