From b652119d54faea7bf25a9c12f7178fb76d16193b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 10 Nov 2021 10:59:16 +0100 Subject: [PATCH] gather: Load JSON mapping relative to config dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JIRA: RHELCMP-7195 Signed-off-by: Lubomír Sedlář --- doc/configuration.rst | 3 ++- pungi/phases/gather/sources/source_json.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index 65226de2..3c9f66d1 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -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 diff --git a/pungi/phases/gather/sources/source_json.py b/pungi/phases/gather/sources/source_json.py index 819ba25a..b336f9b5 100644 --- a/pungi/phases/gather/sources/source_json.py +++ b/pungi/phases/gather/sources/source_json.py @@ -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()