weldr/api: get the package list for depsolving in a better way

blueprint.GetPackages() method was used to depsolve blueprints prior the
dnf-to-rpm switch. However, it got dropped during the switch. This commit
makes weldr use it again.

The nice effect of this change is that we can drop getPkgNameGlob function and
have only one function for getting package name-versions from a blueprint.

Also, blueprint.GetPackages() works better with * version. Previously, we had
issues with composer depsolving bash of version * to both x86_64 and i686
versions of bash package. GetPackages() converts the package to name-version
of just bash, which dnf-json correctly depsolves to just one architecture. On
the contrary, the previous method converted bash to name-version bash-*.*.*,
which confused dnf-json.

Note that conversion to bash-* is also wrong because this will cause dnf-json
to install all packages with prefix "bash-*".
This commit is contained in:
Ondřej Budai 2020-06-09 18:25:34 +02:00 committed by Tom Gundersen
parent 6e6eae24eb
commit 0796342fa1

View file

@ -2504,13 +2504,8 @@ func (api *API) allRepositories() []rpmmd.RepoConfig {
func (api *API) depsolveBlueprint(bp *blueprint.Blueprint, imageType distro.ImageType) ([]rpmmd.PackageSpec, []rpmmd.PackageSpec, error) {
repos := api.allRepositories()
var specs []string = []string{}
for _, pkg := range bp.Packages {
specs = append(specs, getPkgNameGlob(pkg))
}
for _, mod := range bp.Modules {
specs = append(specs, getPkgNameGlob(mod))
}
specs := bp.GetPackages()
excludeSpecs := []string{}
if imageType != nil {
// When the output type is known, include the base packages in the depsolve