Skip to content

Commit

Permalink
- support "addcontainers" command
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Apr 27, 2018
1 parent d756f56 commit 628f7e2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
@@ -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
Expand Down
35 changes: 35 additions & 0 deletions osc/commandline.py
Expand Up @@ -449,6 +449,41 @@ def do_list(self, subcmd, opts, *args):
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',
Expand Down

0 comments on commit 628f7e2

Please sign in to comment.