diff --git a/osc/commandline.py b/osc/commandline.py index 6e59ba62..07e5cb27 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -3222,30 +3222,22 @@ Please submit there instead, or use --nodevelproject to force direct submission. arg_arch = arg_arch or osc.build.hostarch if not opts.noinit: - repositories = get_repositories_of_project( \ - store_read_apiurl('.'), \ - opts.alternative_project or store_read_project('.')) + project = opts.alternative_project or store_read_project('.') + repositories = get_repositories_of_project(store_read_apiurl('.'), project) + if not len(repositories): + raise oscerr.WrongArgs('no repositories defined for project \'%s\'' % project) if not arg_repository: - - if len(repositories) == 0: - arg_repository = conf.config['build_repository'] - - else: - - # Use a default value from config, but just even if it's available - # unless try standard, or openSUSE_Factory - for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'): - if repository in repositories: - arg_repository = repository - break - - arg_repository = arg_repository or repositories[len(repositories)-1] - + # Use a default value from config, but just even if it's available + # unless try standard, or openSUSE_Factory + arg_repository = repositories[-1] + for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'): + if repository in repositories: + arg_repository = repository + break if not arg_repository in repositories: - raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ", ".join(repositories))) - - if not arg_repository: - raise oscerr.WrongArgs('please specify a repository') + raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ', '.join(repositories))) + elif not arg_repository: + raise oscerr.WrongArgs('please specify a repository') # check for source services if os.listdir('.').count("_service"):