cleanup archive import
This commit is contained in:
parent
aae3d4eb7b
commit
63722c56bc
2 changed files with 74 additions and 41 deletions
29
cli/koji
29
cli/koji
|
|
@ -1979,9 +1979,10 @@ def handle_import_archive(options, session, args):
|
|||
parser.add_option("--noprogress", action="store_true",
|
||||
help=_("Do not display progress of the upload"))
|
||||
parser.add_option("--create-build", action="store_true", help=_("Auto-create builds as needed"))
|
||||
parser.add_option("--type", help=_("The type of archive we're importing. Currently supported types: maven"))
|
||||
parser.add_option("--type", help=_("The type of archive being imported. Currently supported types: maven, win"))
|
||||
parser.add_option("--type-info", help=_("Type-specific information to associate with the archives. "
|
||||
"For Maven archives this should be a local path to a .pom file."))
|
||||
"For Maven archives this should be a local path to a .pom file. "
|
||||
"For Windows archives this should be relpath:platforms[:flags]))"))
|
||||
(suboptions, args) = parser.parse_args(args)
|
||||
|
||||
if not len(args) > 1:
|
||||
|
|
@ -2003,14 +2004,30 @@ def handle_import_archive(options, session, args):
|
|||
pom_info = koji.parse_pom(suboptions.type_info)
|
||||
maven_info = koji.pom_to_maven_info(pom_info)
|
||||
suboptions.type_info = maven_info
|
||||
elif suboptions.type == 'win':
|
||||
if not (session.hasPerm('win-import') or session.hasPerm('admin')):
|
||||
parser.error(_("This action requires the win-import privilege"))
|
||||
assert False
|
||||
if not suboptions.type_info:
|
||||
parser.error(_("--type-info must be specified"))
|
||||
assert False
|
||||
type_info = suboptions.type_info.split(':', 2)
|
||||
if len(type_info) < 2:
|
||||
parser.error(_("--type-info must be in relpath:platforms[:flags] format"))
|
||||
win_info = {'relpath': type_info[0], 'platforms': type_info[1].split()}
|
||||
if len(type_info) > 2:
|
||||
win_info['flags'] = type_info[2].split()
|
||||
else:
|
||||
win_info['flags'] = []
|
||||
suboptions.type_info = win_info
|
||||
else:
|
||||
parser.error(_("Unsupported archive type: %s" % suboptions.type))
|
||||
assert False
|
||||
|
||||
needs_create = False
|
||||
|
||||
buildinfo = session.getBuild(arg_filter(args[0]))
|
||||
if not buildinfo:
|
||||
if not suboptions.create_build:
|
||||
parser.error(_("No such build: %s") % args[0])
|
||||
buildinfo = koji.parse_NVR(args[0])
|
||||
if buildinfo['epoch'] == '':
|
||||
buildinfo['epoch'] = None
|
||||
|
|
@ -2019,6 +2036,10 @@ def handle_import_archive(options, session, args):
|
|||
if suboptions.type == 'maven':
|
||||
# --type-info should point to a local .pom file
|
||||
session.createMavenBuild(buildinfo, suboptions.type_info)
|
||||
elif suboptions.type == 'win':
|
||||
# We're importing, so we don't know what platform the build
|
||||
# was run on. Use "import" as a placeholder.
|
||||
session.createWinBuild(buildinfo, {'platform': 'import'})
|
||||
else:
|
||||
# should get caught above
|
||||
assert False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue