Remove config command - the config isn't used any more
The only use case left is displaying 'todo' config on accept - but staging managers don't use this. So we may need a different solution later
This commit is contained in:
parent
dd9b7ec84f
commit
9235ab50db
@ -23,7 +23,6 @@ from osclib.check_command import CheckCommand
|
|||||||
from osclib.check_duplicate_binaries_command import CheckDuplicateBinariesCommand
|
from osclib.check_duplicate_binaries_command import CheckDuplicateBinariesCommand
|
||||||
from osclib.cleanup_rings import CleanupRings
|
from osclib.cleanup_rings import CleanupRings
|
||||||
from osclib.conf import Config
|
from osclib.conf import Config
|
||||||
from osclib.config_command import ConfigCommand
|
|
||||||
from osclib.freeze_command import FreezeCommand
|
from osclib.freeze_command import FreezeCommand
|
||||||
from osclib.ignore_command import IgnoreCommand
|
from osclib.ignore_command import IgnoreCommand
|
||||||
from osclib.unignore_command import UnignoreCommand
|
from osclib.unignore_command import UnignoreCommand
|
||||||
@ -122,8 +121,6 @@ def clean_args(args):
|
|||||||
@cmdln.option('--strategy', help='apply a specific strategy')
|
@cmdln.option('--strategy', help='apply a specific strategy')
|
||||||
@cmdln.option('--no-color', action='store_true', help='strip colors from output (or add staging.color = 0 to the .oscrc general section')
|
@cmdln.option('--no-color', action='store_true', help='strip colors from output (or add staging.color = 0 to the .oscrc general section')
|
||||||
@cmdln.option('--save', action='store_true', help='save the result to the pseudometa package')
|
@cmdln.option('--save', action='store_true', help='save the result to the pseudometa package')
|
||||||
@cmdln.option('--append', action='store_true', help='append to existing value')
|
|
||||||
@cmdln.option('--clear', action='store_true', help='clear value')
|
|
||||||
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
|
||||||
|
|
||||||
@ -144,35 +141,6 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
|
|
||||||
"check_duplicate_binaries" list binaries provided by multiple packages
|
"check_duplicate_binaries" list binaries provided by multiple packages
|
||||||
|
|
||||||
"config" will modify or view staging specific configuration
|
|
||||||
|
|
||||||
Target project OSRT:Config attribute configuration applies to all
|
|
||||||
stagings. Both configuration locations follow the .oscrc format (space
|
|
||||||
separated list).
|
|
||||||
|
|
||||||
config
|
|
||||||
Print all staging configuration.
|
|
||||||
config key
|
|
||||||
Print the value of key for stagings.
|
|
||||||
conf key value...
|
|
||||||
Set the value of key for stagings.
|
|
||||||
config --clear
|
|
||||||
Clear all staging configuration.
|
|
||||||
config --clear key
|
|
||||||
Clear (unset) a single key from staging configuration
|
|
||||||
config --append key value...
|
|
||||||
Append value to existing value or set if no existing value.
|
|
||||||
|
|
||||||
All of the above may be restricted to a set of stagings.
|
|
||||||
|
|
||||||
The staging configuration is automatically cleared anytime staging
|
|
||||||
psuedometa is cleared (accept, or unstage all requests).
|
|
||||||
|
|
||||||
The keys that may be set in staging configuration are:
|
|
||||||
|
|
||||||
- repo_checker-binary-whitelist[-arch]: appended to target project list
|
|
||||||
- todo: text to be printed after staging is accepted
|
|
||||||
|
|
||||||
"cleanup_rings" will try to cleanup rings content and print
|
"cleanup_rings" will try to cleanup rings content and print
|
||||||
out problems
|
out problems
|
||||||
|
|
||||||
@ -332,7 +300,6 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
osc staging adi [--move] [--by-develproject] [--split] [REQUEST...]
|
osc staging adi [--move] [--by-develproject] [--split] [REQUEST...]
|
||||||
osc staging check [STAGING...]
|
osc staging check [STAGING...]
|
||||||
osc staging check_duplicate_binaries
|
osc staging check_duplicate_binaries
|
||||||
osc staging config [--append] [--clear] [STAGING...] [key] [value]
|
|
||||||
osc staging cleanup_rings
|
osc staging cleanup_rings
|
||||||
osc staging freeze [--no-bootstrap] STAGING...
|
osc staging freeze [--no-bootstrap] STAGING...
|
||||||
osc staging frozenage [STAGING...]
|
osc staging frozenage [STAGING...]
|
||||||
@ -442,25 +409,6 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
print()
|
print()
|
||||||
elif cmd == 'check_duplicate_binaries':
|
elif cmd == 'check_duplicate_binaries':
|
||||||
CheckDuplicateBinariesCommand(api).perform(opts.save)
|
CheckDuplicateBinariesCommand(api).perform(opts.save)
|
||||||
elif cmd == 'config':
|
|
||||||
projects = set()
|
|
||||||
key = value = None
|
|
||||||
stagings = api.get_staging_projects_short(None) + \
|
|
||||||
api.get_staging_projects()
|
|
||||||
for arg in args[1:]:
|
|
||||||
if arg in stagings:
|
|
||||||
projects.add(api.prj_from_short(arg))
|
|
||||||
elif key is None:
|
|
||||||
key = arg
|
|
||||||
elif value is None:
|
|
||||||
value = arg
|
|
||||||
else:
|
|
||||||
value += ' ' + arg
|
|
||||||
|
|
||||||
if not len(projects):
|
|
||||||
projects = api.get_staging_projects()
|
|
||||||
|
|
||||||
ConfigCommand(api).perform(projects, key, value, opts.append, opts.clear)
|
|
||||||
elif cmd == 'freeze':
|
elif cmd == 'freeze':
|
||||||
for prj in args[1:]:
|
for prj in args[1:]:
|
||||||
prj = api.prj_from_short(prj)
|
prj = api.prj_from_short(prj)
|
||||||
|
@ -13,7 +13,6 @@ from osc.core import change_request_state, show_package_meta, wipebinaries
|
|||||||
from osc.core import http_GET, http_PUT, http_DELETE, http_POST
|
from osc.core import http_GET, http_PUT, http_DELETE, http_POST
|
||||||
from osc.core import delete_package, search, set_devel_project
|
from osc.core import delete_package, search, set_devel_project
|
||||||
from osc.util.helper import decode_it
|
from osc.util.helper import decode_it
|
||||||
from osclib.config_command import ConfigCommand
|
|
||||||
from osclib.core import attribute_value_save
|
from osclib.core import attribute_value_save
|
||||||
from osclib.core import attribute_value_load
|
from osclib.core import attribute_value_load
|
||||||
from osclib.core import source_file_load
|
from osclib.core import source_file_load
|
||||||
@ -98,7 +97,6 @@ class AcceptCommand(object):
|
|||||||
|
|
||||||
self.api.accept_status_comment(project, packages)
|
self.api.accept_status_comment(project, packages)
|
||||||
self.api.staging_deactivate(project)
|
self.api.staging_deactivate(project)
|
||||||
ConfigCommand(self.api).perform([project], 'todo')
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
class ConfigCommand(object):
|
|
||||||
def __init__(self, api):
|
|
||||||
self.api = api
|
|
||||||
|
|
||||||
def perform(self, projects, key=None, value=None, append=False, clear=False):
|
|
||||||
project_max_format = '{:<' + str(len(max(projects, key=len))) + '} {}'
|
|
||||||
for project in projects:
|
|
||||||
meta = self.api.get_prj_pseudometa(project)
|
|
||||||
meta.setdefault('config', {})
|
|
||||||
|
|
||||||
if clear:
|
|
||||||
if key:
|
|
||||||
meta['config'].pop(key, None)
|
|
||||||
else:
|
|
||||||
meta.pop('config', None)
|
|
||||||
self.api.set_prj_pseudometa(project, meta)
|
|
||||||
elif value:
|
|
||||||
value_project = value
|
|
||||||
if append:
|
|
||||||
value_project = ' '.join([meta['config'].get(key, ''), value_project.strip()])
|
|
||||||
meta['config'][key] = value_project.strip()
|
|
||||||
self.api.set_prj_pseudometa(project, meta)
|
|
||||||
|
|
||||||
keys = [key] if key else meta.get('config', {}).keys()
|
|
||||||
for key_print in keys:
|
|
||||||
print('{} = {}'.format(
|
|
||||||
project_max_format.format(project, key_print) if len(projects) > 1 else key_print,
|
|
||||||
meta['config'].get(key_print)))
|
|
@ -1,4 +1,3 @@
|
|||||||
from osclib.config_command import ConfigCommand
|
|
||||||
from osclib.core import source_file_load
|
from osclib.core import source_file_load
|
||||||
from osclib.core import source_file_save
|
from osclib.core import source_file_save
|
||||||
import time
|
import time
|
||||||
@ -110,9 +109,6 @@ class FreezeCommand(object):
|
|||||||
def perform(self, prj, copy_bootstrap=True):
|
def perform(self, prj, copy_bootstrap=True):
|
||||||
self.prj = prj
|
self.prj = prj
|
||||||
|
|
||||||
# Depending on what eventually lives in config this may need to change.
|
|
||||||
ConfigCommand(self.api).perform([prj], clear=True)
|
|
||||||
|
|
||||||
if self.api.is_adi_project(prj):
|
if self.api.is_adi_project(prj):
|
||||||
src_prj = self.api.find_devel_project_from_adi_frozenlinks(self.prj)
|
src_prj = self.api.find_devel_project_from_adi_frozenlinks(self.prj)
|
||||||
if src_prj is None:
|
if src_prj is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user