From bce434d4f5299dcfdc39ff40381bb6f3860ca923 Mon Sep 17 00:00:00 2001 From: Steve Wills Date: Fri, 23 Nov 2018 20:07:40 +0000 Subject: [PATCH] sysutils/py-google-compute-engine: update to 2.8.6 PR: 232439 Submitted by: Lucas Kanashiro Approved by: Helen Koike (maintainer, earlier version of patch) --- sysutils/py-google-compute-engine/Makefile | 10 +- sysutils/py-google-compute-engine/distinfo | 6 +- ...patch-google__compute__engine_constants.py | 11 -- ...etworking_ip__forwarding_ip__forwarding.py | 22 ---- ...ng_ip__forwarding_ip__forwarding__utils.py | 115 ------------------ ...pute__engine_networking_network__daemon.py | 33 ----- 6 files changed, 10 insertions(+), 187 deletions(-) delete mode 100644 sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py delete mode 100644 sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py delete mode 100644 sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py delete mode 100644 sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py diff --git a/sysutils/py-google-compute-engine/Makefile b/sysutils/py-google-compute-engine/Makefile index 4d310ff8cc08..0a31a4fd7aa7 100644 --- a/sysutils/py-google-compute-engine/Makefile +++ b/sysutils/py-google-compute-engine/Makefile @@ -1,10 +1,8 @@ # $FreeBSD$ PORTNAME= google-compute-engine -DISTVERSION= 2.8.3 -PORTREVISION= 2 +DISTVERSION= 2.8.6 CATEGORIES= sysutils python -MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= helen.koike@collabora.com @@ -21,9 +19,15 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}boto>0:devel/py-boto@${PY_FLAVOR} \ USES= python shebangfix USE_PYTHON= autoplist concurrent distutils + NO_ARCH= yes SHEBANG_FILES= scripts/set_multiqueue scripts/optimize_local_ssd +USE_GITHUB= yes +GH_ACCOUNT= GoogleCloudPlatform +GH_PROJECT= compute-image-packages +GH_TAGNAME= 20181011 + USE_RC_SUBR= google_instance_setup \ google_accounts_daemon \ google_clock_skew_daemon \ diff --git a/sysutils/py-google-compute-engine/distinfo b/sysutils/py-google-compute-engine/distinfo index 3e0acc4dfcbc..f51825616354 100644 --- a/sysutils/py-google-compute-engine/distinfo +++ b/sysutils/py-google-compute-engine/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1528807896 -SHA256 (google-compute-engine-2.8.3.tar.gz) = 14947a0cfc20e1d64d1184bbd137b9f3b66d7c94efcbe1b73e21c090e7002af4 -SIZE (google-compute-engine-2.8.3.tar.gz) = 45988 +TIMESTAMP = 1540947814 +SHA256 (GoogleCloudPlatform-compute-image-packages-2.8.6-20181011_GH0.tar.gz) = c9fb44fb8c4bbde108a2aeba44f11938c7840256ca078804ec3c720a47e79144 +SIZE (GoogleCloudPlatform-compute-image-packages-2.8.6-20181011_GH0.tar.gz) = 147405 diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py deleted file mode 100644 index 7bf73353a162..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py +++ /dev/null @@ -1,11 +0,0 @@ ---- google_compute_engine/constants.py.orig 2018-06-11 23:51:09 UTC -+++ google_compute_engine/constants.py -@@ -18,7 +18,7 @@ - import platform - - OSLOGIN_CONTROL_SCRIPT = 'google_oslogin_control' --OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache' -+OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' - OSLOGIN_NSS_CACHE_SCRIPT = 'google_oslogin_nss_cache' - - if platform.system() == 'FreeBSD': diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py deleted file mode 100644 index deb138d798d4..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py +++ /dev/null @@ -1,22 +0,0 @@ ---- google_compute_engine/networking/ip_forwarding/ip_forwarding.py.orig 2018-06-11 23:51:09 UTC -+++ google_compute_engine/networking/ip_forwarding/ip_forwarding.py -@@ -85,15 +85,17 @@ class IpForwarding(object): - for address in forwarded_ips: - self.ip_forwarding_utils.RemoveForwardedIp(address, interface) - -- def HandleForwardedIps(self, interface, forwarded_ips): -+ def HandleForwardedIps(self, interface, forwarded_ips, interface_ip): - """Handle changes to the forwarded IPs on a network interface. - - Args: - interface: string, the output device to configure. - forwarded_ips: list, the forwarded IP address strings desired. -+ interface_ip: string, current interface ip address. - """ - desired = self.ip_forwarding_utils.ParseForwardedIps(forwarded_ips) -- configured = self.ip_forwarding_utils.GetForwardedIps(interface) -+ configured = self.ip_forwarding_utils.GetForwardedIps( -+ interface, interface_ip) - to_add = sorted(set(desired) - set(configured)) - to_remove = sorted(set(configured) - set(desired)) - self._LogForwardedIpChanges( diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py deleted file mode 100644 index 72cb8ddc03d3..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py +++ /dev/null @@ -1,115 +0,0 @@ ---- google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py.orig 2018-06-11 23:51:09 UTC -+++ google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py -@@ -15,6 +15,8 @@ - - """Utilities for configuring IP address forwarding.""" - -+import netaddr -+import netifaces - import re - import subprocess - -@@ -32,27 +34,11 @@ class IpForwardingUtils(object): - logger: logger object, used to write to SysLog and serial port. - proto_id: string, the routing protocol identifier for Google IP changes. - """ -- self.logger = logger -- self.proto_id = proto_id or '66' - -- def _CreateRouteOptions(self, **kwargs): -- """Create a dictionary of parameters to append to the ip route command. -- -- Args: -- **kwargs: dict, the string parameters to update in the ip route command. -- -- Returns: -- dict, the string parameters to append to the ip route command. -- """ -- options = { -- 'proto': self.proto_id, -- 'scope': 'host', -- } -- options.update(kwargs) -- return options -+ self.logger = logger - -- def _RunIpRoute(self, args=None, options=None): -- """Run a command with ip route and return the response. -+ def _RunIfconfig(self, args=None, options=None): -+ """Run a command with ifconfig and return the response. - - Args: - args: list, the string ip route command args to execute. -@@ -63,7 +49,7 @@ class IpForwardingUtils(object): - """ - args = args or [] - options = options or {} -- command = ['ip', 'route'] -+ command = ['ifconfig'] - command.extend(args) - for item in options.items(): - command.extend(item) -@@ -94,25 +80,33 @@ class IpForwardingUtils(object): - forwarded_ips = forwarded_ips or [] - for ip in forwarded_ips: - if ip and (IP_REGEX.match(ip) or IP_ALIAS_REGEX.match(ip)): -- addresses.append(ip[:-3] if ip.endswith('/32') else ip) -+ addresses.extend([str(addr) for addr in list(netaddr.IPNetwork(ip))]) - else: - self.logger.warning('Could not parse IP address: "%s".', ip) - return addresses - -- def GetForwardedIps(self, interface): -+ def GetForwardedIps(self, interface, interface_ip): - """Retrieve the list of configured forwarded IP addresses. - - Args: - interface: string, the output device to query. -+ interface_ip: string, current interface ip address. - - Returns: - list, the IP address strings. - """ -- args = ['ls', 'table', 'local', 'type', 'local'] -- options = self._CreateRouteOptions(dev=interface) -- result = self._RunIpRoute(args=args, options=options) -- result = re.sub(r'local\s', r'', result) -- return self.ParseForwardedIps(result.split()) -+ try: -+ ips = netifaces.ifaddresses(interface) -+ ips = ips[netifaces.AF_INET] -+ except (ValueError, IndexError): -+ return [] -+ forwarded_ips = [] -+ for ip in ips: -+ if ip['addr'] != interface_ip: -+ forwarded_ips.append( -+ '%s/%d' % (ip['addr'], -+ netaddr.IPAddress(ip['netmask']).netmask_bits())) -+ return self.ParseForwardedIps(forwarded_ips) - - def AddForwardedIp(self, address, interface): - """Configure a new IP address on the network interface. -@@ -121,10 +115,8 @@ class IpForwardingUtils(object): - address: string, the IP address to configure. - interface: string, the output device to use. - """ -- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address -- args = ['add', 'to', 'local', address] -- options = self._CreateRouteOptions(dev=interface) -- self._RunIpRoute(args=args, options=options) -+ for ip in list(netaddr.IPNetwork(address)): -+ self._RunIfconfig(args=[interface, 'alias', '%s/32' % str(ip)]) - - def RemoveForwardedIp(self, address, interface): - """Delete an IP address on the network interface. -@@ -133,7 +125,5 @@ class IpForwardingUtils(object): - address: string, the IP address to configure. - interface: string, the output device to use. - """ -- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address -- args = ['delete', 'to', 'local', address] -- options = self._CreateRouteOptions(dev=interface) -- self._RunIpRoute(args=args, options=options) -+ ip = netaddr.IPNetwork(address) -+ self._RunIfconfig(args=[interface, '-alias', str(ip.ip)]) diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py deleted file mode 100644 index b0ac20b1a0e6..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py +++ /dev/null @@ -1,33 +0,0 @@ ---- google_compute_engine/networking/network_daemon.py.orig 2018-06-11 23:51:09 UTC -+++ google_compute_engine/networking/network_daemon.py -@@ -96,7 +96,7 @@ class NetworkDaemon(object): - for interface in network_interfaces: - if self.ip_forwarding_enabled: - self.ip_forwarding.HandleForwardedIps( -- interface.name, interface.forwarded_ips) -+ interface.name, interface.forwarded_ips, interface.ip) - - def _ExtractInterfaceMetadata(self, metadata): - """Extracts network interface metadata. -@@ -119,7 +119,8 @@ class NetworkDaemon(object): - if self.target_instance_ips: - ip_addresses.extend(network_interface.get('targetInstanceIps', [])) - interfaces.append(NetworkDaemon.NetworkInterface( -- interface, ip_addresses)) -+ interface, ip_addresses, network_interface.get('ip', []))) -+ - else: - message = 'Network interface not found for MAC address: %s.' - self.logger.warning(message, mac_address) -@@ -128,9 +129,10 @@ class NetworkDaemon(object): - class NetworkInterface(object): - """Network interface information extracted from metadata.""" - -- def __init__(self, name, forwarded_ips=None): -+ def __init__(self, name, forwarded_ips=None, ip=None): - self.name = name - self.forwarded_ips = forwarded_ips -+ self.ip = ip - - - def main():