rpmmd: require the path to dnf-json to be passed in

RPMMD had hardcoded path to dnf-json helper. This required all executables
using RPMMD to be run in the directory where dnf-json was located. This commit
makes RPMMD take the path to dnf-json as an argument. This allows its
consumers to specify whichever path they want.

Not a functional change
This commit is contained in:
Ondřej Budai 2020-05-19 08:58:15 +02:00 committed by Tom Gundersen
parent 5b2c06b3da
commit b93df4b524
5 changed files with 20 additions and 14 deletions

View file

@ -87,7 +87,9 @@ func main() {
log.Fatal("CACHE_DIRECTORY is not set. Is the service file missing CacheDirectory=?")
}
rpm := rpmmd.NewRPMMD(path.Join(cacheDirectory, "rpmmd"))
// osbuild-composer must be run in /usr/libexec/osbuild-composer directory,
// therefore use ./dnf-json as the path to dnf-json.
rpm := rpmmd.NewRPMMD(path.Join(cacheDirectory, "rpmmd"), "./dnf-json")
distros, err := distro.NewRegistry(fedora31.New(), fedora32.New(), rhel8.New())
if err != nil {