rpmmd: pass in cache directory explicitly

rpmmd looked at the CACHE_DIRECTORY environment variable to set a path
for the dnf repository cache.  Aside from being a smelly thing to do
from a library, this breaks osbuild-pipeline and osbuild-dnf-json-tests,
which don't run as systemd services and thus don't have CACHE_DIRECTORY
set.

Explicitly pass the cache directory to rpmmd. Keep using a path based on
CACHE_DIRECTORY for osbuild-composer. Use the user's `.cache` directory
for osbuild-pipeline and a temporary directory for the tests.
This commit is contained in:
Lars Karlitski 2020-03-02 20:17:16 +01:00 committed by Tom Gundersen
parent 5e6103f4a8
commit 60301df8f7
4 changed files with 26 additions and 19 deletions

View file

@ -57,7 +57,7 @@ func TestFetchChecksum(quiet bool, dir string) {
if !quiet {
log.Println("Running TestFetchChecksum on:", dir)
}
rpmMetadata := rpmmd.NewRPMMD()
rpmMetadata := rpmmd.NewRPMMD(path.Join(dir, "rpmmd"))
_, c, err := rpmMetadata.FetchMetadata([]rpmmd.RepoConfig{repoCfg}, "platform:f31")
if err != nil {
log.Panic("Failed to fetch checksum:", err)