Skip to content

Commit

Permalink
Merge pull request #3103 from g7/freeze-product
Browse files Browse the repository at this point in the history
osclib: freeze_command: handle 'product' repositories if used . Test failures are the same that are already on master.
  • Loading branch information
gleidi-suse committed Jul 30, 2024
2 parents 5194d43 + d14644c commit 7caf9a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
32 changes: 21 additions & 11 deletions osclib/freeze_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,27 @@ def prj_meta_for_bootstrap_copy(self):
for lprj in links:
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
f = ET.SubElement(root, 'build')
# 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'})
for repository in image_repositories:
ET.SubElement(f, 'disable', {'repository': repository})

# publish flag
f = ET.SubElement(root, 'publish')
ET.SubElement(f, 'disable')
ET.SubElement(f, 'enable', {'repository': 'images'})
for repository in image_repositories:
ET.SubElement(f, 'enable', {'repository': repository})

# debuginfo flag
f = ET.SubElement(root, 'debuginfo')
Expand All @@ -184,18 +192,20 @@ def prj_meta_for_bootstrap_copy(self):
a = ET.SubElement(r, 'arch')
a.text = arch

r = ET.SubElement(root, 'repository', {'name': 'images', 'linkedbuild': 'all'})
ET.SubElement(r, 'path', {'project': self.prj, 'repository': 'standard'})
for repository in image_repositories:
r = ET.SubElement(root, 'repository', {'name': repository, 'linkedbuild': 'all'})
ET.SubElement(r, 'path', {'project': self.prj, 'repository': 'standard'})

if self.prj.startswith('SUSE:'):
a = ET.SubElement(r, 'arch')
a.text = 'local'
a = ET.SubElement(r, 'arch')
a.text = 'x86_64'
if self.prj.startswith('SUSE:'):
a = ET.SubElement(r, 'arch')
a.text = 'local'

if 'ppc64le' in self.api.cstaging_archs:
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)

Expand Down
4 changes: 2 additions & 2 deletions osclib/stagingapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def is_staging_manager(self):
self._is_staging_manager = self.is_user_member_of(self.user, self.cstaging_group)
return self._is_staging_manager

def project_has_repo(self, repo_name):
def project_has_repo(self, repo_name, project=None):
# Determine if the project has a repo with given name
meta = self.get_prj_meta(self.project)
meta = self.get_prj_meta(project or self.project)
xpath = f'repository[@name="{repo_name}"]'
return len(meta.xpath(xpath)) > 0

Expand Down

0 comments on commit 7caf9a6

Please sign in to comment.