about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2022-03-30 19:55:20 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2022-04-26 11:12:09 +0200
commit0f946e28754e1da24d373fe9c64b89b51acb3463 (patch)
tree535cfc1f5e0b0c8c5095ea61deff59b6dc40649e
parent909fa261613a30f81a94792fae9c582788c86169 (diff)
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
-rw-r--r--pkgs/development/python-modules/ansible/base.nix88
-rw-r--r--pkgs/development/python-modules/ansible/core.nix15
-rw-r--r--pkgs/development/python-modules/ansible/default.nix (renamed from pkgs/development/python-modules/ansible/collections.nix)22
-rw-r--r--pkgs/development/python-modules/ansible/legacy.nix55
-rw-r--r--pkgs/tools/admin/ansible/default.nix24
-rw-r--r--pkgs/top-level/aliases.nix3
-rw-r--r--pkgs/top-level/all-packages.nix8
-rw-r--r--pkgs/top-level/python-aliases.nix1
-rw-r--r--pkgs/top-level/python-packages.nix4
9 files changed, 24 insertions, 196 deletions
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/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/collections.nix b/pkgs/development/python-modules/ansible/default.nix
index 427e76a979cbf..1d2bb9505a27e 100644
--- a/pkgs/development/python-modules/ansible/collections.nix
+++ b/pkgs/development/python-modules/ansible/default.nix
@@ -1,4 +1,5 @@
 { lib
+, pythonOlder
 , buildPythonPackage
 , fetchPypi
 , jsonschema
@@ -11,25 +12,30 @@
 , textfsm
 , ttp
 , xmltodict
+
+# optionals
 , withJunos ? false
 , withNetbox ? false
-
-, version
-, sha256
 }:
 
-buildPythonPackage rec {
+let
   pname = "ansible";
-  inherit version;
+  version = "5.6.0";
+in
+buildPythonPackage {
+  inherit pname version;
   format = "setuptools";
 
+  disabled = pythonOlder "3.8";
+
   src = fetchPypi {
-    inherit pname version sha256;
+    inherit pname version;
+    sha256 = "sha256-rNMHMUNBVNo3bO7rQW7hVBzfuOo8ZIAjpVo0yz7K+fM=";
   };
 
   postPatch = ''
-    # make ansible-base depend on ansible-collection, not the other way around
-    sed -Ei '/ansible-(base|core)/d' setup.py
+    # we make ansible-core depend on ansible, not the other way around
+    sed -Ei '/ansible-core/d' setup.py
   '';
 
   propagatedBuildInputs = lib.unique ([
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 { };