From 0e82e6381b8da99b4227d72bcd1e88c3951afdda Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Fri, 11 Dec 2020 12:04:36 +0100 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/WALinuxAgent.git#fdaed2056491f5835cfbe06620333c3694eb6833 --- .gitignore | 2 + ...tring-and-json.loads-without-encodin.patch | 72 +++++++++++++++ 0002-handle-py3.9-check-in-future.py.patch | 90 +++++++++++++++++++ 0003-fix-pylint.patch | 33 +++++++ WALinuxAgent.spec | 16 +++- sources | 2 +- 6 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 0001-update-array.tostring-and-json.loads-without-encodin.patch create mode 100644 0002-handle-py3.9-check-in-future.py.patch create mode 100644 0003-fix-pylint.patch diff --git a/.gitignore b/.gitignore index 6489f14..fca6ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ /WALinuxAgent-2.2.40.tar.gz /WALinuxAgent-2.2.46.tar.gz /v2.2.48.1.tar.gz +/WALinuxAgent-2.2.52.tar.gz +/v2.2.52.tar.gz diff --git a/0001-update-array.tostring-and-json.loads-without-encodin.patch b/0001-update-array.tostring-and-json.loads-without-encodin.patch new file mode 100644 index 0000000..d88c41c --- /dev/null +++ b/0001-update-array.tostring-and-json.loads-without-encodin.patch @@ -0,0 +1,72 @@ +From cc9b7996e542640bb19365822344298a04b18e44 Mon Sep 17 00:00:00 2001 +From: Paula Gombar +Date: Wed, 18 Nov 2020 12:24:33 -0800 +Subject: [PATCH 1/3] update array.tostring() and json.loads without encoding + for py3.9 + +--- + azurelinuxagent/common/osutil/bigip.py | 7 ++++++- + azurelinuxagent/common/osutil/default.py | 6 +++++- + tests/protocol/test_imds.py | 4 ++-- + 3 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/bigip.py b/azurelinuxagent/common/osutil/bigip.py +index 61d3c695f911..ceadf8ca2066 100644 +--- a/azurelinuxagent/common/osutil/bigip.py ++++ b/azurelinuxagent/common/osutil/bigip.py +@@ -280,7 +280,12 @@ class BigIpOSUtil(DefaultOSUtil): + if retsize == (expected * struct_size): + logger.warn(('SIOCGIFCONF returned more than {0} up ' + 'network interfaces.'), expected) +- sock = buff.tostring() ++ try: ++ # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias ++ sock = buff.tostring() ++ except AttributeError: ++ sock = buff.tobytes() ++ + for i in range(0, struct_size * expected, struct_size): + iface = self._format_single_interface_name(sock, i) + +diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py +index 521776818e64..6179061756e3 100644 +--- a/azurelinuxagent/common/osutil/default.py ++++ b/azurelinuxagent/common/osutil/default.py +@@ -758,7 +758,11 @@ class DefaultOSUtil(object): + logger.warn(('SIOCGIFCONF returned more than {0} up ' + 'network interfaces.'), expected) + +- ifconf_buff = buff.tostring() ++ try: ++ # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias ++ ifconf_buff = buff.tostring() ++ except AttributeError: ++ ifconf_buff = buff.tobytes() + + ifaces = {} + for i in range(0, array_size, struct_size): +diff --git a/tests/protocol/test_imds.py b/tests/protocol/test_imds.py +index a730ded03525..47462fd25ac3 100644 +--- a/tests/protocol/test_imds.py ++++ b/tests/protocol/test_imds.py +@@ -109,7 +109,7 @@ class TestImds(AgentTestCase): + "zone": "In" + }''' + +- data = json.loads(s, encoding='utf-8') ++ data = json.loads(s) + + compute_info = imds.ComputeInfo() + set_properties("compute", compute_info, data) +@@ -258,7 +258,7 @@ class TestImds(AgentTestCase): + "version": "{3}" + }}'''.format(publisher, offer, sku, version) + +- data = json.loads(s, encoding='utf-8') ++ data = json.loads(s) + compute_info = imds.ComputeInfo() + set_properties("compute", compute_info, data) + +-- +2.26.2 + diff --git a/0002-handle-py3.9-check-in-future.py.patch b/0002-handle-py3.9-check-in-future.py.patch new file mode 100644 index 0000000..d7c563a --- /dev/null +++ b/0002-handle-py3.9-check-in-future.py.patch @@ -0,0 +1,90 @@ +From 66f600ed3d9f22c2aa6790002507d0c821a7fd0c Mon Sep 17 00:00:00 2001 +From: Paula Gombar +Date: Tue, 8 Dec 2020 18:38:33 -0800 +Subject: [PATCH 2/3] handle py3.9 check in future.py + +--- + azurelinuxagent/common/future.py | 13 ++++++++++++- + azurelinuxagent/common/osutil/bigip.py | 8 +++----- + azurelinuxagent/common/osutil/default.py | 9 ++------- + 3 files changed, 17 insertions(+), 13 deletions(-) + +diff --git a/azurelinuxagent/common/future.py b/azurelinuxagent/common/future.py +index 577fb12e186e..0f76aceba786 100644 +--- a/azurelinuxagent/common/future.py ++++ b/azurelinuxagent/common/future.py +@@ -103,4 +103,15 @@ def get_openwrt_platform(): + elif product_matches: + if product_matches.group(1) == "OpenWrt": + result[0] = "openwrt" +- return result +\ No newline at end of file ++ return result ++ ++ ++def array_to_string_or_bytes(buffer): ++ # Python 3.9 removed the tostring() method on arrays, the new alias is tobytes() ++ if sys.version_info[0] == 2: ++ return buffer.tostring() ++ ++ if sys.version_info[0] == 3 and sys.version_info[1] <= 8: ++ return buffer.tostring() ++ ++ return buffer.tobytes() +diff --git a/azurelinuxagent/common/osutil/bigip.py b/azurelinuxagent/common/osutil/bigip.py +index ceadf8ca2066..cc1b64143c12 100644 +--- a/azurelinuxagent/common/osutil/bigip.py ++++ b/azurelinuxagent/common/osutil/bigip.py +@@ -24,6 +24,8 @@ import socket + import struct + import time + ++from azurelinuxagent.common.future import array_to_string_or_bytes ++ + try: + # WAAgent > 2.1.3 + import azurelinuxagent.common.logger as logger +@@ -280,12 +282,8 @@ class BigIpOSUtil(DefaultOSUtil): + if retsize == (expected * struct_size): + logger.warn(('SIOCGIFCONF returned more than {0} up ' + 'network interfaces.'), expected) +- try: +- # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias +- sock = buff.tostring() +- except AttributeError: +- sock = buff.tobytes() + ++ sock = array_to_string_or_bytes(buff) + for i in range(0, struct_size * expected, struct_size): + iface = self._format_single_interface_name(sock, i) + +diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py +index 6179061756e3..c1ca15cf64ef 100644 +--- a/azurelinuxagent/common/osutil/default.py ++++ b/azurelinuxagent/common/osutil/default.py +@@ -41,7 +41,7 @@ import azurelinuxagent.common.utils.fileutil as fileutil + import azurelinuxagent.common.utils.shellutil as shellutil + import azurelinuxagent.common.utils.textutil as textutil + from azurelinuxagent.common.exception import OSUtilError +-from azurelinuxagent.common.future import ustr ++from azurelinuxagent.common.future import ustr, array_to_string_or_bytes + from azurelinuxagent.common.utils.cryptutil import CryptUtil + from azurelinuxagent.common.utils.flexible_version import FlexibleVersion + from azurelinuxagent.common.utils.networkutil import RouteEntry, NetworkInterfaceCard +@@ -758,12 +758,7 @@ class DefaultOSUtil(object): + logger.warn(('SIOCGIFCONF returned more than {0} up ' + 'network interfaces.'), expected) + +- try: +- # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias +- ifconf_buff = buff.tostring() +- except AttributeError: +- ifconf_buff = buff.tobytes() +- ++ ifconf_buff = array_to_string_or_bytes(buff) + ifaces = {} + for i in range(0, array_size, struct_size): + iface = ifconf_buff[i:i+IFNAMSIZ].split(b'\0', 1)[0] +-- +2.26.2 + diff --git a/0003-fix-pylint.patch b/0003-fix-pylint.patch new file mode 100644 index 0000000..03b887c --- /dev/null +++ b/0003-fix-pylint.patch @@ -0,0 +1,33 @@ +From 90f1a4862cf63df4a96ad912effcfb54192ad4d7 Mon Sep 17 00:00:00 2001 +From: Paula Gombar +Date: Tue, 8 Dec 2020 18:53:57 -0800 +Subject: [PATCH 3/3] fix pylint + +--- + azurelinuxagent/common/future.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/azurelinuxagent/common/future.py b/azurelinuxagent/common/future.py +index 0f76aceba786..a6796f19fec2 100644 +--- a/azurelinuxagent/common/future.py ++++ b/azurelinuxagent/common/future.py +@@ -106,12 +106,12 @@ def get_openwrt_platform(): + return result + + +-def array_to_string_or_bytes(buffer): ++def array_to_string_or_bytes(buff): + # Python 3.9 removed the tostring() method on arrays, the new alias is tobytes() + if sys.version_info[0] == 2: +- return buffer.tostring() ++ return buff.tostring() + + if sys.version_info[0] == 3 and sys.version_info[1] <= 8: +- return buffer.tostring() ++ return buff.tostring() + +- return buffer.tobytes() ++ return buff.tobytes() +-- +2.26.2 + diff --git a/WALinuxAgent.spec b/WALinuxAgent.spec index 27f7e30..618a0c6 100644 --- a/WALinuxAgent.spec +++ b/WALinuxAgent.spec @@ -1,14 +1,19 @@ %global with_legacy 0 Name: WALinuxAgent -Version: 2.2.48.1 -Release: 2%{?dist} +Version: 2.2.52 +Release: 1%{?dist} Summary: The Microsoft Azure Linux Agent License: ASL 2.0 URL: https://github.com/Azure/%{name} Source0: https://github.com/Azure/%{name}/archive/v%{version}.tar.gz +# Python3.9 fixes +Patch0: 0001-update-array.tostring-and-json.loads-without-encodin.patch +Patch1: 0002-handle-py3.9-check-in-future.py.patch +Patch2: 0003-fix-pylint.patch + BuildArch: noarch BuildRequires: python3-devel @@ -51,6 +56,9 @@ Udev rules specific to Microsoft Azure Virtual Machines. %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build %py3_build @@ -110,6 +118,10 @@ mv %{buildroot}%{_sysconfdir}/logrotate.d/waagent-extn.logrotate %{buildroot}%{_ %endif %changelog +* Wed Dec 09 2020 Vitaly Kuznetsov - 2.2.52-1 +- Update to 2.2.52 (#1849923) +- Add not yet upstream patches supporting Python3.9 changes + * Mon Jul 27 2020 Fedora Release Engineering - 2.2.48.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 74fc3c0..b56b229 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v2.2.48.1.tar.gz) = 139c0b8d8696efdc570f44a63ee828d35ec162ee6a279ceba1a2b7d6ca4d6f99b7c428a4726286ca12b641c5957c3f1050b25a9d233e7a5bb559c8cef97bce0d +SHA512 (v2.2.52.tar.gz) = b8d71cb4873b7e9cf92c755884bb104e5e37f171fbdae3d702b2b005a461b8f5447c9dcc80037ff0bfe9950ffbcb901e023e0bda918f481f5336c8ecbaecbbcc