[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
18/21: gnu: Add ansible-core.
From: |
guix-commits |
Subject: |
18/21: gnu: Add ansible-core. |
Date: |
Sun, 29 Aug 2021 01:16:35 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository guix.
commit 83bf3c63dab980cf129dc18e87ee8ff515740995
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Thu Aug 26 21:31:27 2021 -0400
gnu: Add ansible-core.
* gnu/packages/admin.scm (ansible-core): New variable.
---
gnu/packages/admin.scm | 135 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 5a97cbf..8b9cfea 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -134,11 +135,14 @@
#:use-module (gnu packages qt)
#:use-module (gnu packages readline)
#:use-module (gnu packages ruby)
+ #:use-module (gnu packages selinux)
#:use-module (gnu packages serialization)
+ #:use-module (gnu packages ssh)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages tcl)
#:use-module (gnu packages terminals)
#:use-module (gnu packages texinfo)
+ #:use-module (gnu packages time)
#:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (gnu packages web)
@@ -2462,6 +2466,137 @@ Statsd, Librato and InfluxDB. Graphios can emit Nagios
metrics to any number
of supported upstream metrics systems simultaneously.")
(license license:gpl2+)))
+(define-public ansible-core
+ (package
+ (name "ansible-core")
+ (version "2.11.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "ansible-core" version))
+ (sha256
+ (base32
+ "0jgahcv2pyc5ky0wir55a1h9q9d6rgqj60rqmvlpbj76vz1agsi2"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:modules ((guix build python-build-system)
+ (guix build utils)
+ (ice-9 ftw))
+ #:phases
+ (modify-phases %standard-phases
+ ;; Several ansible commands (ansible-config, ansible-console, etc.)
+ ;; are just symlinks to a single ansible executable. The ansible
+ ;; executable behaves differently based on the value of sys.argv[0].
+ ;; This does not work well with our wrap phase, and therefore the
+ ;; following two phases are required as a workaround.
+ (add-after 'unpack 'hide-wrapping
+ (lambda _
+ ;; Overwrite sys.argv[0] to hide the wrapper script from it.
+ (substitute* "bin/ansible"
+ (("import traceback" all)
+ (string-append all "
+import re
+sys.argv[0] = re.sub(r'\\.([^/]*)-real$', r'\\1', sys.argv[0])
+")))))
+ (add-after 'install 'replace-symlinks
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; Replace symlinks with duplicate copies of the ansible
+ ;; executable so that sys.argv[0] has the correct value.
+ (define bin (string-append (assoc-ref outputs "out") "/bin"))
+ (with-directory-excursion bin
+ (for-each
+ (lambda (ansible-symlink)
+ (delete-file ansible-symlink)
+ (copy-file "ansible" ansible-symlink))
+ (scandir "." (lambda (x)
+ (and (eq? 'symlink (stat:type (lstat x)))
+ (string-prefix? "ansible-" x)
+ (string=? "ansible" (readlink x)))))))))
+ (add-after 'unpack 'preserve-pythonpath
+ (lambda _
+ (substitute* "test/lib/ansible_test/_internal/ansible_util.py"
+ (("PYTHONPATH=get_ansible_python_path\\(args\\)" all)
+ (string-append all "+ ':' + os.environ['PYTHONPATH']")))))
+ (add-after 'unpack 'patch-paths
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* "lib/ansible/module_utils/compat/selinux.py"
+ (("libselinux.so.1" name)
+ (string-append (assoc-ref inputs "libselinux")
+ "/lib/" name)))
+ (substitute* "test/units/modules/test_async_wrapper.py"
+ (("/usr/bin/python")
+ (which "python")))))
+ (replace 'check
+ ;; The environment for the test suite can be tricky to get right.
+ ;; The environment used for Ansible's CI defined in the following
+ ;; Dockerfile can be used as a reference:
+ ;; https://raw.githubusercontent.com/ansible/
+ ;; default-test-container/master/Dockerfile.
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ ;; Otherwise Ansible fails to create its config directory.
+ (setenv "HOME" "/tmp")
+ (setenv "PATH" (string-append (getenv "PATH") ":"
+ (assoc-ref outputs "out") "/bin"))
+ (add-installed-pythonpath inputs outputs)
+ ;; This test module messes up with sys.path and causes many
+ ;; test failures.
+ (delete-file "test/units/_vendor/test_vendor.py")
+ ;; The test fails when run in the container, for reasons
+ ;; unknown.
+ (delete-file "test/units/utils/test_display.py")
+ ;; This test fail for reasons unknown.
+ (delete-file "test/units/cli/test_adhoc.py")
+ ;; The test suite needs to be run with 'ansible-test', which
+ ;; does some extra environment setup. Taken from
+ ;; https://raw.githubusercontent.com/ansible/ansible/\
+ ;; devel/test/utils/shippable/shippable.sh.
+ (invoke "ansible-test" "units" "-v")))))))
+ (native-inputs
+ `(("openssh" ,openssh)
+ ("openssl" ,openssl)
+ ("python-mock" ,python-mock)
+ ("python-pycrypto" ,python-pycrypto)
+ ("python-pytest" ,python-pytest)
+ ("python-pytest-forked" ,python-pytest-forked)
+ ("python-pytest-mock" ,python-pytest-mock)
+ ("python-pytest-xdist" ,python-pytest-xdist)
+ ("python-pytz" ,python-pytz)))
+ (inputs ;optional dependencies captured in wrap scripts
+ `(("libselinux" ,libselinux)
+ ("python-paramiko" ,python-paramiko)
+ ("python-passlib" ,python-passlib)
+ ("python-pexpect" ,python-pexpect)
+ ("sshpass" ,sshpass)))
+ (propagated-inputs ;core dependencies listed in egg-info/requires.txt
+ `(("python-cryptography" ,python-cryptography)
+ ("python-jinja2" ,python-jinja2)
+ ("python-pyyaml" ,python-pyyaml)
+ ("python-packaging" ,python-packaging) ;for version number parsing
+ ("python-resolvelib" ,python-resolvelib-0.5)))
+ (home-page "https://www.ansible.com/")
+ (synopsis "Radically simple IT automation")
+ (description "Ansible aims to be a radically simple IT automation system.
+It handles configuration management, application deployment, cloud
+provisioning, ad-hoc task execution, network automation, and multi-node
+orchestration. Ansible facilitates complex changes like zero-downtime rolling
+updates with load balancers. This package is the core of Ansible, which
+provides the following commands:
+@itemize
+@item ansible
+@item ansible-config
+@item ansible-connection
+@item ansible-console
+@item ansible-doc
+@item ansible-galaxy
+@item ansible-inventory
+@item ansible-playbook
+@item ansible-pull
+@item ansible-test
+@item ansible-vault
+@end itemize")
+ (license license:gpl3+)))
+
(define-public ansible
(package
(name "ansible")
- 14/21: gnu: python-pytest-asyncio: Enable tests and patch for Python 3.8., (continued)
- 14/21: gnu: python-pytest-asyncio: Enable tests and patch for Python 3.8., guix-commits, 2021/08/29
- 16/21: gnu: python-pytest-xdist: Fix by downgrading to 1.34.0, run test suite., guix-commits, 2021/08/29
- 20/21: gnu: python-django: Update to 3.2.6., guix-commits, 2021/08/29
- 04/21: gnu: Add python-resolvelib., guix-commits, 2021/08/29
- 06/21: gnu: Add python-ncclient., guix-commits, 2021/08/29
- 07/21: gnu: Add python-pyspnego., guix-commits, 2021/08/29
- 11/21: gnu: python-mock: Update description., guix-commits, 2021/08/29
- 19/21: gnu: ansible: Update to 4.4.0., guix-commits, 2021/08/29
- 15/21: gnu: python-pytest-mock: Update to 3.6.1 and run test suite., guix-commits, 2021/08/29
- 13/21: gnu: python-pytest-forked: Update to 1.3.0 and run test suite., guix-commits, 2021/08/29
- 18/21: gnu: Add ansible-core.,
guix-commits <=
- 21/21: gnu: python-pytest-django: Update to 4.4.0., guix-commits, 2021/08/29
- 17/21: gnu: Add python-pytest-xdist-next., guix-commits, 2021/08/29