From 700ae3cbac7d92072c5f5e0f4f40de34271decd4 Mon Sep 17 00:00:00 2001 From: soksanichenko Date: Fri, 18 Mar 2022 22:37:57 +0200 Subject: [PATCH 1/3] ALBS-226: Patch pungi/lorax for building AL9 - Defaults modules can be empty, but pungi detects empty folder while copying and raises the exception in this case --- pungi/scripts/gather_modules.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pungi/scripts/gather_modules.py b/pungi/scripts/gather_modules.py index f3928727..8c19e95f 100644 --- a/pungi/scripts/gather_modules.py +++ b/pungi/scripts/gather_modules.py @@ -65,6 +65,9 @@ def collect_modules(modules_paths: List[BinaryIO], target_dir: str): module_defaults_path = os.path.join(target_dir, 'module_defaults') os.makedirs(modules_path, exist_ok=True) os.makedirs(module_defaults_path, exist_ok=True) + # Defaults modules can be empty, but pungi detects + # empty folder while copying and raises the exception in this case + Path(os.path.join(module_defaults_path, '.empty')).touch() for module_file in modules_paths: data = module_file.read() -- 2.43.5 From acfdfcef15562ca19df157f8d5c87e3f04e2489c Mon Sep 17 00:00:00 2001 From: soksanichenko Date: Sat, 19 Mar 2022 03:26:10 +0200 Subject: [PATCH 2/3] ALBS-226: Patch pungi/lorax for building AL9 - Unit tests are fixed --- pungi/scripts/gather_modules.py | 5 ++++- tests/test_gather_modules.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pungi/scripts/gather_modules.py b/pungi/scripts/gather_modules.py index 8c19e95f..507d9a39 100644 --- a/pungi/scripts/gather_modules.py +++ b/pungi/scripts/gather_modules.py @@ -12,6 +12,9 @@ import createrepo_c as cr from typing.io import BinaryIO +EMPTY_FILE = '.empty' + + def _is_compressed_file(first_two_bytes: bytes, initial_bytes: bytes): return binascii.hexlify(first_two_bytes) == initial_bytes @@ -67,7 +70,7 @@ def collect_modules(modules_paths: List[BinaryIO], target_dir: str): os.makedirs(module_defaults_path, exist_ok=True) # Defaults modules can be empty, but pungi detects # empty folder while copying and raises the exception in this case - Path(os.path.join(module_defaults_path, '.empty')).touch() + Path(os.path.join(module_defaults_path, EMPTY_FILE)).touch() for module_file in modules_paths: data = module_file.read() diff --git a/tests/test_gather_modules.py b/tests/test_gather_modules.py index 0930ef06..a4f1fd22 100644 --- a/tests/test_gather_modules.py +++ b/tests/test_gather_modules.py @@ -3,7 +3,7 @@ import gzip import os from io import StringIO import yaml -from pungi.scripts.gather_modules import collect_modules +from pungi.scripts.gather_modules import collect_modules, EMPTY_FILE import unittest from pyfakefs.fake_filesystem_unittest import TestCase @@ -106,7 +106,7 @@ class TestModulesYamlParser(TestCase): self.assertEqual(['mariadb-devel-10.3_1-8010020200108182321.cdc1202b', 'javapackages-tools-201801-8000020190628172923.b07bea58'], os.listdir(os.path.join(PATH_TO_KOJI, 'modules/x86_64'))) - self.assertEqual(['ant.yaml'], + self.assertEqual(['ant.yaml', EMPTY_FILE], os.listdir(os.path.join(PATH_TO_KOJI, 'module_defaults'))) # check that modules were exported -- 2.43.5 From a83be2fbb24de088df35f64d4d6dab1ccb810d57 Mon Sep 17 00:00:00 2001 From: soksanichenko Date: Sat, 19 Mar 2022 03:32:43 +0200 Subject: [PATCH 3/3] ALBS-226: Patch pungi/lorax for building AL9 - Unit tests are fixed --- tests/test_gather_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_gather_modules.py b/tests/test_gather_modules.py index a4f1fd22..7cbef4fa 100644 --- a/tests/test_gather_modules.py +++ b/tests/test_gather_modules.py @@ -106,7 +106,7 @@ class TestModulesYamlParser(TestCase): self.assertEqual(['mariadb-devel-10.3_1-8010020200108182321.cdc1202b', 'javapackages-tools-201801-8000020190628172923.b07bea58'], os.listdir(os.path.join(PATH_TO_KOJI, 'modules/x86_64'))) - self.assertEqual(['ant.yaml', EMPTY_FILE], + self.assertEqual([EMPTY_FILE, 'ant.yaml'], os.listdir(os.path.join(PATH_TO_KOJI, 'module_defaults'))) # check that modules were exported -- 2.43.5