weldr: include build and base packages in final depsolve
The packag selection shown in the UI does not include the base packages that will be included in the image, and they cannot, because the base packages depends on the output type, and the UI packages shown in the UI are independent of the output type. It is possible to select packages incompatible with the base packages. Discover this sooner rather than later, by including the base packages in the final depsolve before creating the pipeline. In the future the result of the depsolve will be used to create the pipeline, so this is another prerequisite for moving from the dnf to the rpm stage. Also depsolve the build packages for the same reason. Note that we always set clean to false in this case, as the depsolving of the main packages would have performed any cleaning necessary. Also extend dnf-json to support excluding packages from depsolving. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
cdd1912e78
commit
6d94028976
1 changed files with 36 additions and 12 deletions
|
|
@ -827,7 +827,7 @@ func (api *API) blueprintsDepsolveHandler(writer http.ResponseWriter, request *h
|
|||
return
|
||||
}
|
||||
|
||||
dependencies, _, err := api.depsolveBlueprint(blueprint, false)
|
||||
dependencies, _, _, err := api.depsolveBlueprint(blueprint, "", api.arch, false)
|
||||
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
|
|
@ -889,7 +889,7 @@ func (api *API) blueprintsFreezeHandler(writer http.ResponseWriter, request *htt
|
|||
break
|
||||
}
|
||||
|
||||
dependencies, _, err := api.depsolveBlueprint(blueprint, false)
|
||||
dependencies, _, _, err := api.depsolveBlueprint(blueprint, "", api.arch, false)
|
||||
if err != nil {
|
||||
rerr := responseError{
|
||||
ID: "BlueprintsError",
|
||||
|
|
@ -1263,7 +1263,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
}
|
||||
|
||||
if bp != nil {
|
||||
_, checksums, err := api.depsolveBlueprint(bp, true)
|
||||
_, _, checksums, err := api.depsolveBlueprint(bp, cr.ComposeType, api.arch, true)
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "DepsolveError",
|
||||
|
|
@ -1796,7 +1796,14 @@ func (api *API) fetchPackageList() (rpmmd.PackageList, error) {
|
|||
return packages, err
|
||||
}
|
||||
|
||||
func (api *API) depsolveBlueprint(bp *blueprint.Blueprint, clean bool) ([]rpmmd.PackageSpec, map[string]string, error) {
|
||||
func (api *API) depsolveBlueprint(bp *blueprint.Blueprint, outputType, arch string, clean bool) ([]rpmmd.PackageSpec, []rpmmd.PackageSpec, map[string]string, error) {
|
||||
var repos []rpmmd.RepoConfig
|
||||
for _, repo := range api.distro.Repositories(api.arch) {
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
for _, source := range api.store.GetAllSources() {
|
||||
repos = append(repos, source.RepoConfig())
|
||||
}
|
||||
specs := make([]string, len(bp.Packages))
|
||||
for i, pkg := range bp.Packages {
|
||||
specs[i] = pkg.Name
|
||||
|
|
@ -1808,16 +1815,33 @@ func (api *API) depsolveBlueprint(bp *blueprint.Blueprint, clean bool) ([]rpmmd.
|
|||
specs[i] += "-*-*.*"
|
||||
}
|
||||
}
|
||||
|
||||
var repos []rpmmd.RepoConfig
|
||||
for _, repo := range api.distro.Repositories(api.arch) {
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
for _, source := range api.store.GetAllSources() {
|
||||
repos = append(repos, source.RepoConfig())
|
||||
excludeSpecs := []string{}
|
||||
if outputType != "" {
|
||||
// When the output type is known, include the base packages in the depsolve
|
||||
// transaction.
|
||||
packages, excludePackages, err := api.distro.BasePackages(outputType, arch)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
specs = append(specs, packages...)
|
||||
excludeSpecs = append(excludePackages, excludeSpecs...)
|
||||
}
|
||||
|
||||
return api.rpmmd.Depsolve(specs, nil, repos, api.distro.ModulePlatformID(), clean)
|
||||
packages, checksums, err := api.rpmmd.Depsolve(specs, excludeSpecs, repos, api.distro.ModulePlatformID(), clean)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
buildPackages := []rpmmd.PackageSpec{}
|
||||
if outputType != "" {
|
||||
buildSpecs, err := api.distro.BuildPackages(arch)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
buildPackages, _, err = api.rpmmd.Depsolve(buildSpecs, nil, repos, api.distro.ModulePlatformID(), false)
|
||||
}
|
||||
|
||||
return packages, buildPackages, checksums, err
|
||||
}
|
||||
|
||||
func (api *API) uploadsScheduleHandler(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue