diff options
author | Arun Isaac <arunisaac@systemreboot.net> | 2018-12-17 19:32:05 +0530 |
---|---|---|
committer | Arun Isaac <arunisaac@systemreboot.net> | 2018-12-18 11:20:56 +0530 |
commit | 01cb4d47570c38812492bbc331b7b818e1b69fbb (patch) | |
tree | 5b42cc9cb650c7d282df67660ed38ba6d1973649 /gnu/packages/admin.scm | |
parent | 6a9659f5d88b082c3fa831a28ae953c4faed0efc (diff) | |
download | guix-01cb4d47570c38812492bbc331b7b818e1b69fbb.tar guix-01cb4d47570c38812492bbc331b7b818e1b69fbb.tar.gz |
gnu: ansible: Work around issues with Guix wrapper scripts.
* gnu/packages/admin.scm (ansible)[source]: Remove
ansible-wrap-program-hack.patch from patches.
[arguments]: Add hide-wrapping and fix-symlinks phases.
* gnu/packages/patches/ansible-wrap-program-hack.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Unregister it.
Diffstat (limited to 'gnu/packages/admin.scm')
-rw-r--r-- | gnu/packages/admin.scm | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 01deb09950..fa5fa3ab86 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -1608,8 +1608,7 @@ of supported upstream metrics systems simultaneously.") (uri (pypi-uri "ansible" version)) (sha256 (base32 - "1fsif2jmkrrgiawsd8r6sxrqvh01fvrmdhas0p540a6i9fby3yda")) - (patches (search-patches "ansible-wrap-program-hack.patch")))) + "1fsif2jmkrrgiawsd8r6sxrqvh01fvrmdhas0p540a6i9fby3yda")))) (build-system python-build-system) (native-inputs `(("python-bcrypt" ,python-bcrypt) @@ -1626,6 +1625,42 @@ of supported upstream metrics systems simultaneously.") ("python-jinja2" ,python-jinja2) ("python-pyyaml" ,python-pyyaml) ("python-paramiko" ,python-paramiko))) + (arguments + `(#: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]) +"))) + #t)) + (add-after 'wrap 'fix-symlinks + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (for-each + (lambda (subprogram) + ;; The symlinks point to the ansible wrapper script. Make + ;; them point to the real executable (.ansible-real). + (delete-file (string-append out "/bin/.ansible-" subprogram "-real")) + (symlink (string-append out "/bin/.ansible-real") + (string-append out "/bin/.ansible-" subprogram "-real")) + ;; The wrapper scripts of the symlinks invoke the ansible + ;; wrapper script. Fix them to invoke the correct executable. + (substitute* (string-append out "/bin/ansible-" subprogram) + (("/bin/ansible") + (string-append "/bin/.ansible-" subprogram "-real")))) + (list "config" "console" "doc" "galaxy" + "inventory" "playbook" "pull" "vault"))) + #t))))) (home-page "https://www.ansible.com/") (synopsis "Radically simple IT automation") (description "Ansible is a radically simple IT automation system. It |