From 9040f7b6c2023ead4eff134e35a9ba3c128dd762 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Mon, 9 Jul 2012 14:56:43 +0800 Subject: [PATCH] ask user to input remote build server first while creating conf remote build server should be asked input first, then user/pass. Do not need show user to use default values. fix # 113 --- gitbuildsys/conf.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/gitbuildsys/conf.py b/gitbuildsys/conf.py index 6b63e93..dff6b74 100644 --- a/gitbuildsys/conf.py +++ b/gitbuildsys/conf.py @@ -330,27 +330,28 @@ distconf = $build__distconf if not fpath: fpath = os.path.expanduser('~/.gbs.conf') - if msger.ask('Create config file %s using default values?' % fpath): - import getpass - - # user and passwd in [build] section need user input - defaults = self.DEFAULTS.copy() - 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')) - - with open(fpath, 'w') as wfile: - wfile.write(self.get_default_conf(defaults)) - os.chmod(fpath, 0600) - - msger.info('Done. Your gbs config is now located at %s' % fpath) - msger.warning("Don't forget to double-check the config manually.") - return True - - return False + import getpass + msger.info('Creating config file %s ... ' % fpath) + # user and passwd in [build] section need user input + defaults = self.DEFAULTS.copy() + build_server = raw_input('Remote build server url (use %s by default):'\ + % defaults['remotebuild']['build_server']) + 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')) + + with open(fpath, 'w') as wfile: + wfile.write(self.get_default_conf(defaults)) + os.chmod(fpath, 0600) + + msger.info('Done. Your gbs config is now located at %s' % fpath) + msger.warning("Don't forget to double-check the config manually.") + return True def _check_passwd(self): for sec in self.DEFAULTS.keys(): -- 2.7.4