Remove nonfree handling

Prepare NonFree as onlyadi project, so it can have its own staging workflow
This commit is contained in:
Stephan Kulow 2019-11-21 13:42:19 +01:00
parent 85d7441df8
commit 529c5623a6
8 changed files with 41 additions and 45 deletions

View File

@ -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<project>[\d.]+)$'] = osclib.conf.DEFAULT[
r'openSUSE:(?P<project>Leap:(?P<version>[\d.]+))(?::NonFree)?$']
r'openSUSE:(?P<project>Leap:(?P<version>[\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

View File

@ -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

View File

@ -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'])))

View File

@ -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

View File

@ -19,13 +19,12 @@ from osclib.memoize import memoize
# the project.
DEFAULT = {
r'openSUSE:(?P<project>Factory)(?::NonFree)?$': {
r'openSUSE:(?P<project>Factory)?$': {
'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 <dmueller@suse.com>',
'mail-noreply': 'noreply@opensuse.org',
},
r'openSUSE:(?P<project>Leap:(?P<version>[\d.]+))(?::NonFree)?$': {
r'openSUSE:(?P<project>.*:NonFree)$': {
'staging': 'openSUSE:%(project)s:Staging',
'staging-group': 'factory-staging',
'onlyadi': 'True',
},
r'openSUSE:(?P<project>Leap:(?P<version>[\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 <dmueller@suse.com>',
'mail-noreply': 'noreply@opensuse.org',
},
r'openSUSE:(?P<project>Leap:(?P<version>[\d.]+)(?::NonFree)?:Update)$': {
r'openSUSE:(?P<project>Leap:(?P<version>[\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': '',

View File

@ -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)

View File

@ -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 = '<repository name="standard">'
if nonfree:
nonfree_path = "<path project=\"{}\" repository=\"standard\"/>".format(self.cnonfree)
if self.use_images:
images_repo = f"""
<repository name="images">
<path project="{name}" repository="standard"/>
<path project="{self.project}" repository="images"/>
<arch>x86_64</arch>
</repository>"""
else:
nonfree_path = ''
images_repo = ''
meta = """
<project name="{0}">
meta = f"""
<project name="{name}">
<title></title>
<description></description>
{3}
<url>/project/staging_projects/{1}/adi:{2}</url>
{linkproject}
<url>/project/staging_projects/{self.project}/adi:{self.extract_adi_number(name)}</url>
<publish>
<disable/>
</publish>
<debuginfo>
<enable/>
</debuginfo>
{4}
{6}
<path project="{5}" repository="standard"/>
<path project="{1}" repository="standard"/>
{repository}
<path project="{self.cstaging}" repository="standard"/>
<path project="{self.project}" repository="standard"/>
<arch>x86_64</arch>
</repository>
<repository name="images">
<path project="{0}" repository="standard"/>
<path project="{1}" repository="images"/>
<arch>x86_64</arch>
</repository>
</project>""".format(name, self.project, self.extract_adi_number(name), linkproject, repository,
self.cstaging, nonfree_path)
{images_repo}
</project>"""
url = make_meta_url('prj', name, self.apiurl)
http_PUT(url, data=meta)

View File

@ -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',