[PATCH] gnu: sudo: Separate Python output.

DoneSubmitted by Mathieu Othacehe.
Details
2 participants
  • Mathieu Othacehe
  • Tobias Geerinckx-Rice
Owner
unassigned
Severity
normal
M
M
Mathieu Othacehe wrote on 6 Jun 2020 11:00
(address . guix-patches@gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
20200606090014.12578-1-othacehe@gnu.org
The Python plugin of "sudo" drag the Python interpreter to the closure of
Guix System. Put it in a separate output.

* gnu/packages/admin.scm (sudo)[arguments]: Add a 'separate-python-output
phase.
---
Hello,

Here's a patch to remove Python from the Guix Sytem closure. As Python
cross-compilation is broken, the "python" output cannot be populated when
cross-compiling. This is not great. An alternative would be not to provide
"python" output when cross-compiling but that requires to turn "output" into a
thunk field, and I been advised not to do that (for performance reasons) in
the past.

WDYT?

Thanks,

Mathieu

gnu/packages/admin.scm | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 77981e520a..9d9d70c88d 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1375,6 +1375,7 @@ system administrator.")
                   (delete-file-recursively "lib/zlib")
                   #t))))
     (build-system gnu-build-system)
+    (outputs (list "out" "python"))
     (arguments
      `(#:configure-flags
        (list (string-append "--docdir=" (assoc-ref %outputs "out")
@@ -1432,7 +1433,23 @@ system administrator.")
              (substitute* "plugins/sudoers/Makefile.in"
                (("^pre-install:" match)
                 (string-append match "\ndisabled-" match)))
-             #t)))
+             #t))
+         (add-after 'install 'separate-python-output
+           (lambda* (#:key target outputs #:allow-other-keys)
+             (let ((out        (assoc-ref outputs "out"))
+                   (out:python (assoc-ref outputs "python")))
+               ;; Python cross-compilation is not working.
+               (if target
+                   (mkdir-p (string-append out:python "/empty"))
+                   (for-each
+                    (lambda (file)
+                      (let ((old (string-append out "/" file))
+                            (new (string-append out:python "/" file)))
+                        (mkdir-p (dirname new))
+                        (rename-file old new)))
+                    (list "libexec/sudo/python_plugin.so"
+                          "libexec/sudo/python_plugin.la")))
+               #t))))
 
        ;; XXX: The 'testsudoers' test series expects user 'root' to exist, but
        ;; the chroot's /etc/passwd doesn't have it.  Turn off the tests.
-- 
2.26.2
T
T
Tobias Geerinckx-Rice wrote on 6 Jun 2020 11:20
(name . Mathieu Othacehe)(address . m.othacehe@gmail.com)(address . 41734@debbugs.gnu.org)
87sgf8a6u5.fsf@nckx
Mathieu,

Mathieu Othacehe 写道:
Toggle quote (4 lines)
> * gnu/packages/admin.scm (sudo)[arguments]: Add a
> 'separate-python-output
> phase.

Missing [outputs] entry.

Toggle quote (2 lines)
> WDYT?

I like it! In fact I suggest dropping the cross-compilation
comment. IMO this doesn't need to be reverted or reconsidered
even when that's fixed.

Thanks,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXttf4gAKCRANsP+IT1Vt
eXioAQCxOjhFrsdChFbvL+G9Ve4HHHOQgQNC2RyOA+YQ8YYt9gEAm3ks9OKJn9IP
Eg16+7FRSXZHRweLY+q7iCqM/CNN/Qk=
=pk2g
-----END PGP SIGNATURE-----

M
M
Mathieu Othacehe wrote on 8 Jun 2020 10:56
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 41734-done@debbugs.gnu.org)
87v9k2aqbu.fsf@gmail.com
Hey Tobias,

Toggle quote (3 lines)
> I like it! In fact I suggest dropping the cross-compilation comment. IMO
> this doesn't need to be reverted or reconsidered even when that's fixed.

Fixed and pushed, thanks for having a look!

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 41734@debbugs.gnu.org