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.
This commit is contained in:
Krzesimir Nowak 2025-06-16 17:31:49 +02:00
parent dd21270d15
commit 09b1718e78
4 changed files with 60 additions and 52 deletions

View File

@ -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 <knowak@microsoft.com> From: Krzesimir Nowak <knowak@microsoft.com>
Date: Mon, 27 Feb 2023 15:59:21 +0100 Date: Wed, 25 Jun 2025 11:12:00 +0200
Subject: [PATCH] flatcar changes Subject: [PATCH 1/2] flatcar changes
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com> Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
--- ---
azurelinuxagent/common/osutil/coreos.py | 40 +----- azurelinuxagent/common/osutil/coreos.py | 40 +-----
azurelinuxagent/common/osutil/coreoscommon.py | 59 +++++++++ azurelinuxagent/common/osutil/coreoscommon.py | 59 +++++++++
azurelinuxagent/common/osutil/factory.py | 3 + azurelinuxagent/common/osutil/factory.py | 3 +
azurelinuxagent/common/osutil/flatcar.py | 78 +++++++++++ azurelinuxagent/common/osutil/flatcar.py | 78 +++++++++++
.../common/persist_firewall_rules.py | 1 + azurelinuxagent/ga/persist_firewall_rules.py | 2 +-
config/flatcar/waagent.conf | 122 ++++++++++++++++++ config/flatcar/waagent.conf | 122 ++++++++++++++++++
init/flatcar/10-waagent-sysext.conf | 2 + init/flatcar/10-waagent-sysext.conf | 2 +
init/flatcar/waagent.service | 31 +++++ init/flatcar/waagent.service | 31 +++++
setup.py | 20 ++- 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/coreoscommon.py
create mode 100644 azurelinuxagent/common/osutil/flatcar.py create mode 100644 azurelinuxagent/common/osutil/flatcar.py
create mode 100644 config/flatcar/waagent.conf create mode 100644 config/flatcar/waagent.conf
@ -147,10 +148,10 @@ index 00000000..9008ff20
+ ["systemctl", "show", "-p", "MainPID", "systemd-networkd"], + ["systemctl", "show", "-p", "MainPID", "systemd-networkd"],
+ transform_command_output=lambda o: o.replace("MainPID=", "")) + transform_command_output=lambda o: o.replace("MainPID=", ""))
diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py 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 --- a/azurelinuxagent/common/osutil/factory.py
+++ b/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 .debian import DebianOSBaseUtil, DebianOSModernUtil
from .default import DefaultOSUtil from .default import DefaultOSUtil
from .devuan import DevuanOSUtil from .devuan import DevuanOSUtil
@ -158,7 +159,7 @@ index 83123e3f..b9257a9b 100644
from .freebsd import FreeBSDOSUtil from .freebsd import FreeBSDOSUtil
from .gaia import GaiaOSUtil from .gaia import GaiaOSUtil
from .iosxe import IosxeOSUtil 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() return DebianOSBaseUtil()
if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"): if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"):
@ -166,7 +167,7 @@ index 83123e3f..b9257a9b 100644
+ return FlatcarUtil() + return FlatcarUtil()
return CoreOSUtil() 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 diff --git a/azurelinuxagent/common/osutil/flatcar.py b/azurelinuxagent/common/osutil/flatcar.py
new file mode 100644 new file mode 100644
index 00000000..eeaf25ce index 00000000..eeaf25ce
@ -252,7 +253,7 @@ index 00000000..eeaf25ce
+ else: + else:
+ logger.warn("exceeded restart retries") + logger.warn("exceeded restart retries")
diff --git a/azurelinuxagent/ga/persist_firewall_rules.py b/azurelinuxagent/ga/persist_firewall_rules.py 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 --- a/azurelinuxagent/ga/persist_firewall_rules.py
+++ b/azurelinuxagent/ga/persist_firewall_rules.py +++ b/azurelinuxagent/ga/persist_firewall_rules.py
@@ -35,7 +35,7 @@ class PersistFirewallRulesHandler(object): @@ -35,7 +35,7 @@ class PersistFirewallRulesHandler(object):
@ -438,7 +439,7 @@ index 00000000..8d2c1f09
+[Install] +[Install]
+WantedBy=multi-user.target +WantedBy=multi-user.target
diff --git a/setup.py b/setup.py diff --git a/setup.py b/setup.py
index 8f5d92b4..35400e09 100755 index e83f5989..a94e163c 100755
--- a/setup.py --- a/setup.py
+++ b/setup.py +++ b/setup.py
@@ -135,12 +135,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 @@ -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_bin_files(data_files, dest=agent_bin_path)
set_conf_files(data_files, dest="/usr/share/defaults/waagent", set_conf_files(data_files, dest="/usr/share/defaults/waagent",
-- --
2.45.0 2.49.0

View File

@ -1,18 +1,17 @@
From 0c8db73c3567039e50ffa7447bb093ca812dedf6 Mon Sep 17 00:00:00 2001 From 29e2080e75586df18045e84d02853816cb2f943d Mon Sep 17 00:00:00 2001
Message-Id: <0c8db73c3567039e50ffa7447bb093ca812dedf6.1740577844.git.dpark@linux.microsoft.com>
From: Peyton Robertson <93797227+peytonr18@users.noreply.github.com> From: Peyton Robertson <93797227+peytonr18@users.noreply.github.com>
Date: Tue, 28 Jan 2025 14:17:43 -0800 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 +- azurelinuxagent/common/osutil/default.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py 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 --- a/azurelinuxagent/common/osutil/default.py
+++ b/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)) raise OSUtilError("Bad public key: {0}".format(value))
if not value.endswith("\n"): if not value.endswith("\n"):
value += "\n" value += "\n"
@ -22,5 +21,5 @@ index 584515dc..746c4363 100644
lib_dir = conf.get_lib_dir() lib_dir = conf.get_lib_dir()
crt_path = os.path.join(lib_dir, thumbprint + '.crt') crt_path = os.path.join(lib_dir, thumbprint + '.crt')
-- --
2.39.5 2.49.0

View File

@ -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"
)

View File

@ -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
}