From 09b1718e78e9f354fd9cf95bfae55cd1b9ca644f Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 16 Jun 2025 17:31:49 +0200 Subject: [PATCH] overlay app-emulation/wa-linux-agent: Stop using legacy distutils workflow The legacy workflow was deprecated for some time in distutils-r1 eclass and was recently removed. Now specifying the DISTUTILS_USE_PEP517 variable is mandatory, but there is no distutils workflow that would match what legacy was doing. The closest ones are either "no" or "setuptools". I picked "setuptools", but it results in all the files put inside the site-packages directory. As a workaround, move some of the files back where they were supposed to be. While at it, regenerate the patches and update the python compatibility variable. --- .../files/0001-flatcar-changes.patch | 25 +++++------ ...0002-prevent-ssh-public-key-override.patch | 11 +++-- .../wa-linux-agent-2.12.0.4-r1.ebuild | 34 --------------- .../wa-linux-agent-2.12.0.4-r2.ebuild | 42 +++++++++++++++++++ 4 files changed, 60 insertions(+), 52 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r1.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r2.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch index c47371ef4d..f748c3e51c 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch @@ -1,20 +1,21 @@ -From 948c6075656fde25703ba402f8cd94715feaa774 Mon Sep 17 00:00:00 2001 +From 0ed36d7646036e609ab8fba059436f90c4984bbe Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak -Date: Mon, 27 Feb 2023 15:59:21 +0100 -Subject: [PATCH] flatcar changes +Date: Wed, 25 Jun 2025 11:12:00 +0200 +Subject: [PATCH 1/2] flatcar changes Signed-off-by: Jeremi Piotrowski +Signed-off-by: Krzesimir Nowak --- azurelinuxagent/common/osutil/coreos.py | 40 +----- azurelinuxagent/common/osutil/coreoscommon.py | 59 +++++++++ azurelinuxagent/common/osutil/factory.py | 3 + azurelinuxagent/common/osutil/flatcar.py | 78 +++++++++++ - .../common/persist_firewall_rules.py | 1 + + azurelinuxagent/ga/persist_firewall_rules.py | 2 +- config/flatcar/waagent.conf | 122 ++++++++++++++++++ init/flatcar/10-waagent-sysext.conf | 2 + init/flatcar/waagent.service | 31 +++++ setup.py | 20 ++- - 9 files changed, 313 insertions(+), 43 deletions(-) + 9 files changed, 313 insertions(+), 44 deletions(-) create mode 100644 azurelinuxagent/common/osutil/coreoscommon.py create mode 100644 azurelinuxagent/common/osutil/flatcar.py create mode 100644 config/flatcar/waagent.conf @@ -147,10 +148,10 @@ index 00000000..9008ff20 + ["systemctl", "show", "-p", "MainPID", "systemd-networkd"], + transform_command_output=lambda o: o.replace("MainPID=", "")) diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py -index 83123e3f..b9257a9b 100644 +index fd66fbb0..2c9d2149 100644 --- a/azurelinuxagent/common/osutil/factory.py +++ b/azurelinuxagent/common/osutil/factory.py -@@ -28,6 +28,7 @@ from .coreos import CoreOSUtil +@@ -27,6 +27,7 @@ from .coreos import CoreOSUtil from .debian import DebianOSBaseUtil, DebianOSModernUtil from .default import DefaultOSUtil from .devuan import DevuanOSUtil @@ -158,7 +159,7 @@ index 83123e3f..b9257a9b 100644 from .freebsd import FreeBSDOSUtil from .gaia import GaiaOSUtil from .iosxe import IosxeOSUtil -@@ -88,6 +89,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) +@@ -86,6 +87,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) return DebianOSBaseUtil() if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"): @@ -166,7 +167,7 @@ index 83123e3f..b9257a9b 100644 + return FlatcarUtil() return CoreOSUtil() - if distro_name in ("suse", "sle_hpc", "sles", "opensuse"): + if distro_name in ("suse", "sle-micro", "sle_hpc", "sles", "opensuse"): diff --git a/azurelinuxagent/common/osutil/flatcar.py b/azurelinuxagent/common/osutil/flatcar.py new file mode 100644 index 00000000..eeaf25ce @@ -252,7 +253,7 @@ index 00000000..eeaf25ce + else: + logger.warn("exceeded restart retries") diff --git a/azurelinuxagent/ga/persist_firewall_rules.py b/azurelinuxagent/ga/persist_firewall_rules.py -index 74b878ce..22562c96 100644 +index e7c8373e..d93c984f 100644 --- a/azurelinuxagent/ga/persist_firewall_rules.py +++ b/azurelinuxagent/ga/persist_firewall_rules.py @@ -35,7 +35,7 @@ class PersistFirewallRulesHandler(object): @@ -438,7 +439,7 @@ index 00000000..8d2c1f09 +[Install] +WantedBy=multi-user.target diff --git a/setup.py b/setup.py -index 8f5d92b4..35400e09 100755 +index e83f5989..a94e163c 100755 --- a/setup.py +++ b/setup.py @@ -135,12 +135,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 @@ -470,5 +471,5 @@ index 8f5d92b4..35400e09 100755 set_bin_files(data_files, dest=agent_bin_path) set_conf_files(data_files, dest="/usr/share/defaults/waagent", -- -2.45.0 +2.49.0 diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0002-prevent-ssh-public-key-override.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0002-prevent-ssh-public-key-override.patch index d53936e351..ef73430e9b 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0002-prevent-ssh-public-key-override.patch +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0002-prevent-ssh-public-key-override.patch @@ -1,18 +1,17 @@ -From 0c8db73c3567039e50ffa7447bb093ca812dedf6 Mon Sep 17 00:00:00 2001 -Message-Id: <0c8db73c3567039e50ffa7447bb093ca812dedf6.1740577844.git.dpark@linux.microsoft.com> +From 29e2080e75586df18045e84d02853816cb2f943d Mon Sep 17 00:00:00 2001 From: Peyton Robertson <93797227+peytonr18@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:17:43 -0800 -Subject: [PATCH] Applying patch to prevent ssh public key override (#3309) +Subject: [PATCH 2/2] Applying patch to prevent ssh public key override (#3309) --- azurelinuxagent/common/osutil/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py -index 584515dc..746c4363 100644 +index 0a0fd0e1..994edff7 100644 --- a/azurelinuxagent/common/osutil/default.py +++ b/azurelinuxagent/common/osutil/default.py -@@ -346,7 +346,7 @@ GEN2_DEVICE_ID = 'f8b3781a-1e82-4818-a1c3-63d806ec15bb' +@@ -557,7 +557,7 @@ class DefaultOSUtil(object): raise OSUtilError("Bad public key: {0}".format(value)) if not value.endswith("\n"): value += "\n" @@ -22,5 +21,5 @@ index 584515dc..746c4363 100644 lib_dir = conf.get_lib_dir() crt_path = os.path.join(lib_dir, thumbprint + '.crt') -- -2.39.5 +2.49.0 diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r1.ebuild deleted file mode 100644 index 6e932e1563..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r1.ebuild +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2014 CoreOS, Inc.. All rights reserved. -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -# Don't use DISTUTILS_USE_PEP517=setuptools because this installs -# everything inside /usr/lib/pythonX_Y/site-packages, even files that -# ought to be put into /etc or /sbin. -PYTHON_COMPAT=( python3_{9..11} ) - -inherit distutils-r1 - -DESCRIPTION="Windows Azure Linux Agent" -HOMEPAGE="https://github.com/Azure/WALinuxAgent" -SRC_URI="${HOMEPAGE}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="Apache-2.0" -KEYWORDS="amd64 arm64" -SLOT="0" -IUSE="" -RESTRICT="" - -BDEPEND=" - dev-python/distro -" -RDEPEND="${BDEPEND} -" - -S="${WORKDIR}/WALinuxAgent-${PV}" - -PATCHES=( - "${FILESDIR}/0001-flatcar-changes.patch" - "${FILESDIR}/0002-prevent-ssh-public-key-override.patch" -) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r2.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r2.ebuild new file mode 100644 index 0000000000..b796e73f49 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.12.0.4-r2.ebuild @@ -0,0 +1,42 @@ +# Copyright (c) 2014 CoreOS, Inc.. All rights reserved. +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..13} ) +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 + +DESCRIPTION="Windows Azure Linux Agent" +HOMEPAGE="https://github.com/Azure/WALinuxAgent" +SRC_URI="${HOMEPAGE}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +KEYWORDS="amd64 arm64" +SLOT="0" +IUSE="" +RESTRICT="" + +BDEPEND=" + dev-python/distro +" +RDEPEND="${BDEPEND} +" + +S="${WORKDIR}/WALinuxAgent-${PV}" + +PATCHES=( + "${FILESDIR}/0001-flatcar-changes.patch" + "${FILESDIR}/0002-prevent-ssh-public-key-override.patch" +) + +# All the stuff is installed inside the site-packages directory, even executables that ought to be in /sbin or config that ought to be in /etc. Move them. +python_install() { + distutils-r1_python_install + local d + for d in /etc /usr; do + cp -a "${ED}$(python_get_sitedir)${d}" "${ED}" || die + rm -rf "${ED}$(python_get_sitedir)${d}" || die + done +}