From 50cc140c3bf9bd75ad313d2db4d9b2785c5b376d Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Tue, 14 Aug 2012 20:50:17 +0800 Subject: [PATCH] hotfix: add clean_repos_userinfo to hide repos useinfo --- gitbuildsys/cmd_build.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gitbuildsys/cmd_build.py b/gitbuildsys/cmd_build.py index cac8960..1024ba5 100644 --- a/gitbuildsys/cmd_build.py +++ b/gitbuildsys/cmd_build.py @@ -239,6 +239,22 @@ def get_repos_conf(): return result +def clean_repos_userinfo(repos): + striped_repos = [] + for repo in repos: + splitted = urlsplit(repo) + if not splitted.username: + striped_repos.append(repo) + else: + splitted_list = list(splitted) + if splitted.port: + splitted_list[1] = '%s:%d' % (splitted.hostname, splitted.port) + else: + splitted_list[1] = splitted.hostname + striped_repos.append(urlunsplit(splitted_list)) + + return striped_repos + def do(opts, args): workdir = os.getcwd() @@ -323,7 +339,7 @@ def do(opts, args): if not repourls: msger.error('no repositories found for arch: %s under the '\ 'following repos:\n %s' % \ - (buildarch, '\n'.join(repos))) + (buildarch, '\n'.join(clean_repos_userinfo(repos)))) for url in repourls: if not re.match('https?://.*', url) and \ not (url.startswith('/') and os.path.exists(url)): -- 2.7.4