From d85d38f613c9cf183d2f3b6e75cd8cec91e3d433 Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Thu, 11 Jun 2009 11:32:58 +0000 Subject: [PATCH] smarter default platform for osc build --- NEWS | 3 +++ osc/commandline.py | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4eda9366..14895992 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,9 @@ - request list -M shows open SRs created by the user. - Fixed build support for images, only refered packages from buildinfo get used. (#485047) - "req" command got renamed to "api" to avoid clash with "request" command +- osc build has a smarter default platform selection - it checks the + availibility config value, 'standard' and 'opensuse_Factory' in platforms list and in case + of fail it uses the last entry from that list 0.117: - support checkout of single package via "osc co PACKAGE" when local dir is project diff --git a/osc/commandline.py b/osc/commandline.py index 29498d2e..ee0b09e4 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2249,7 +2249,24 @@ Please submit there instead, or use --nodevelproject to force direct submission. arg_platform, arg_arch, arg_descr = args arg_arch = arg_arch or osc.build.hostarch - arg_platform = arg_platform or conf.config['build_platform'] + + platforms = get_platforms_of_project( \ + store_read_apiurl('.'), \ + opts.alternative_project or store_read_project('.')) + if not arg_platform: + + # Use a default value from config, but just even if it's available + # unless try standard, or openSUSE_Factory + for platform in (conf.config['build_platform'], 'standard', 'openSUSE_Factory'): + if platform in platforms: + arg_platform = platform + break + + arg_platform = arg_platform or platforms[len(platforms)-1] + + if not arg_platform in platforms: + raise oscerr.WrongArgs('%s is not a valid platform, use one of: %s' % (arg_platform, ", ".join(platforms))) + descr = [ i for i in os.listdir('.') if i.endswith('.spec') or i.endswith('.dsc') ] # FIXME: # * request repos from server and select by build type.