gnu: ansible-core: Update to 2.14.4.

* gnu/packages/admin.scm (ansible-core): Update to 2.14.4.
[arguments]: Add skip-controller-tests phase.  Update preserve-pythonpath
and check phases.  Honor parallel-job-count in check phase.
This commit is contained in:
Maxim Cournoyer 2023-04-13 23:45:41 -04:00
parent 4116b7a9f5
commit fc5dd35b07
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -35,7 +35,7 @@
;;; Copyright © 2020, 2021, 2022 Michael Rohleder <mike@rohleder.de>
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
@ -2795,13 +2795,13 @@ (define-public fdupes
(define-public ansible-core
(package
(name "ansible-core")
(version "2.11.6")
(version "2.14.4")
(source
(origin
(method url-fetch)
(uri (pypi-uri "ansible-core" version))
(sha256
(base32 "0fih7nxszni8imi5sywsifd976v77ydhip43pzg7dd65qy1h5mck"))))
(base32 "057g87smxcn6zc558xk4zr6ga4q8clmkyxghn5gx60a94sy61clh"))))
(build-system python-build-system)
(arguments
`(#:modules ((guix build python-build-system)
@ -2837,10 +2837,25 @@ (define bin (string-append (assoc-ref outputs "out") "/bin"))
(and (eq? 'symlink (stat:type (lstat x)))
(string-prefix? "ansible-" x)
(string=? "ansible" (readlink x)))))))))
(add-after 'unpack 'skip-controller-tests
(lambda _
;; XXX: This disables all the controller tests, which fail for
;; unknown reasons, seemingly while attempting to set the
;; locale to en_US.UTF-8.
(substitute* "test/lib/ansible_test/_internal/commands\
/units/__init__.py"
(("^ if test_context == TestContext.controller:.*"
all)
(string-append all " continue\n")))))
(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['GUIX_PYTHONPATH']")))
(substitute* "test/lib/ansible_test/_internal/commands\
/units/__init__.py"
(("PYTHONPATH=get_units_ansible_python_path\\(args, \
test_context)" all)
(string-append all "+ ':' + os.environ['GUIX_PYTHONPATH']")))))
(add-after 'unpack 'patch-paths
(lambda* (#:key inputs outputs #:allow-other-keys)
@ -2852,18 +2867,10 @@ (define bin (string-append (assoc-ref outputs "out") "/bin"))
(("/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")
@ -2872,11 +2879,23 @@ (define bin (string-append (assoc-ref outputs "out") "/bin"))
(delete-file "test/units/utils/test_display.py")
;; This test fail for reasons unknown.
(delete-file "test/units/cli/test_adhoc.py")
;; These tests fail in the container; it appears that the
;; mocking of the absolute file names such as /usr/bin/svcs do
;; not work as intended there.
(delete-file "test/units/modules/test_iptables.py")
(delete-file "test/units/modules/test_service.py")
;; These tests fail with a "unsupported locale setting" error
;; when invoking 'locale.setlocale(locale.LC_ALL, '')'
(delete-file "test/units/module_utils/basic/\
test_command_nonexisting.py")
(delete-file "test/units/module_utils/basic/test_tmpdir.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")))))))
(invoke "ansible-test" "units" "-v"
"--num-workers" (number->string
(parallel-job-count)))))))))
(native-inputs
(list openssh
openssl
@ -2894,7 +2913,7 @@ (define bin (string-append (assoc-ref outputs "out") "/bin"))
(list python-cryptography
python-jinja2
python-pyyaml
python-packaging ;for version number parsing
python-packaging ;for version number parsing
python-resolvelib-0.5))
(home-page "https://www.ansible.com/")
(synopsis "Radically simple IT automation")