guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH


From: fesoj000
Subject: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 8 Mar 2022 23:21:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1


On 3/8/22 9:44 PM, Maxime Devos wrote:
fesoj000 schreef op di 08-03-2022 om 20:26 [+0100]:
+                            (wrap-program (string-append out file)
+                              `("GUIX_PYTHONPATH" =
+                                (,(guix-pythonpath
+                                   (site-package-path
+                                    (assoc-ref inputs "python")))))))

I would expect that python always puts its own site-packages in front
of the path, though I could be mistaken, so is this necessary?hm, "python3 -c 
'import sys; print(sys.path)'" always includes its own site
packages. If you talk about the samba package output then we can do this like
the new diff below.

Also, it looks like some of the python stuf uses 'ldb', so 'ldb' might
need to be included as well.
'ldb' is included, you can look at the guix-pythonpath function which builds
the pythonpath. In fact not only 'ldb' is need but further 'tdb' and 'talloc'.


diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b775ad905c..fa8ff5b6bb 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)
@@ -195,6 +196,10 @@ (define-public samba
     (arguments
      (list
       #:make-flags #~(list "TEST_OPTIONS=--quick") ;some tests are very long
+      #:imported-modules `((guix build python-build-system)
+                           ,@%gnu-build-system-modules)
+      #:modules `(((guix build python-build-system) #:select (python-version))
+                  ,@%gnu-build-system-modules)
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'configure 'setup-docbook-stylesheets
@@ -231,12 +236,36 @@ (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 inputs #:allow-other-keys)
+              (define (site-package-path python)
+                (string-append "/lib/python" (python-version python)
+                               "/site-packages"))
+              (define (guix-pythonpath site-package-path)
+                (string-join
+                 (append (list (string-append #$output site-package-path))
+                         (map (lambda (input)
+                                (string-append (assoc-ref inputs input)
+                                               site-package-path))
+                              '("tdb" "ldb" "talloc")))
+                 ":"))
+              (for-each (lambda (file)
+                          (wrap-program (string-append #$output file)
+                            `("GUIX_PYTHONPATH" =
+                              (,(guix-pythonpath
+                                 (site-package-path
+                                  (assoc-ref inputs "python")))))))
+                        '("/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
            cmocka
            cups
            gamin
--
2.34.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]