diff --git a/net-misc/bcloud/bcloud-3.4.1.ebuild b/net-misc/bcloud/bcloud-3.4.1-r1.ebuild similarity index 88% rename from net-misc/bcloud/bcloud-3.4.1.ebuild rename to net-misc/bcloud/bcloud-3.4.1-r1.ebuild index 3bd8b03aa5..ca4721f7b5 100644 --- a/net-misc/bcloud/bcloud-3.4.1.ebuild +++ b/net-misc/bcloud/bcloud-3.4.1-r1.ebuild @@ -24,13 +24,17 @@ RDEPEND="${DEPEND} dev-python/cssselect x11-themes/gnome-icon-theme-symbolic dev-python/dbus-python[${PYTHON_USEDEP}] - dev-python/keyring[${PYTHON_USEDEP}] + dev-python/keyring[${PYTHON_USEDEP}] dev-python/pycrypto[${PYTHON_USEDEP}] x11-libs/libnotify " +src_prepare() { + epatch "${FILESDIR}"/${P}-fix-vcodestr.patch +} + src_install() { python_foreach_impl python_domodule ${PN} dobin bcloud-gui insinto usr doins -r share -} \ No newline at end of file +} diff --git a/net-misc/bcloud/files/bcloud-1.4.1-fix-vcodestr.patch b/net-misc/bcloud/files/bcloud-1.4.1-fix-vcodestr.patch new file mode 100644 index 0000000000..25db7da261 --- /dev/null +++ b/net-misc/bcloud/files/bcloud-1.4.1-fix-vcodestr.patch @@ -0,0 +1,89 @@ +From f9034e1643e5a97f4736f2cb5cef86274a9cbe56 Mon Sep 17 00:00:00 2001 +From: LiuLang +Date: Mon, 23 Jun 2014 16:30:30 +0800 +Subject: [PATCH] Fixed: failed to check vcodestr + +--- + bcloud/SigninDialog.py | 6 ++++-- + bcloud/auth.py | 10 ++++------ + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/bcloud/SigninDialog.py b/bcloud/SigninDialog.py +index 21d157f..4c91c19 100644 +--- a/bcloud/SigninDialog.py ++++ b/bcloud/SigninDialog.py +@@ -54,7 +54,6 @@ def __init__(self, parent, cookie, form): + + def update_img(self, req_data, error=None): + if error or not req_data: +- self.refresh_vcode() + return + vcode_path = os.path.join( + Config.get_tmp_path(self.form['username']), +@@ -250,10 +249,13 @@ def on_get_wap_passport(info, error=None): + form['username'] = username + form['password'] = password + cookie.load_list(cookie_str) +- if 'vcodestr' in form: ++ if len(form.get('vcodestr', '')): + dialog = SigninVcodeDialog(self, cookie, form) + dialog.run() + dialog.destroy() ++ if len(form.get('verifycode', '')) != 4: ++ print('verifycode length is not 4!') ++ return + self.signin_button.set_label(_('Signin...')) + gutil.async_call(auth.wap_signin, cookie, form, + callback=on_wap_signin) +diff --git a/bcloud/auth.py b/bcloud/auth.py +index 01f936b..1bb8d76 100644 +--- a/bcloud/auth.py ++++ b/bcloud/auth.py +@@ -83,7 +83,6 @@ def get_wap_passport(): + + def wap_signin(cookie, form): + '''进行WAP登录认证''' +- print('wap_signin():', cookie, form) + url = 'http://wappass.baidu.com/passport/login' + req = net.urlopen_without_redirect(url, headers={ + 'Cookie': cookie.header_output(), +@@ -98,7 +97,10 @@ def wap_signin(cookie, form): + def get_wap_signin_vcode(cookie, codeString): + '''获取wap登录时的验证码''' + url = 'http://wappass.baidu.com/cgi-bin/genimage?' + codeString +- req = net.urlopen(url, headers={'Cookie': cookie.header_output()}) ++ req = net.urlopen(url, headers={ ++ 'Cookie': cookie.header_output(), ++ 'Referer': 'http://wappass.badu.com', ++ }) + if req: + return req.data + else: +@@ -109,7 +111,6 @@ def refresh_signin_vcode(cookie, token, vcodetype): + + vcodetype - 在调用check_login()时返回的vcodetype. + ''' +- print('refresh_signin_vcode()', cookie, token, vcodetype) + url = ''.join([ + const.PASSPORT_BASE, + 'v2/?reggetcodestr', +@@ -119,11 +120,9 @@ def refresh_signin_vcode(cookie, token, vcodetype): + '&fr=ligin', + '&vcodetype=', vcodetype, + ]) +- print('url:', url) + req = net.urlopen(url, headers={'Cookie': cookie.header_output()}) + if req: + try: +- print('req.data is:', req.data) + return json.loads(req.data.decode('gbk')) + except ValueError as e: + print('Error occurs in refresh_signin_vcode()', e) +@@ -140,7 +139,6 @@ def parse_bdstoken(content): + bdstoken = '' + bds_re = re.compile('BDSTOKEN\s*=\s*"([^"]+)"') + bds_match = bds_re.search(content) +- print('bds match:', bds_match) + if bds_match: + bdstoken = bds_match.group(1) + return bdstoken