[opensuse-buildservice] [PATCH] RFC: read platfrom from BS
Hi, current behavior of osc build is confusing as a default build platform is reads from ~/.oscrc, even if this is a attribute of a project. So in many cases user get a confising wrong repo/arch error message. This patch reads the platform list from BS and uses the last one as a default one. It also brings a better help message, if user type a wrong platform. This makes the conf.config['build_platform'] obsoleted. Index: osc/commandline.py =================================================================== --- osc/commandline.py (revision 7508) +++ osc/commandline.py (working copy) @@ -2249,7 +2249,11 @@ 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('.')) + 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. What do you think about it? Regards Michal Vyskocil -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am Montag, 8. Juni 2009 10:26:24 schrieb Michal Vyskocil:
Hi,
current behavior of osc build is confusing as a default build platform is reads from ~/.oscrc, even if this is a attribute of a project. So in many cases user get a confising wrong repo/arch error message.
This patch reads the platform list from BS and uses the last one as a default one. It also brings a better help message, if user type a wrong platform. This makes the conf.config['build_platform'] obsoleted.
Index: osc/commandline.py =================================================================== --- osc/commandline.py (revision 7508) +++ osc/commandline.py (working copy) @@ -2249,7 +2249,11 @@ 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('.')) + 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.
What do you think about it?
Yes, that is the right way to go ! Please submit :) bye adrina -- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On Monday 15 of June 2009 11:29:20 you wrote:
Am Montag, 8. Juni 2009 10:26:24 schrieb Michal Vyskocil:
Hi,
current behavior of osc build is confusing as a default build platform is reads from ~/.oscrc, even if this is a attribute of a project. So in many cases user get a confising wrong repo/arch error message.
This patch reads the platform list from BS and uses the last one as a default one. It also brings a better help message, if user type a wrong platform. This makes the conf.config['build_platform'] obsoleted.
Index: osc/commandline.py =================================================================== --- osc/commandline.py (revision 7508) +++ osc/commandline.py (working copy) @@ -2249,7 +2249,11 @@ 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('.')) + 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.
What do you think about it?
Yes, that is the right way to go !
Please submit :)
I have submitted a modified version, it try to use a value from conf.config['build_platform'], 'standard', 'openSUSE_Factory' or a last platform in a list as a default, so it might work in every possible situation. Regards Michal Vyskocil -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (2)
-
Adrian Schröter
-
Michal Vyskocil