From d4b4182220c627fcd9be5a99624d076dd57f6cfc Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Sun, 30 Jan 2011 16:38:11 +0100 Subject: [PATCH] - parse_repoarchdescr: use similar build descr "guessing" mechanism like bs_srcserver (but it still differs) --- osc/commandline.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 701ddb48..31f834d7 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -4226,12 +4226,19 @@ Please submit there instead, or use --nodevelproject to force direct submission. elif not arg_descr: msg = None if len(descr) > 1: - # prefer build descr that match the directory name - # only if there are no other build descrs of different build types - for ext in ['.spec', '.dsc', '.kiwi']: - spec = os.path.basename(os.getcwd()) + ext - if spec in descr and not [i for i in descr if not i.endswith(ext)]: - arg_descr = spec + # guess/prefer build descrs like the following: + # -. > . + pac = os.path.basename(os.getcwd()) + if is_package_dir(os.getcwd()): + pac = store_read_package(os.getcwd()) + extensions = ['spec', 'dsc', 'kiwi'] + cands = [i for i in descr for ext in extensions if i == '%s-%s.%s' % (pac, arg_repository, ext)] + if len(cands) == 1: + arg_descr = cands[0] + else: + cands = [i for i in descr for ext in extensions if i == '%s.%s' % (pac, ext)] + if len(cands) == 1: + arg_descr = cands[0] if not arg_descr: msg = 'Multiple build description files found: %s' % ', '.join(descr) elif not ignore_descr: