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')
@cmdln.option('-v', '--version', action='store_true',
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):
"""${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 freeze PROJECT...
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...
"""
if opts.version:
@ -159,7 +161,8 @@ def do_staging(self, subcmd, opts, *args):
if opts.add:
api.mark_additional_packages(tprj, [opts.add])
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':
CleanupRings(api).perform()
elif cmd == 'list':

View File

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

View File

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

View File

@ -103,7 +103,8 @@ class SelectCommand(object):
else:
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
: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 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')
return False
# FreezeCommand(self.api).perform(target_project)

View File

@ -398,6 +398,7 @@ class StagingAPI(object):
requests = self.get_open_requests()
# check if we can reduce it down by accepting some
for rq in requests:
if self.crings:
self.accept_non_ring_request(rq)
self.update_superseded_request(rq)
@ -734,7 +735,7 @@ class StagingAPI(object):
# The force_enable_build will avoid the
# map_ring_package_to_subproject
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
else:
project = self.map_ring_package_to_subject(project, tar_pkg)
@ -910,7 +911,7 @@ class StagingAPI(object):
for request in meta['requests']:
staged_requests.append(request['id'])
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'
self.build_switch_prj(target_project, target_flag)