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
This commit is contained in:
Martin Weinelt
2022-03-30 19:55:20 +02:00
parent 909fa26161
commit 0f946e2875
9 changed files with 24 additions and 196 deletions

View File

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

View File

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

View File

@@ -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 ([

View File

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