From 796b4eed97905483747c93c9cb62a7bac06977c5 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Wed, 11 Jul 2012 07:23:25 +0800 Subject: [PATCH] Allow empty user in gbs conf empty user is allowed while initialize gbs.conf,and give warn in remotebuild sub-command if user is empty. --- gitbuildsys/cmd_remotebuild.py | 4 ++++ gitbuildsys/conf.py | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gitbuildsys/cmd_remotebuild.py b/gitbuildsys/cmd_remotebuild.py index 28824ea..7ff5e86 100644 --- a/gitbuildsys/cmd_remotebuild.py +++ b/gitbuildsys/cmd_remotebuild.py @@ -72,6 +72,10 @@ def do(opts, args): else: msger.error('Invalid arguments, see gbs remotebuild -h for more info') + if not USER: + msger.error('empty user is not allowed for remotebuild, '\ + 'please add user/passwd to gbs conf, and try again') + try: repo = repository.GitRepository(workdir) if opts.commit: diff --git a/gitbuildsys/conf.py b/gitbuildsys/conf.py index dff6b74..5792954 100644 --- a/gitbuildsys/conf.py +++ b/gitbuildsys/conf.py @@ -231,7 +231,6 @@ class ConfigMgr(object): 'build_server': 'https://api.tizen.org', 'user': 'my_user_id', 'passwd': '', - 'passwdx': '', }, 'build': { 'build_cmd': '/usr/bin/build', @@ -249,7 +248,7 @@ editor = $general__editor ; settings for build subcommand build_server = $remotebuild__build_server user = $remotebuild__user -passwdx = $remotebuild__passwdx +passwd = $remotebuild__passwd [build] build_cmd = $build__build_cmd @@ -339,11 +338,12 @@ distconf = $build__distconf if build_server: defaults['remotebuild']['build_server'] = build_server defaults['remotebuild']['user'] = \ - raw_input('Username for remote build server: ') - msger.info('Your password will be encoded before saving ...') - defaults['remotebuild']['passwd'] = '' - defaults['remotebuild']['passwdx'] = \ - base64.b64encode(getpass.getpass().encode('bz2')) + raw_input('Username for remote build server '\ + '(type to skip): ') + if defaults['remotebuild']['user']: + msger.info('Your password will be encoded before saving ...') + defaults['remotebuild']['passwdx'] = \ + base64.b64encode(getpass.getpass().encode('bz2')) with open(fpath, 'w') as wfile: wfile.write(self.get_default_conf(defaults)) -- 2.7.4