From 529c5623a683fafab7a03c47690d974b79e0628d Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 21 Nov 2019 13:42:19 +0100 Subject: [PATCH] Remove nonfree handling Prepare NonFree as onlyadi project, so it can have its own staging workflow --- metrics.py | 2 +- osc-staging.py | 3 +-- osclib/accept_command.py | 3 --- osclib/adi_command.py | 6 +---- osclib/conf.py | 14 ++++++----- osclib/request_splitter.py | 3 --- osclib/stagingapi.py | 48 +++++++++++++++++++++----------------- tests/config_tests.py | 7 +++--- 8 files changed, 41 insertions(+), 45 deletions(-) diff --git a/metrics.py b/metrics.py index 91db3436..69d20791 100755 --- a/metrics.py +++ b/metrics.py @@ -28,7 +28,7 @@ Point = namedtuple('Point', ['measurement', 'tags', 'fields', 'time', 'delta']) # Duplicate Leap config to handle 13.2 without issue. osclib.conf.DEFAULT[ r'openSUSE:(?P[\d.]+)$'] = osclib.conf.DEFAULT[ - r'openSUSE:(?PLeap:(?P[\d.]+))(?::NonFree)?$'] + r'openSUSE:(?PLeap:(?P[\d.]+))$'] # Provide osc.core.get_request_list() that swaps out search() implementation to # capture the generated query, paginate over and yield each request to avoid diff --git a/osc-staging.py b/osc-staging.py index 87a1face..53ebdb1a 100644 --- a/osc-staging.py +++ b/osc-staging.py @@ -193,7 +193,6 @@ def do_staging(self, subcmd, opts, *args): - ./action/target/@devel_project_super: super devel project if relevant - ./action/target/@ring: the ring to which the package belongs - ./@aged: either True or False based on splitter-request-age-threshold - - ./@nonfree: set to nonfree if targetting nonfree sub project - ./@ignored: either False or the provided message Some useful examples: @@ -465,7 +464,7 @@ def do_staging(self, subcmd, opts, *args): print('--move and --filter-from must be used with explicit staging and request list') return - open_requests = api.get_open_requests({'withhistory': 1}, include_nonfree=False) + open_requests = api.get_open_requests({'withhistory': 1}) if len(open_requests) == 0: print('No open requests to consider') return diff --git a/osclib/accept_command.py b/osclib/accept_command.py index b1699adf..4b589692 100644 --- a/osclib/accept_command.py +++ b/osclib/accept_command.py @@ -146,9 +146,6 @@ class AcceptCommand(object): changed = False rqlist = self.find_new_requests(self.api.project) - if self.api.cnonfree: - rqlist += self.find_new_requests(self.api.cnonfree) - for req in rqlist: oldspecs = self.api.get_filelist_for_package(pkgname=req['packages'][0], project=self.api.project, extension='spec') print('Accepting request %d: %s' % (req['id'], ','.join(req['packages']))) diff --git a/osclib/adi_command.py b/osclib/adi_command.py index 31e00647..52689447 100644 --- a/osclib/adi_command.py +++ b/osclib/adi_command.py @@ -108,8 +108,6 @@ class AdiCommand: else: splitter.group_by('./action/source/@project') - if not split: - splitter.group_by('./action/target/@nonfree') splitter.split() for group in sorted(splitter.grouped.keys()): @@ -137,9 +135,7 @@ class AdiCommand: # request is processed from a particular group. if name is None: use_frozenlinks = group in source_projects_expand and not split - nonfree = bool(target.get('nonfree')) - name = self.api.create_adi_project(None, - use_frozenlinks, group, nonfree) + name = self.api.create_adi_project(None, use_frozenlinks, group) if not self.api.rq_to_prj(request_id, name): return False diff --git a/osclib/conf.py b/osclib/conf.py index e095c3e7..e45f8897 100644 --- a/osclib/conf.py +++ b/osclib/conf.py @@ -19,13 +19,12 @@ from osclib.memoize import memoize # the project. DEFAULT = { - r'openSUSE:(?PFactory)(?::NonFree)?$': { + r'openSUSE:(?PFactory)?$': { 'staging': 'openSUSE:%(project)s:Staging', 'staging-group': 'factory-staging', 'staging-archs': 'i586 x86_64', 'staging-dvd-archs': '', 'rings': 'openSUSE:%(project)s:Rings', - 'nonfree': 'openSUSE:%(project)s:NonFree', 'rebuild': 'openSUSE:%(project)s:Rebuild', 'product': 'openSUSE.product', 'openqa': 'https://openqa.opensuse.org', @@ -58,14 +57,18 @@ DEFAULT = { 'mail-maintainer': 'Dirk Mueller ', 'mail-noreply': 'noreply@opensuse.org', }, - r'openSUSE:(?PLeap:(?P[\d.]+))(?::NonFree)?$': { + r'openSUSE:(?P.*:NonFree)$': { + 'staging': 'openSUSE:%(project)s:Staging', + 'staging-group': 'factory-staging', + 'onlyadi': 'True', + }, + r'openSUSE:(?PLeap:(?P[\d.]+))$': { 'staging': 'openSUSE:%(project)s:Staging', 'staging-group': 'factory-staging', 'staging-archs': 'i586 x86_64', 'staging-dvd-archs': '', 'nocleanup-packages': 'bootstrap-copy 000product 000release-packages', 'rings': 'openSUSE:%(project)s:Rings', - 'nonfree': 'openSUSE:%(project)s:NonFree', 'rebuild': 'openSUSE:%(project)s:Rebuild', 'product': 'openSUSE.product', 'openqa': 'https://openqa.opensuse.org', @@ -110,7 +113,7 @@ DEFAULT = { 'mail-maintainer': 'Dirk Mueller ', 'mail-noreply': 'noreply@opensuse.org', }, - r'openSUSE:(?PLeap:(?P[\d.]+)(?::NonFree)?:Update)$': { + r'openSUSE:(?PLeap:(?P[\d.]+)?:Update)$': { 'main-repo': 'standard', 'leaper-override-group': 'leap-reviewers', 'repo_checker-arch-whitelist': 'x86_64', @@ -154,7 +157,6 @@ DEFAULT = { 'installcheck-ignore-duplicated-binaries': '', 'onlyadi': '', 'rings': '', - 'nonfree': '', 'rebuild': '', 'product': '', 'openqa': '', diff --git a/osclib/request_splitter.py b/osclib/request_splitter.py index 52427300..ba6619b8 100644 --- a/osclib/request_splitter.py +++ b/osclib/request_splitter.py @@ -128,9 +128,6 @@ class RequestSplitter(object): target.set('devel_project', devel) StrategySuper.supplement(request) - if target_project == self.api.cnonfree: - target.set('nonfree', 'nonfree') - ring = self.ring_get(target_package) if ring: target.set('ring', ring) diff --git a/osclib/stagingapi.py b/osclib/stagingapi.py index a9cc42fd..93dc5585 100644 --- a/osclib/stagingapi.py +++ b/osclib/stagingapi.py @@ -139,6 +139,13 @@ class StagingAPI(object): def packages_staged(self, value): raise Exception("setting packages_staged is not allowed") + @property + def use_images(self): + # Determine if staging is bootstrapped. + meta = self.get_prj_meta(self.project) + xpath = 'repository[@name="images"]' + return len(meta.xpath(xpath)) > 0 + def makeurl(self, l, query=None): """ Wrapper around osc's makeurl passing our apiurl @@ -565,7 +572,7 @@ class StagingAPI(object): http_DELETE(url, data=ET.tostring(root)) @memoize(session=True, add_invalidate=True) - def get_open_requests(self, query_extra=None, include_nonfree=True): + def get_open_requests(self, query_extra=None): """ Get all requests with open review for staging project that are not yet included in any staging project @@ -577,8 +584,6 @@ class StagingAPI(object): # xpath query, using the -m, -r, -s options where = "@by_group='{}' and @state='new'".format(self.cstaging_group) projects = [format(self.project)] - if include_nonfree and self.cnonfree: - projects.append(self.cnonfree) targets = ["target[@project='{}']".format(p) for p in projects] query = {'match': "state/@name='review' and review[{}] and ({})".format( @@ -1381,7 +1386,7 @@ class StagingAPI(object): l = ET.tostring(flink) http_PUT(url, data=l) - def create_adi_project(self, name, use_frozenlinks=False, src_prj=None, nonfree=False): + def create_adi_project(self, name, use_frozenlinks=False, src_prj=None): """Create an ADI project.""" if not name: name = self._candidate_adi_project() @@ -1399,36 +1404,35 @@ class StagingAPI(object): linkproject = '' repository = '' - if nonfree: - nonfree_path = "".format(self.cnonfree) + if self.use_images: + images_repo = f""" + + + + x86_64 + """ else: - nonfree_path = '' + images_repo = '' - meta = """ - + meta = f""" + - {3} - /project/staging_projects/{1}/adi:{2} + {linkproject} + /project/staging_projects/{self.project}/adi:{self.extract_adi_number(name)} - {4} - {6} - - + {repository} + + x86_64 - - - - x86_64 - - """.format(name, self.project, self.extract_adi_number(name), linkproject, repository, - self.cstaging, nonfree_path) + {images_repo} + """ url = make_meta_url('prj', name, self.apiurl) http_PUT(url, data=meta) diff --git a/tests/config_tests.py b/tests/config_tests.py index 4c5ae139..68e3b4b6 100644 --- a/tests/config_tests.py +++ b/tests/config_tests.py @@ -45,9 +45,10 @@ class TestConfig(unittest.TestCase): projects = ( 'openSUSE:Factory', 'openSUSE:Factory:ARM', - 'openSUSE:Leap:15.1', - 'openSUSE:Leap:15.1:ARM', - 'openSUSE:Leap:15.1:Update', + 'openSUSE:Leap:15.2', + 'openSUSE:Leap:15.2:ARM', + 'openSUSE:Leap:15.2:NonFree', + 'openSUSE:Leap:15.2:Update', 'openSUSE:Backports:SLE-15', 'openSUSE:Backports:SLE-15:Update', 'SUSE:SLE-15:GA',