From 9da76b01df2e9ba607e5a24dee6f9094ba7a469d Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Oct 01 2025 21:53:04 +0000 Subject: AllowDraftComponents hub option --- diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index 1a4ccb9..fe3fe0d 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -7416,7 +7416,8 @@ class CG_Importer(object): self.log_warning("IGNORING unmatched rpm component: %r" % comp) return None # TODO: we should consider how to handle them once draft build is enabled for CG - reject_draft(rinfo, is_rpm=True) + if not context.opts.get('AllowDraftComponents', False): + reject_draft(rinfo, is_rpm=True) if rinfo['payloadhash'] != comp['sigmd5']: # XXX - this is a temporary workaround until we can better track external refs self.log_warning("IGNORING rpm component (md5 mismatch): %r" % comp) @@ -10732,9 +10733,8 @@ def importImageInternal(task_id, build_info, imgdata): data = add_external_rpm(an_rpm, location, strict=False) else: data = get_rpm(an_rpm, strict=True) - # unlike buildroot, we simply reject draft rpms as rpm components - # because we probably don't want to keep the nvra uniqueness here. - reject_draft(data, is_rpm=True) + if not context.opts.get('AllowDraftComponents', False): + reject_draft(data, is_rpm=True) rpm_ids.append(data['id']) # we sort to try to avoid deadlock issues rpm_ids.sort() diff --git a/kojihub/kojixmlrpc.py b/kojihub/kojixmlrpc.py index 9a37f61..533e19e 100644 --- a/kojihub/kojixmlrpc.py +++ b/kojihub/kojixmlrpc.py @@ -470,6 +470,7 @@ config_map = [ ['MissingPolicyOk', 'boolean', True], ['EnableMaven', 'boolean', False], ['EnableWin', 'boolean', False], + ['AllowDraftComponents', 'boolean', False], ['DefaultChannelCompat', 'boolean', True], diff --git a/tests/test_hub/test_complete_image_build.py b/tests/test_hub/test_complete_image_build.py index 467b251..cb92da6 100644 --- a/tests/test_hub/test_complete_image_build.py +++ b/tests/test_hub/test_complete_image_build.py @@ -81,6 +81,7 @@ class TestCompleteImageBuild(unittest.TestCase): mock.patch.object(kojihub.UpdateProcessor, 'execute', new=make_update_grabber(self)).start() mock.patch('kojihub.kojihub.nextval', new=self.my_nextval).start() + self.context = mock.patch('kojihub.kojihub.context').start() self.sequences = {} def tearDown(self):