gather: Load JSON mapping relative to config dir

JIRA: RHELCMP-7195
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2021-11-10 10:59:16 +01:00
parent 33d7290d78
commit b652119d54
2 changed files with 4 additions and 2 deletions

View File

@ -911,7 +911,8 @@ Options
**gather_source_mapping**
(*str*) -- JSON mapping with initial packages for the compose. The value
should be a path to JSON file with following mapping: ``{variant: {arch:
{rpm_name: [rpm_arch|None]}}}``.
{rpm_name: [rpm_arch|None]}}}``. Relative paths are interpreted relative to
the location of main config file.
**gather_profiler** = False
(*bool*) -- When set to ``True`` the gather tool will produce additional

View File

@ -32,6 +32,7 @@ set([(rpm_name, rpm_arch or None)])
import json
import os
import pungi.phases.gather.source
@ -41,7 +42,7 @@ class GatherSourceJson(pungi.phases.gather.source.GatherSourceBase):
json_path = self.compose.conf.get("gather_source_mapping")
if not json_path:
return set(), set()
with open(json_path, "r") as f:
with open(os.path.join(self.compose.config_dir, json_path), "r") as f:
mapping = json.load(f)
packages = set()