Do not lose a module from koji if we have more than one arch (e.g. x86_64 + i686)

This commit is contained in:
soksanichenko 2022-10-19 04:38:22 +03:00
parent 941a02722c
commit f98f1b20ab
1 changed files with 21 additions and 19 deletions

View File

@ -1,6 +1,6 @@
import os
import subprocess
import time
from pathlib import Path
from attr import dataclass
from kobo.rpmlib import parse_nvra
@ -48,27 +48,28 @@ class KojiMock:
self._modules_dir = modules_dir
self._packages_dir = packages_dir
def _gather_modules(self, modules_dir):
@staticmethod
def _gather_modules(modules_dir):
modules = {}
for arch in os.listdir(modules_dir):
arch_dir = os.path.join(
modules_dir,
arch,
for index, (f, arch) in enumerate(
(sub_path.name, sub_path.parent.name)
for path in Path(modules_dir).glob('*')
for sub_path in path.iterdir()
):
parsed = parse_nvra(f)
modules[index] = Module(
name=parsed['name'],
nvr=f,
version=parsed['release'],
context=parsed['arch'],
stream=parsed['version'],
build_id=index,
arch=arch,
)
for index, f in enumerate(os.listdir(arch_dir)):
parsed = parse_nvra(f)
modules[index] = Module(
name=parsed['name'],
nvr=f,
version=parsed['release'],
context=parsed['arch'],
stream=parsed['version'],
build_id=index,
arch=arch,
)
return modules
def getLastEvent(self, *args, **kwargs):
@staticmethod
def getLastEvent(*args, **kwargs):
return {'id': LAST_EVENT_ID, 'ts': LAST_EVENT_TIME}
def listTagged(self, tag_name, *args, **kwargs):
@ -111,7 +112,8 @@ class KojiMock:
return builds
def getFullInheritance(self, *args, **kwargs):
@staticmethod
def getFullInheritance(*args, **kwargs):
"""
Unneeded because we use local storage.
"""