1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-27 16:48:54 +02:00

- a more generic version of ebd4b1d893 (the same logic applies to *.dsc, *.kiwi)

This commit is contained in:
Marcus Huewe
2010-08-08 23:15:25 +02:00
parent 85d3391bd4
commit b213b9695b

View File

@@ -3920,8 +3920,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# can be implemented using # can be implemented using
# reduce(lambda x, y: x + y, (glob.glob(x) for x in ('*.spec', '*.dsc', '*.kiwi'))) # reduce(lambda x, y: x + y, (glob.glob(x) for x in ('*.spec', '*.dsc', '*.kiwi')))
# but be a bit more readable :) # but be a bit more readable :)
specs = glob.glob('*.spec') descr = glob.glob('*.spec') + glob.glob('*.dsc') + glob.glob('*.kiwi')
descr = specs + glob.glob('*.dsc') + glob.glob('*.kiwi')
# FIXME: # FIXME:
# * request repos from server and select by build type. # * request repos from server and select by build type.
@@ -3930,12 +3929,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
elif not arg_descr: elif not arg_descr:
msg = None msg = None
if len(descr) > 1: if len(descr) > 1:
# prefer spec files that match the directory name # prefer build descr that match the directory name
# only if there are no debian or kiwi files # only if there are no other build descrs of different build types
spec = os.path.basename(os.getcwd())+'.spec' for ext in ['.spec', '.dsc', '.kiwi']:
if spec in specs and len(specs) == len(descr): spec = os.path.basename(os.getcwd()) + ext
arg_descr = spec if spec in descr and not [i for i in descr if not i.endswith(ext)]:
else: arg_descr = spec
if not arg_descr:
msg = 'Multiple build description files found: %s' % ', '.join(descr) msg = 'Multiple build description files found: %s' % ', '.join(descr)
else: else:
msg = 'Missing argument: build description (spec, dsc or kiwi file)' msg = 'Missing argument: build description (spec, dsc or kiwi file)'