1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 06:46:13 +01:00

- support "addcontainers" command

This commit is contained in:
Adrian Schröter 2018-04-27 09:15:48 +02:00
parent d756f56af2
commit 628f7e2cf5
2 changed files with 36 additions and 0 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
0.163
- add sendsysrq command (requires OBS 2.10)
- add addcontainers command (requires OBS 2.10)
- add new options to diff command:
--unexpand for local diffs only (bsc#1089025)
--meta for diffing meta files

View File

@ -449,6 +449,41 @@ class Osc(cmdln.Cmdln):
return 1
@cmdln.option('--extend-package-names', default=False, action="store_true",
help='Extend packages names with project name as suffix')
def do_addcontainers(self, subcmd, opts, *args):
"""${cmd_name}: Add maintained containers for a give package
The command adds all containers which are marked as maitained and contain
an rpm out of the specified source package.
Examples:
osc addcontainers [PROJECT PACKAGE]
${cmd_option_list}
"""
apiurl = self.get_api_url()
localdir = os.getcwd()
project = package = None
if not args:
if is_package_dir(localdir):
project = store_read_project(localdir)
package = store_read_package(localdir)
else:
project = args[0]
package = args[1]
if project == None or package == None:
raise oscerr.WrongArgs('Either specify project and package or call it from a package working copy')
query = {'cmd': 'addcontainers'}
if opts.extend_package_names:
query['extend_package_names'] = '1'
print("Add containers...")
url = makeurl(apiurl, ['source', project, package], query=query)
f = http_POST(url)
@cmdln.option('-s', '--skip-disabled', action='store_true',
help='Skip disabled channels. Otherwise the source gets added, but not the repositories.')
@cmdln.option('-e', '--enable-all', action='store_true',