Small changes for SLE integration.

This commit is contained in:
Alberto Planas 2015-03-24 14:46:36 +01:00
parent 4e2c63f6eb
commit 8308eaab14
5 changed files with 23 additions and 11 deletions

View File

@ -73,6 +73,8 @@ def _full_project_name(self, project):
help='use the old check algorithm') help='use the old check algorithm')
@cmdln.option('-v', '--version', action='store_true', @cmdln.option('-v', '--version', action='store_true',
help='show version of the plugin') help='show version of the plugin')
@cmdln.option('--no-freeze', dest='no_freeze', action='store_true',
help='force the select command ignoring the time from the last freeze')
def do_staging(self, subcmd, opts, *args): def do_staging(self, subcmd, opts, *args):
"""${cmd_name}: Commands to work with staging projects """${cmd_name}: Commands to work with staging projects
@ -99,7 +101,7 @@ def do_staging(self, subcmd, opts, *args):
osc staging cleanup_rings osc staging cleanup_rings
osc staging freeze PROJECT... osc staging freeze PROJECT...
osc staging list osc staging list
osc staging select [--move [--from PROJECT]] LETTER REQUEST... osc staging select [--no-freeze] [--move [--from PROJECT]] LETTER REQUEST...
osc staging unselect REQUEST... osc staging unselect REQUEST...
""" """
if opts.version: if opts.version:
@ -159,7 +161,8 @@ def do_staging(self, subcmd, opts, *args):
if opts.add: if opts.add:
api.mark_additional_packages(tprj, [opts.add]) api.mark_additional_packages(tprj, [opts.add])
else: else:
SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_) SelectCommand(api).perform(tprj, args[2:], opts.move,
opts.from_, opts.no_freeze)
elif cmd == 'cleanup_rings': elif cmd == 'cleanup_rings':
CleanupRings(api).perform() CleanupRings(api).perform()
elif cmd == 'list': elif cmd == 'list':

View File

@ -41,9 +41,9 @@ DEFAULT = {
'lock': 'openSUSE:%(project)s:Staging', 'lock': 'openSUSE:%(project)s:Staging',
'lock-ns': 'openSUSE', 'lock-ns': 'openSUSE',
}, },
r'SUSE:(?P<project>[-\w\d]+)': { r'SUSE:(?P<project>.*$)': {
'staging': 'SUSE:%(project)s:Staging', 'staging': 'SUSE:%(project)s:Staging',
'staging-group': '%(project.lower)s-staging', 'staging-group': 'sle-staging-managers', # '%(project.lower)s-staging',
'rings': None, 'rings': None,
'nonfree': None, 'nonfree': None,
'rebuild': None, 'rebuild': None,

View File

@ -29,7 +29,14 @@ class ListCommand:
# Where are we targeting the package # Where are we targeting the package
target_package = action.find('target').get('package') target_package = action.find('target').get('package')
ring = self.api.ring_packages.get(target_package) # If the system have rings, we ask for the ring of the
# This condition is quite moot as we dispatched stuff above anyway # package
if self.api.crings:
ring = self.api.ring_packages.get(target_package)
else:
ring = self.api.project
# This condition is quite moot as we dispatched stuff
# above anyway
if ring: if ring:
print('Request({}): {} -> {}'.format(request_id, target_package, ring)) print('Request({}): {} -> {}'.format(request_id, target_package, ring))

View File

@ -103,7 +103,8 @@ class SelectCommand(object):
else: else:
raise oscerr.WrongArgs('Arguments for select are not correct.') raise oscerr.WrongArgs('Arguments for select are not correct.')
def perform(self, target_project, requests, move=False, from_=None): def perform(self, target_project, requests, move=False,
from_=None, no_freeze=False):
""" """
Select package and move it accordingly by arguments Select package and move it accordingly by arguments
:param target_project: project we want to target :param target_project: project we want to target
@ -113,7 +114,7 @@ class SelectCommand(object):
""" """
# If the project is not frozen enough yet freeze it # If the project is not frozen enough yet freeze it
if not self.api.prj_frozen_enough(target_project): if not (no_freeze or self.api.prj_frozen_enough(target_project)):
print('Freeze the prj first') print('Freeze the prj first')
return False return False
# FreezeCommand(self.api).perform(target_project) # FreezeCommand(self.api).perform(target_project)

View File

@ -398,7 +398,8 @@ class StagingAPI(object):
requests = self.get_open_requests() requests = self.get_open_requests()
# check if we can reduce it down by accepting some # check if we can reduce it down by accepting some
for rq in requests: for rq in requests:
self.accept_non_ring_request(rq) if self.crings:
self.accept_non_ring_request(rq)
self.update_superseded_request(rq) self.update_superseded_request(rq)
def get_prj_pseudometa(self, project): def get_prj_pseudometa(self, project):
@ -734,7 +735,7 @@ class StagingAPI(object):
# The force_enable_build will avoid the # The force_enable_build will avoid the
# map_ring_package_to_subproject # map_ring_package_to_subproject
if not force_enable_build: if not force_enable_build:
if not self.ring_packages.get(tar_pkg): if self.crings and not self.ring_packages.get(tar_pkg):
disable_build = True disable_build = True
else: else:
project = self.map_ring_package_to_subject(project, tar_pkg) project = self.map_ring_package_to_subject(project, tar_pkg)
@ -910,7 +911,7 @@ class StagingAPI(object):
for request in meta['requests']: for request in meta['requests']:
staged_requests.append(request['id']) staged_requests.append(request['id'])
target_flag = 'disable' target_flag = 'disable'
if self.check_ring_packages(target_project, staged_requests): if not self.crings or self.check_ring_packages(target_project, staged_requests):
target_flag = 'enable' target_flag = 'enable'
self.build_switch_prj(target_project, target_flag) self.build_switch_prj(target_project, target_flag)