From 36e54d749e487a4105744e72d3346e777200ed4c Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Thu, 17 Jul 2008 12:24:35 +0000 Subject: Initially working "submit-groups" code It is possible to specify a group of packages and a revision to be submitted. --- RepSys/commands/submit.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'RepSys/commands') diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py index 334a424..79129f1 100644 --- a/RepSys/commands/submit.py +++ b/RepSys/commands/submit.py @@ -1,7 +1,6 @@ #!/usr/bin/python -from RepSys import Error, config +from RepSys import Error, config, layout from RepSys.command import * -from RepSys.layout import package_url, distro_branch from RepSys.rpmutil import get_spec, get_submit_info from RepSys.util import get_auth, execcmd, get_helper import urllib @@ -21,6 +20,9 @@ The submit host will try to build the package, and upon successful completion will 'tag' the package and upload it to the official repositories. +The package name can refer to an alias to a group of packages defined in +the section submit-groups of the configuration file. + The status of the submit can visualized at: http://kenobi.mandriva.com/bs/output.php @@ -46,6 +48,7 @@ Examples: repsys submit foo@14800 bar baz@11001 repsys submit https://repos/svn/mdv/cooker/foo repsys submit -l https://repos + repsys submit -t 2008.1 my-python-packages@11011 repsys submit --define section=main/testing -t 2008.1 """ @@ -83,13 +86,30 @@ def parse_options(): else: raise Error, "the format is deprecated, "\ "use @ instead" - opts.urls = [package_url(nameurl, mirrored=False) for nameurl in args] + # expand group aliases + expanded = [] + for nameurl in args: + expanded.extend(expand_group(nameurl)) + if expanded != args: + print "Submitting: %s" % " ".join(expanded) + args = expanded + opts.urls = [layout.package_url(nameurl, mirrored=False) for nameurl in args] if opts.target is None: - target = distro_branch(opts.urls[0]) or DEFAULT_TARGET + target = layout.distro_branch(opts.urls[0]) or DEFAULT_TARGET print "Implicit target: %s" % target opts.target = target return opts +def expand_group(group): + name, rev = layout.split_url_revision(group) + found = config.get("submit-groups", name) + packages = [group] + if found: + packages = found.split() + if rev: + packages = [("%s@%s" % package) for package in packages] + return packages + def list_targets(option, opt, val, parser): host = config.get("submit", "host") if host is None: -- cgit v1.2.1