osclib: freeze_command: handle 'product' repositories if used

Some projects (such as SLFO) are using product-composer, and
they build and publish in the 'product' repository.

If the 'product' repository is configured in the project meta,
ensure it gets configured when freezing the staging.

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
This commit is contained in:
Eugenio Paolantonio 2024-06-10 16:15:07 +02:00
parent 6ccb959ad2
commit fe7a6c6181

View File

@ -154,6 +154,12 @@ class FreezeCommand(object):
for lprj in links: for lprj in links:
ET.SubElement(root, 'link', {'project': lprj}) ET.SubElement(root, 'link', {'project': lprj})
# 'images' and 'product' repositories are closely related,
# and they need to be handled the same way.
image_repositories = ['images']
if self.api.project_has_repo('product', self.prj):
image_repositories.append('product')
# build flag # build flag
f = ET.SubElement(root, 'build') f = ET.SubElement(root, 'build')
# this one is the global toggle # this one is the global toggle
@ -161,12 +167,14 @@ class FreezeCommand(object):
# this one stays # this one stays
ET.SubElement(f, 'disable', {'repository': 'bootstrap_copy'}) ET.SubElement(f, 'disable', {'repository': 'bootstrap_copy'})
# to be flipped by botmaster # to be flipped by botmaster
ET.SubElement(f, 'disable', {'repository': 'images'}) for repository in image_repositories:
ET.SubElement(f, 'disable', {'repository': repository})
# publish flag # publish flag
f = ET.SubElement(root, 'publish') f = ET.SubElement(root, 'publish')
ET.SubElement(f, 'disable') ET.SubElement(f, 'disable')
ET.SubElement(f, 'enable', {'repository': 'images'}) for repository in image_repositories:
ET.SubElement(f, 'enable', {'repository': repository})
# debuginfo flag # debuginfo flag
f = ET.SubElement(root, 'debuginfo') f = ET.SubElement(root, 'debuginfo')
@ -184,18 +192,20 @@ class FreezeCommand(object):
a = ET.SubElement(r, 'arch') a = ET.SubElement(r, 'arch')
a.text = arch a.text = arch
r = ET.SubElement(root, 'repository', {'name': 'images', 'linkedbuild': 'all'}) for repository in image_repositories:
ET.SubElement(r, 'path', {'project': self.prj, 'repository': 'standard'}) r = ET.SubElement(root, 'repository', {'name': repository, 'linkedbuild': 'all'})
ET.SubElement(r, 'path', {'project': self.prj, 'repository': 'standard'})
if self.prj.startswith('SUSE:'): if self.prj.startswith('SUSE:'):
a = ET.SubElement(r, 'arch') a = ET.SubElement(r, 'arch')
a.text = 'local' a.text = 'local'
a = ET.SubElement(r, 'arch')
a.text = 'x86_64'
if 'ppc64le' in self.api.cstaging_archs:
a = ET.SubElement(r, 'arch') a = ET.SubElement(r, 'arch')
a.text = 'ppc64le' a.text = 'x86_64'
if 'ppc64le' in self.api.cstaging_archs:
a = ET.SubElement(r, 'arch')
a.text = 'ppc64le'
return ET.tostring(root) return ET.tostring(root)