dnfjson: drop repo checksums

The repository checksums in the response from dnf-json aren't used
anywhere.  Since we're making changes to dnf-json and depsolving, now is
a good opportunity to drop them completely.
This commit is contained in:
Achilleas Koutsou 2022-05-23 19:06:24 +02:00 committed by Tom Gundersen
parent 0ef4e7ee84
commit 7a70a5e69b
13 changed files with 182 additions and 290 deletions

View file

@ -5,8 +5,6 @@
package main
import (
"net/http"
"path"
"testing"
"github.com/stretchr/testify/assert"
@ -18,38 +16,8 @@ import (
rhel "github.com/osbuild/osbuild-composer/internal/distro/rhel86"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/test"
)
func TestFetchChecksum(t *testing.T) {
dir, err := test.SetUpTemporaryRepository()
fs := http.FileServer(http.Dir(dir))
go func() {
err := http.ListenAndServe(":9000", fs)
assert.Nilf(t, err, "Could not start the http server: %v", err)
}()
defer func(dir string) {
err := test.TearDownTemporaryRepository(dir)
assert.Nil(t, err, "Failed to clean up temporary repository.")
}(dir)
assert.Nilf(t, err, "Failed to set up temporary repository: %v", err)
repoCfg := rpmmd.RepoConfig{
Name: "repo",
BaseURL: "http://localhost:9000",
IgnoreSSL: true,
}
solver := dnfjson.NewSolver("platform:f31", "31", "x86_64", path.Join(dir, "rpmmd"))
// use a fullpath to dnf-json, this allows this test to have an arbitrary
// working directory
solver.SetDNFJSONPath("/usr/libexec/osbuild-composer/dnf-json")
res, err := solver.FetchMetadata([]rpmmd.RepoConfig{repoCfg})
assert.Nilf(t, err, "Failed to fetch checksum: %v", err)
c := res.Checksums
assert.NotEqual(t, "", c["repo"], "The checksum is empty")
}
// This test loads all the repositories available in /repositories directory
// and tries to run depsolve for each architecture. With N architectures available
// this should run cross-arch dependency solving N-1 times.
@ -147,7 +115,7 @@ func TestDepsolvePackageSets(t *testing.T) {
return expectedPkgSpecsSetNames
}(imagePkgSets, imagePkgSetChains)
gotPackageSpecsSets := make(map[string]*dnfjson.DepsolveResult, len(imagePkgSets))
gotPackageSpecsSets := make(map[string][]rpmmd.PackageSpec, len(imagePkgSets))
for name, pkgSet := range imagePkgSets {
res, err := solver.Depsolve(pkgSet)

View file

@ -151,7 +151,7 @@ func main() {
if err != nil {
panic("Could not depsolve: " + err.Error())
}
depsolvedSets[name] = res.Dependencies
depsolvedSets[name] = res
}
var bytes []byte

View file

@ -27,7 +27,7 @@ func getManifest(bp blueprint.Blueprint, t distro.ImageType, a distro.Arch, d di
if err != nil {
panic(err)
}
pkgSpecSets[name] = res.Dependencies
pkgSpecSets[name] = res
}
manifest, err := t.Manifest(bp.Customizations, distro.ImageOptions{}, repos, pkgSpecSets, 0)
if err != nil {

View file

@ -28,7 +28,7 @@ func (impl *DepsolveJobImpl) depsolve(packageSets map[string][]rpmmd.PackageSet,
if err != nil {
return nil, err
}
depsolvedSets[name] = res.Dependencies
depsolvedSets[name] = res
}
return depsolvedSets, nil
}