1 |
commit: fe71c29eb3c0bd67886482c3cd394945e0b373e9 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 25 06:29:31 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 1 20:51:16 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fe71c29e |
7 |
|
8 |
action_sync: handle IPv6 [ip] in SYNC some more |
9 |
|
10 |
This will fix bug #356375 some more. |
11 |
|
12 |
--- |
13 |
pym/_emerge/actions.py | 18 ++++++++++++++---- |
14 |
1 files changed, 14 insertions(+), 4 deletions(-) |
15 |
|
16 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
17 |
index 471adb3..ea8fc42 100644 |
18 |
--- a/pym/_emerge/actions.py |
19 |
+++ b/pym/_emerge/actions.py |
20 |
@@ -2067,13 +2067,23 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): |
21 |
maxretries = -1 #default number of retries |
22 |
|
23 |
retries=0 |
24 |
- proto, user_name, hostname, port = re.split( |
25 |
- r"(rsync|ssh)://([^:/]+@)?(\[[:\da-fA-F]*\]|[^:/]*)(:[0-9]+)?", |
26 |
- syncuri, maxsplit=4)[1:5] |
27 |
+ try: |
28 |
+ proto, user_name, hostname, port = re.split( |
29 |
+ r"(rsync|ssh)://([^:/]+@)?(\[[:\da-fA-F]*\]|[^:/]*)(:[0-9]+)?", |
30 |
+ syncuri, maxsplit=4)[1:5] |
31 |
+ except ValueError: |
32 |
+ writemsg_level("!!! SYNC is invalid: %s\n" % syncuri, |
33 |
+ noiselevel=-1, level=logging.ERROR) |
34 |
+ return 1 |
35 |
if port is None: |
36 |
port="" |
37 |
if user_name is None: |
38 |
user_name="" |
39 |
+ if re.match(r"^\[[:\da-fA-F]*\]$", hostname) is None: |
40 |
+ getaddrinfo_host = hostname |
41 |
+ else: |
42 |
+ # getaddrinfo needs the brackets stripped |
43 |
+ getaddrinfo_host = hostname[1:-1] |
44 |
updatecache_flg=True |
45 |
all_rsync_opts = set(rsync_opts) |
46 |
extra_rsync_opts = portage.util.shlex_split( |
47 |
@@ -2092,7 +2102,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): |
48 |
|
49 |
try: |
50 |
addrinfos = getaddrinfo_validate( |
51 |
- socket.getaddrinfo(hostname, None, |
52 |
+ socket.getaddrinfo(getaddrinfo_host, None, |
53 |
family, socket.SOCK_STREAM)) |
54 |
except socket.error as e: |
55 |
writemsg_level( |