diff mbox series

[bug#54266] samba: wrap scripts with GUIX_PYTHONPATH

Message ID 50be1b85-e682-d910-970c-14a08275278f@gmail.com
State New
Headers show
Series [bug#54266] samba: wrap scripts with GUIX_PYTHONPATH | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

fesoj000 March 5, 2022, 12:06 p.m. UTC
Tools like samba-tool depend on the python libraries installed by samba.

* gnu/packages/samba.scm: new buildstep
(samba)[wrap-scripts]: Add build step.
---
  gnu/packages/samba.scm | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)

             cmocka
             cups
             gamin

Comments

M March 5, 2022, 8:12 p.m. UTC | #1
fesoj000 schreef op za 05-03-2022 om 13:06 [+0100]:
> +                           (wrap-program (string-append out file)
> +                             `("GUIX_PYTHONPATH" = (,(getenv 
> "GUIX_PYTHONPATH")))))

(getenv "...") includes too much, it also includes the python libraries
from native-inputs that are only required for tests.  I recommend:

(string-join
  (map (cut (@ (guix build python-build-system) site-packages)
            (list (assoc-ref inputs "this-python-input")
                  (assoc-ref inputs "that-python-input")
                  [...])
            outputs)
  #\:)

(untested).  Possibly there's a simpler way to do this ...

(Many packages simply do (getenv "GUIX_PYTHONPATH"), but that's a bug
in those packages, see e.g. <https://issues.guix.gnu.org/25235>.)

Greetings,
Maxime.
fesoj000 March 18, 2022, 9:58 p.m. UTC | #2
Are there still open issues which are not addressed by the last patch?

BR
diff mbox series

Patch

diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b775ad905c..e7afe9330d 100644
--- a/gnu/packages/samba.scm
+++ b/gnu/packages/samba.scm
@@ -40,6 +40,7 @@  (define-module (gnu packages samba)
    #:use-module (gnu packages autotools)
    #:use-module (gnu packages backup)
    #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
    #:use-module (gnu packages check)
    #:use-module (gnu packages crypto)
    #:use-module (gnu packages cups)
@@ -231,12 +232,23 @@  (define-public samba
            (add-before 'install 'disable-etc,var-samba-directories-setup
              (lambda _
                (substitute* "dynconfig/wscript"
-                (("bld\\.INSTALL_DIR.*") "")))))
+                (("bld\\.INSTALL_DIR.*") ""))))
+          (add-after 'install 'wrap-scripts
+            (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (file)
+                           (wrap-program (string-append out file)
+                             `("GUIX_PYTHONPATH" = (,(getenv 
"GUIX_PYTHONPATH")))))
+                         '("/bin/samba-tool" "/sbin/samba_dnsupdate"
+                           "/sbin/samba_downgrade_db" 
"/sbin/samba-gpupdate"
+                           "/sbin/samba_kcc" "/sbin/samba_spnupdate"
+                           "/sbin/samba_upgradedns"))))))
        ;; FIXME: The test suite seemingly hangs after failing to 
provision the
        ;; test environment.
        #:tests? #f))
      (inputs
       (list acl
+           bash-minimal