Add back --sync IPv4/IPv6 override support.
authorZac Medico <zmedico@gentoo.org>
Mon, 4 Oct 2010 22:11:11 +0000 (15:11 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 4 Oct 2010 22:11:11 +0000 (15:11 -0700)
pym/_emerge/actions.py

index 476e213724be3deac657f135f4083e060dbcba15..8ec2a49707114ad9895fafd2c7835a33d303c470 100644 (file)
@@ -2084,12 +2084,19 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                        settings.get("PORTAGE_RSYNC_EXTRA_OPTS",""))
                all_rsync_opts.update(extra_rsync_opts)
 
+               family = socket.AF_UNSPEC
+               if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts:
+                       family = socket.AF_INET
+               elif socket.has_ipv6 and \
+                       ("-6" in all_rsync_opts or "--ipv6" in all_rsync_opts):
+                       family = socket.AF_INET6
+
                ips_v4 = []
                ips_v6 = []
 
                try:
                        addrinfos = socket.getaddrinfo(hostname, None,
-                               socket.AF_UNSPEC, socket.SOCK_STREAM)
+                               family, socket.SOCK_STREAM)
                except socket.error as e:
                        writemsg("!!! getaddrinfo failed: %s\n" % (e,), noiselevel=-1)
                        return 1