fepitre / rpms / pungi

Forked from rpms/pungi 5 years ago
Clone
Blob Blame History Raw
From 91a03c693222a41a23d1a3250984e0d8c9372b75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20=C5=A0abata?= <contyk@redhat.com>
Date: Wed, 4 Apr 2018 14:01:10 +0200
Subject: [PATCH 5/9] Handle relative paths in module_defaults_dir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This now handles strings as well as sct_dicts with type=file that
include relative paths.

Signed-off-by: Petr Ĺ abata <contyk@redhat.com>
---
 pungi/phases/init.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pungi/phases/init.py b/pungi/phases/init.py
index 81eec0f4..ef203568 100644
--- a/pungi/phases/init.py
+++ b/pungi/phases/init.py
@@ -169,6 +169,11 @@ def create_comps_repo(compose, arch):
 
 def write_module_defaults(compose):
     scm_dict = compose.conf["module_defaults_dir"]
+    if isinstance(scm_dict, dict):
+        if scm_dict["scm"] == "file":
+            scm_dict["dir"] = os.path.join(compose.config_dir, scm_dict["dir"])
+    else:
+        scm_dict = os.path.join(compose.config_dir, scm_dict)
 
     with temp_dir(prefix="moduledefaults_") as tmp_dir:
         get_dir_from_scm(scm_dict, tmp_dir, logger=compose._logger)
-- 
2.13.6