From 0f946e28754e1da24d373fe9c64b89b51acb3463 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 30 Mar 2022 19:55:20 +0200 Subject: ansible: prune old versions; restructure - Drop pkgs/tools/admin/ansible and move everything into top-level and throws into central aliases.nix - Drop the Ansible 2.8 throw - Remove Ansible 2.9/2.10, both will be EOL before the 22.05 release - Remove Ansible 2.11, it will go EOL during the 22.05 release - Expose the collections as `python3Packages.ansible` Closes: #157591 --- pkgs/development/python-modules/ansible/base.nix | 88 ---------------------- .../python-modules/ansible/collections.nix | 78 ------------------- pkgs/development/python-modules/ansible/core.nix | 15 +--- .../development/python-modules/ansible/default.nix | 84 +++++++++++++++++++++ pkgs/development/python-modules/ansible/legacy.nix | 55 -------------- pkgs/tools/admin/ansible/default.nix | 24 ------ pkgs/top-level/aliases.nix | 3 + pkgs/top-level/all-packages.nix | 8 +- pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 4 +- 10 files changed, 94 insertions(+), 266 deletions(-) delete mode 100644 pkgs/development/python-modules/ansible/base.nix delete mode 100644 pkgs/development/python-modules/ansible/collections.nix create mode 100644 pkgs/development/python-modules/ansible/default.nix delete mode 100644 pkgs/development/python-modules/ansible/legacy.nix delete mode 100644 pkgs/tools/admin/ansible/default.nix diff --git a/pkgs/development/python-modules/ansible/base.nix b/pkgs/development/python-modules/ansible/base.nix deleted file mode 100644 index 173e620703a42..0000000000000 --- a/pkgs/development/python-modules/ansible/base.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ lib -, callPackage -, buildPythonPackage -, fetchPypi -, installShellFiles -, cryptography -, jinja2 -, junit-xml -, lxml -, ncclient -, packaging -, paramiko -, pexpect -, psutil -, pycrypto -, pyyaml -, requests -, scp -, windowsSupport ? false, pywinrm -, xmltodict -}: - -let - ansible-collections = callPackage ./collections.nix { - version = "3.4.0"; # must be < 4.0 - sha256 = "096rbgz730njk0pg8qnc27mmz110wqrw354ca9gasb7rqg0f4d6a"; - }; -in -buildPythonPackage rec { - pname = "ansible-base"; - version = "2.10.17"; - - src = fetchPypi { - inherit pname version; - sha256 = "sha256-75JYgsqNTDwszQkc3hmeDIaQJMytDQejN9zyB7/zLzQ="; - }; - - # ansible_connection is already wrapped, so don't pass it through - # the python interpreter again, as it would break execution of - # connection plugins. - postPatch = '' - substituteInPlace lib/ansible/executor/task_executor.py \ - --replace "[python," "[" - ''; - - nativeBuildInputs = [ - installShellFiles - ]; - - propagatedBuildInputs = [ - # depend on ansible-collections instead of the other way around - ansible-collections - # from requirements.txt - cryptography - jinja2 - packaging - pyyaml - # optional dependencies - junit-xml - lxml - ncclient - paramiko - pexpect - psutil - pycrypto - requests - scp - xmltodict - ] ++ lib.optional windowsSupport pywinrm; - - postInstall = '' - installManPage docs/man/man1/*.1 - ''; - - # internal import errors, missing dependencies - doCheck = false; - - passthru = { - collections = ansible-collections; - }; - - meta = with lib; { - description = "Radically simple IT automation"; - homepage = "https://www.ansible.com"; - license = licenses.gpl3Plus; - maintainers = with maintainers; [ hexa ]; - }; -} diff --git a/pkgs/development/python-modules/ansible/collections.nix b/pkgs/development/python-modules/ansible/collections.nix deleted file mode 100644 index 427e76a979cbf..0000000000000 --- a/pkgs/development/python-modules/ansible/collections.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, jsonschema -, jxmlease -, ncclient -, netaddr -, paramiko -, pynetbox -, scp -, textfsm -, ttp -, xmltodict -, withJunos ? false -, withNetbox ? false - -, version -, sha256 -}: - -buildPythonPackage rec { - pname = "ansible"; - inherit version; - format = "setuptools"; - - src = fetchPypi { - inherit pname version sha256; - }; - - postPatch = '' - # make ansible-base depend on ansible-collection, not the other way around - sed -Ei '/ansible-(base|core)/d' setup.py - ''; - - propagatedBuildInputs = lib.unique ([ - # Support ansible collections by default, make all others optional - # ansible.netcommon - jxmlease - ncclient - netaddr - paramiko - xmltodict - # ansible.posix - # ansible.utils - jsonschema - textfsm - ttp - xmltodict - # ansible.windows - - # lots of collections with dedicated requirements.txt and pyproject.toml files, - # add the dependencies for the collections you need conditionally and install - # ansible using overrides to enable the collections you need. - ] ++ lib.optionals (withJunos) [ - # ansible_collections/junipernetworks/junos/requirements.txt - jxmlease - ncclient - paramiko - scp - xmltodict - ] ++ lib.optionals (withNetbox) [ - # ansible_collections/netbox/netbox/pyproject.toml - pynetbox - ]); - - # don't try and fail to strip 48000+ non strippable files, it takes >5 minutes! - dontStrip = true; - - # difficult to test - doCheck = false; - - meta = with lib; { - description = "Radically simple IT automation"; - homepage = "https://www.ansible.com"; - license = licenses.gpl3Plus; - maintainers = with maintainers; [ hexa ]; - }; -} diff --git a/pkgs/development/python-modules/ansible/core.nix b/pkgs/development/python-modules/ansible/core.nix index 7b00ac9b2c4d8..49ae39feba7b9 100644 --- a/pkgs/development/python-modules/ansible/core.nix +++ b/pkgs/development/python-modules/ansible/core.nix @@ -3,6 +3,7 @@ , buildPythonPackage , fetchPypi , installShellFiles +, ansible , cryptography , jinja2 , junit-xml @@ -21,12 +22,6 @@ , xmltodict }: -let - ansible-collections = callPackage ./collections.nix { - version = "5.6.0"; - sha256 = "sha256-rNMHMUNBVNo3bO7rQW7hVBzfuOo8ZIAjpVo0yz7K+fM="; - }; -in buildPythonPackage rec { pname = "ansible-core"; version = "2.12.5"; @@ -49,8 +44,8 @@ buildPythonPackage rec { ]; propagatedBuildInputs = [ - # depend on ansible-collections instead of the other way around - ansible-collections + # depend on ansible instead of the other way around + ansible # from requirements.txt cryptography jinja2 @@ -77,10 +72,6 @@ buildPythonPackage rec { # internal import errors, missing dependencies doCheck = false; - passthru = { - collections = ansible-collections; - }; - meta = with lib; { description = "Radically simple IT automation"; homepage = "https://www.ansible.com"; diff --git a/pkgs/development/python-modules/ansible/default.nix b/pkgs/development/python-modules/ansible/default.nix new file mode 100644 index 0000000000000..1d2bb9505a27e --- /dev/null +++ b/pkgs/development/python-modules/ansible/default.nix @@ -0,0 +1,84 @@ +{ lib +, pythonOlder +, buildPythonPackage +, fetchPypi +, jsonschema +, jxmlease +, ncclient +, netaddr +, paramiko +, pynetbox +, scp +, textfsm +, ttp +, xmltodict + +# optionals +, withJunos ? false +, withNetbox ? false +}: + +let + pname = "ansible"; + version = "5.6.0"; +in +buildPythonPackage { + inherit pname version; + format = "setuptools"; + + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-rNMHMUNBVNo3bO7rQW7hVBzfuOo8ZIAjpVo0yz7K+fM="; + }; + + postPatch = '' + # we make ansible-core depend on ansible, not the other way around + sed -Ei '/ansible-core/d' setup.py + ''; + + propagatedBuildInputs = lib.unique ([ + # Support ansible collections by default, make all others optional + # ansible.netcommon + jxmlease + ncclient + netaddr + paramiko + xmltodict + # ansible.posix + # ansible.utils + jsonschema + textfsm + ttp + xmltodict + # ansible.windows + + # lots of collections with dedicated requirements.txt and pyproject.toml files, + # add the dependencies for the collections you need conditionally and install + # ansible using overrides to enable the collections you need. + ] ++ lib.optionals (withJunos) [ + # ansible_collections/junipernetworks/junos/requirements.txt + jxmlease + ncclient + paramiko + scp + xmltodict + ] ++ lib.optionals (withNetbox) [ + # ansible_collections/netbox/netbox/pyproject.toml + pynetbox + ]); + + # don't try and fail to strip 48000+ non strippable files, it takes >5 minutes! + dontStrip = true; + + # difficult to test + doCheck = false; + + meta = with lib; { + description = "Radically simple IT automation"; + homepage = "https://www.ansible.com"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ hexa ]; + }; +} diff --git a/pkgs/development/python-modules/ansible/legacy.nix b/pkgs/development/python-modules/ansible/legacy.nix deleted file mode 100644 index 50662b43f32c0..0000000000000 --- a/pkgs/development/python-modules/ansible/legacy.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ lib -, fetchPypi -, buildPythonPackage -, pycrypto -, paramiko -, jinja2 -, pyyaml -, httplib2 -, six -, netaddr -, dnspython -, jmespath -, dopy -, ncclient -, windowsSupport ? false -, pywinrm -}: - -buildPythonPackage rec { - pname = "ansible"; - version = "2.9.27"; - - src = fetchPypi { - inherit pname version; - sha256 = "sha256-R5FZ5Qs72Qkg0GvFlBDDpR0/m+m04QKeEdHkotBwVzY="; - }; - - prePatch = '' - # ansible-connection is wrapped, so make sure it's not passed - # through the python interpreter. - sed -i "s/\[python, /[/" lib/ansible/executor/task_executor.py - ''; - - postInstall = '' - for m in docs/man/man1/*; do - install -vD $m -t $out/share/man/man1 - done - ''; - - propagatedBuildInputs = [ - pycrypto paramiko jinja2 pyyaml httplib2 - six netaddr dnspython jmespath dopy ncclient - ] ++ lib.optional windowsSupport pywinrm; - - # dificult to test - doCheck = false; - - meta = with lib; { - homepage = "https://www.ansible.com"; - description = "Radically simple IT automation"; - license = [ licenses.gpl3 ] ; - maintainers = with maintainers; [ joamaki costrouc hexa ]; - platforms = platforms.linux ++ platforms.darwin; - }; -} diff --git a/pkgs/tools/admin/ansible/default.nix b/pkgs/tools/admin/ansible/default.nix deleted file mode 100644 index 6be403b9e5343..0000000000000 --- a/pkgs/tools/admin/ansible/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ python3Packages, fetchFromGitHub }: - -rec { - ansible = ansible_2_12; - - ansible_2_12 = python3Packages.toPythonApplication python3Packages.ansible-core; - - ansible_2_11 = python3Packages.toPythonApplication (python3Packages.ansible-core.overridePythonAttrs (old: rec { - pname = "ansible-core"; - version = "2.11.6"; - - src = python3Packages.fetchPypi { - inherit pname version; - sha256 = "sha256-k9UCg8fFtHbev4PcCJs/Z5uTmouae11ijSjar7s9MDo="; - }; - })); - - ansible_2_10 = python3Packages.toPythonApplication python3Packages.ansible-base; - - # End of support 2021/10/02, End of life 2021/12/31 - ansible_2_9 = python3Packages.toPythonApplication python3Packages.ansible; - - ansible_2_8 = throw "Ansible 2.8 went end of life on 2021/01/03 and has subsequently been dropped"; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 48af07f992399..fcfce41aac13f 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -74,6 +74,9 @@ mapAliases ({ amuleGui = throw "amuleGui was renamed to amule-gui"; # Added 2022-02-11 amsn = throw "amsn has been removed due to being unmaintained"; # Added 2020-12-09 angelfish = libsForQt5.plasmaMobileGear.angelfish; # Added 2021-10-06 + ansible_2_11 = throw "Ansible 2.11 goes end of life in 2022/11 and can't be supported throughout the 22.05 release cycle"; # Added 2022-03-30 + ansible_2_10 = throw "Ansible 2.10 went end of life in 2022/05 and has subsequently been dropped"; # Added 2022-03-30 + ansible_2_9 = throw "Ansible 2.9 went end of life in 2022/05 and has subsequently been dropped"; # Added 2022-03-30 antimicro = throw "antimicro has been removed as it was broken, see antimicrox instead"; # Added 2020-08-06 antimicroX = antimicrox; # Added 2021-10-31 ardour_5 = throw "ardour_5 has been removed. see https://github.com/NixOS/nixpkgs/issues/139549"; # Added 2021-09-28 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index db85ec6224761..b8b441b511f05 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14661,12 +14661,8 @@ with pkgs; autoadb = callPackage ../misc/autoadb { }; - inherit (callPackage ../tools/admin/ansible { }) - ansible - ansible_2_8 - ansible_2_9 - ansible_2_10 - ansible_2_11; + ansible = ansible_2_12; + ansible_2_12 = python3Packages.toPythonApplication python3Packages.ansible-core; ansible-lint = with python3.pkgs; toPythonApplication ansible-lint; diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 9d912ee5e601d..d1635ed3b8cc3 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -34,6 +34,7 @@ in mapAliases ({ aioh2 = throw "aioh2 has been removed because it is abandoned and broken."; # Added 2022-03-30 + ansible-base = throw "ansible-base has been removed, because it is end of life"; # added 2022-03-30 anyjson = throw "anyjson has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-01-18 asyncio-nats-client = nats-py; # added 2022-02-08 bitcoin-price-api = throw "bitcoin-price-api has been removed, it was using setuptools 2to3 translation feautre, which has been removed in setuptools 58"; # added 2022-02-15 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d90f18b8ceea1..82eb666487143 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -513,9 +513,7 @@ in { ansi2html = callPackage ../development/python-modules/ansi2html { }; - ansible = callPackage ../development/python-modules/ansible/legacy.nix { }; - - ansible-base = callPackage ../development/python-modules/ansible/base.nix { }; + ansible = callPackage ../development/python-modules/ansible { }; ansible-compat = callPackage ../development/python-modules/ansible-compat { }; -- cgit 1.4.1