Merge pull request #2793 from coolo/fix_images

Don't play with the publish flag on freeze, images only switches buil…
This commit is contained in:
Stephan Kulow 2022-04-04 17:59:14 +02:00 committed by GitHub
commit 3e495a4f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 11 deletions

View File

@ -38,7 +38,12 @@ class FreezeCommand(object):
self.api.retried_PUT(url, ET.tostring(meta))
def is_images_disabled(self):
return self.api.get_flag_in_prj(self.prj, flag='build', repository='images') == 'disable'
flag = self.api.get_flag_in_prj(self.prj, flag='build', repository='images')
if flag == 'disable':
return True
if flag == 'enable':
return False
return self.api.get_flag_in_prj(self.prj, flag='build') == 'disable'
def create_bootstrap_aggregate(self):
self.create_bootstrap_aggregate_meta()
@ -126,6 +131,7 @@ class FreezeCommand(object):
self.copy_weakremovers()
build_status = self.api.get_flag_in_prj(prj, flag='build')
images_status = self.api.get_flag_in_prj(prj, flag='build', repository='images')
# If there is not a bootstrap repository, there is not
# anything more to do.
@ -146,6 +152,9 @@ class FreezeCommand(object):
# Set the original build status for the project
self.api.build_switch_prj(prj, build_status)
# if we build we *might* want to enable images as well (but only if preexistant)
if build_status == 'enable':
self.api.build_switch_prj(prj, images_status, repository='images')
def prj_meta_for_bootstrap_copy(self):
root = ET.Element('project', {'name': self.prj})
@ -154,17 +163,22 @@ class FreezeCommand(object):
links = self.projectlinks or ['{}:1-MinimalX'.format(self.api.crings)]
for lprj in links:
ET.SubElement(root, 'link', {'project': lprj})
# build flag
f = ET.SubElement(root, 'build')
# this one stays
ET.SubElement(f, 'disable', {'repository': 'bootstrap_copy'})
# this one is the global toggle
ET.SubElement(f, 'disable')
# this one stays
ET.SubElement(f, 'disable', {'repository': 'bootstrap_copy'})
# to be flipped by botmaster
ET.SubElement(f, 'disable', {'repository': 'images'})
# publish flag
f = ET.SubElement(root, 'publish')
ET.SubElement(f, 'disable')
images_flag = 'enable'
if self.is_images_disabled():
images_flag = 'disable'
ET.SubElement(f, images_flag, {'repository': 'images'})
ET.SubElement(f, 'enable', {'repository': 'images'})
# debuginfo flag
f = ET.SubElement(root, 'debuginfo')
ET.SubElement(f, 'enable')

View File

@ -1144,7 +1144,7 @@ class StagingAPI(object):
section = root.find(flag)
if section is None:
# the default for build and publish (is all we care for)
return 'enabled'
return 'enable'
for status in section:
is_repository = status.get('repository', None) == repository
is_arch = status.get('arch', None) == arch
@ -1160,13 +1160,13 @@ class StagingAPI(object):
url = self.makeurl(['source', project], query)
http_POST(url)
def build_switch_prj(self, project, state):
def build_switch_prj(self, project, state, repository=None, arch=None):
"""
Switch build state of project to desired state
:param project: project to switch state for
:param state: desired state for build
"""
self.switch_flag_in_prj(project, flag='build', state=state, repository=None, arch=None)
self.switch_flag_in_prj(project, flag='build', state=state, repository=repository, arch=arch)
def prj_frozen_enough(self, project):
"""

View File

@ -3,8 +3,9 @@
<description></description>
<link project="openSUSE:Factory:Rings:1-MinimalX"/>
<build>
<disable repository="bootstrap_copy"/>
<disable/>
<disable repository="bootstrap_copy"/>
<disable repository="images"/>
</build>
<publish>
<disable/>