From 0796342fa1a5291697576eeab3cd04ad0371f8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Tue, 9 Jun 2020 18:25:34 +0200 Subject: [PATCH] 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-*". --- internal/weldr/api.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/weldr/api.go b/internal/weldr/api.go index fb3b082db..19667b3d0 100644 --- a/internal/weldr/api.go +++ b/internal/weldr/api.go @@ -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