From 06372b5e9979c40d1ece4c85046a992249fc89ab Mon Sep 17 00:00:00 2001 From: illustris Date: Fri, 30 Sep 2022 21:01:54 +0530 Subject: [PATCH] cloud-init: 21.4 -> 22.3.3 --- .../cloud-init/0001-add-nixos-support.patch | 30 ++++------------ .../virtualization/cloud-init/default.nix | 35 ++++++++----------- 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/pkgs/tools/virtualization/cloud-init/0001-add-nixos-support.patch b/pkgs/tools/virtualization/cloud-init/0001-add-nixos-support.patch index 997d28aaecbf..81ff2ef73ce8 100644 --- a/pkgs/tools/virtualization/cloud-init/0001-add-nixos-support.patch +++ b/pkgs/tools/virtualization/cloud-init/0001-add-nixos-support.patch @@ -1,27 +1,12 @@ -From 269cc4c9558549f340ec186d9246654564b2f633 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= -Date: Tue, 18 Aug 2020 10:22:36 +0100 -Subject: [PATCH] add nixos support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Jörg Thalheim ---- - cloudinit/distros/__init__.py | 1 + - cloudinit/distros/nixos.py | 103 ++++++++++++++++++++++++++++++++++ - 2 files changed, 104 insertions(+) - create mode 100644 cloudinit/distros/nixos.py - diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py -index 2537608f..c533b585 100755 +index 4a468cf8..c60c899b 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py -@@ -47,6 +47,7 @@ OSFAMILIES = { - 'gentoo': ['gentoo'], - 'redhat': ['amazon', 'centos', 'fedora', 'rhel'], - 'suse': ['opensuse', 'sles'], -+ 'nixos': ['nixos'], +@@ -55,6 +55,7 @@ OSFAMILIES = { + "virtuozzo", + ], + "suse": ["opensuse", "sles"], ++ "nixos": ["nixos"], } LOG = logging.getLogger(__name__) @@ -134,6 +119,3 @@ index 00000000..d53d2a61 + + def update_package_sources(self): + raise NotImplementedError() --- -2.28.0 - diff --git a/pkgs/tools/virtualization/cloud-init/default.nix b/pkgs/tools/virtualization/cloud-init/default.nix index a2e156f2a10b..ed12f8101362 100644 --- a/pkgs/tools/virtualization/cloud-init/default.nix +++ b/pkgs/tools/virtualization/cloud-init/default.nix @@ -9,18 +9,19 @@ , python3 , shadow , systemd +, coreutils }: python3.pkgs.buildPythonApplication rec { pname = "cloud-init"; - version = "21.4"; + version = "22.3.3"; namePrefix = ""; src = fetchFromGitHub { owner = "canonical"; repo = "cloud-init"; rev = version; - sha256 = "09413qz9y2csvhjb4krjnkfj97vlykx79j912p27jjcrg82f1nib"; + hash = "sha256-9vdFPSmkkdJDlVfA9DgqczRoOBMmSMezdl3D/0OSbsQ="; }; patches = [ ./0001-add-nixos-support.patch ]; @@ -30,11 +31,14 @@ python3.pkgs.buildPythonApplication rec { --replace /lib/systemd $out/lib/systemd substituteInPlace cloudinit/net/networkd.py \ - --replace "['/usr/sbin', '/bin']" "['/usr/sbin', '/bin', '${iproute2}/bin', '${systemd}/bin']" + --replace '["/usr/sbin", "/bin"]' '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]' substituteInPlace tests/unittests/test_net_activators.py \ - --replace "['/usr/sbin', '/bin']" \ - "['/usr/sbin', '/bin', '${iproute2}/bin', '${systemd}/bin']" + --replace '["/usr/sbin", "/bin"]' \ + '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]' + + substituteInPlace tests/unittests/cmd/test_clean.py \ + --replace "/bin/bash" "/bin/sh" ''; postInstall = '' @@ -62,6 +66,9 @@ python3.pkgs.buildPythonApplication rec { dmidecode # needed for tests; at runtime we rather want the setuid wrapper shadow + responses + pytest-mock + coreutils ]; makeWrapperArgs = [ @@ -96,20 +103,6 @@ python3.pkgs.buildPythonApplication rec { "test_install_with_version" ]; - disabledTestPaths = [ - # Oracle tests are not passing - "cloudinit/sources/tests/test_oracle.py" - # Disable the integration tests. pycloudlib would be required - "tests/unittests/test_datasource/test_aliyun.py" - "tests/unittests/test_datasource/test_azure.py" - "tests/unittests/test_datasource/test_ec2.py" - "tests/unittests/test_datasource/test_exoscale.py" - "tests/unittests/test_datasource/test_gce.py" - "tests/unittests/test_datasource/test_openstack.py" - "tests/unittests/test_datasource/test_scaleway.py" - "tests/unittests/test_ec2_util.py" - ]; - preCheck = '' # TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build export TMPDIR=/tmp @@ -119,13 +112,13 @@ python3.pkgs.buildPythonApplication rec { "cloudinit" ]; - passthru.tests.cloud-init = nixosTests.cloud-init; + passthru.tests = { inherit (nixosTests) cloud-init cloud-init-hostname; }; meta = with lib; { homepage = "https://cloudinit.readthedocs.org"; description = "Provides configuration and customization of cloud instance"; license = with licenses; [ asl20 gpl3Plus ]; - maintainers = with maintainers; [ madjar phile314 ]; + maintainers = with maintainers; [ madjar phile314 illustris ]; platforms = platforms.all; }; }