From 6ccb959ad2b8310dbccace04ed65831757ed1287 Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 10 Jun 2024 16:08:51 +0200 Subject: [PATCH 1/2] osclib: project_has_repo: allow specifying the project to look at Signed-off-by: Eugenio Paolantonio --- osclib/stagingapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osclib/stagingapi.py b/osclib/stagingapi.py index 1a0c02b4b..9b52cd867 100644 --- a/osclib/stagingapi.py +++ b/osclib/stagingapi.py @@ -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 From fe7a6c6181b65bdff6a66732ed5bb0fceb30721a Mon Sep 17 00:00:00 2001 From: Eugenio Paolantonio Date: Mon, 10 Jun 2024 16:15:07 +0200 Subject: [PATCH 2/2] 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 --- osclib/freeze_command.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/osclib/freeze_command.py b/osclib/freeze_command.py index 474a81250..7e5b83acf 100644 --- a/osclib/freeze_command.py +++ b/osclib/freeze_command.py @@ -154,6 +154,12 @@ 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 @@ -161,12 +167,14 @@ def prj_meta_for_bootstrap_copy(self): # 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') @@ -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)