ALBS-226: Patch pungi/lorax for building AL9
- Unit tests are fixed
This commit is contained in:
parent
700ae3cbac
commit
acfdfcef15
@ -12,6 +12,9 @@ import createrepo_c as cr
|
|||||||
from typing.io import BinaryIO
|
from typing.io import BinaryIO
|
||||||
|
|
||||||
|
|
||||||
|
EMPTY_FILE = '.empty'
|
||||||
|
|
||||||
|
|
||||||
def _is_compressed_file(first_two_bytes: bytes, initial_bytes: bytes):
|
def _is_compressed_file(first_two_bytes: bytes, initial_bytes: bytes):
|
||||||
return binascii.hexlify(first_two_bytes) == initial_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)
|
os.makedirs(module_defaults_path, exist_ok=True)
|
||||||
# Defaults modules can be empty, but pungi detects
|
# Defaults modules can be empty, but pungi detects
|
||||||
# empty folder while copying and raises the exception in this case
|
# 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:
|
for module_file in modules_paths:
|
||||||
data = module_file.read()
|
data = module_file.read()
|
||||||
|
@ -3,7 +3,7 @@ import gzip
|
|||||||
import os
|
import os
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import yaml
|
import yaml
|
||||||
from pungi.scripts.gather_modules import collect_modules
|
from pungi.scripts.gather_modules import collect_modules, EMPTY_FILE
|
||||||
import unittest
|
import unittest
|
||||||
from pyfakefs.fake_filesystem_unittest import TestCase
|
from pyfakefs.fake_filesystem_unittest import TestCase
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class TestModulesYamlParser(TestCase):
|
|||||||
self.assertEqual(['mariadb-devel-10.3_1-8010020200108182321.cdc1202b',
|
self.assertEqual(['mariadb-devel-10.3_1-8010020200108182321.cdc1202b',
|
||||||
'javapackages-tools-201801-8000020190628172923.b07bea58'],
|
'javapackages-tools-201801-8000020190628172923.b07bea58'],
|
||||||
os.listdir(os.path.join(PATH_TO_KOJI, 'modules/x86_64')))
|
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')))
|
os.listdir(os.path.join(PATH_TO_KOJI, 'module_defaults')))
|
||||||
|
|
||||||
# check that modules were exported
|
# check that modules were exported
|
||||||
|
Loading…
Reference in New Issue
Block a user