all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: fesoj000 <fesoj000@gmail.com>
To: 54266@debbugs.gnu.org
Subject: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 8 Mar 2022 20:26:24 +0100	[thread overview]
Message-ID: <f407fb7d-c411-7696-19a8-ae99eba69eab@gmail.com> (raw)
In-Reply-To: <50be1b85-e682-d910-970c-14a08275278f@gmail.com>

Tools like samba-tool need the python libraries installed by samba and some of
sambas inputs.

* gnu/packages/samba.scm: new buildstep
(samba)[wrap-scripts]: Add build step.
---
  gnu/packages/samba.scm | 46 ++++++++++++++++++++++++++++++++++--------
  1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b775ad905c..2bdf89163e 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)
@@ -193,10 +194,13 @@ (define-public samba
          (base32 "0zyid2np45kl8hzp9fjqwvn5lxj766a4f0mya58vldqrhcrmw4b9"))))
      (build-system gnu-build-system)
      (arguments
-     (list
-      #:make-flags #~(list "TEST_OPTIONS=--quick") ;some tests are very long
-      #:phases
-      #~(modify-phases %standard-phases
+     `(#:make-flags '("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
              (lambda* (#:key inputs #:allow-other-keys)
                ;; Append Samba's own DTDs to XML_CATALOG_FILES
@@ -212,12 +216,13 @@ (define-public samba
                   (string-append all " $XML_CATALOG_FILES")))))
            (replace 'configure
              ;; Samba uses a custom configuration script that runs WAF.
-            (lambda* (#:key inputs #:allow-other-keys)
-              (let* ((libdir (string-append #$output "/lib")))
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (libdir (string-append out "/lib")))
                  (invoke "./configure"
                          "--enable-selftest"
                          "--enable-fhs"
-                        (string-append "--prefix=" #$output)
+                        (string-append "--prefix=" out)
                          "--sysconfdir=/etc"
                          "--localstatedir=/var"
                          ;; Install public and private libraries into
@@ -231,12 +236,37 @@ (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 outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (define (site-package-path python)
+                  (string-append "/lib/python" (python-version python)
+                                 "/site-packages"))
+                (define (guix-pythonpath site-package-path)
+                  (string-join
+                   (append (map (lambda (input)
+                                  (string-append (assoc-ref inputs input)
+                                                 site-package-path))
+                                '("tdb" "ldb" "talloc"))
+                           (list (string-append out site-package-path)))
+                   ":"))
+                (for-each (lambda (file)
+                            (wrap-program (string-append out 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





  parent reply	other threads:[~2022-03-08 19:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05 12:06 [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH fesoj000
2022-03-05 20:12 ` Maxime Devos
2022-03-08 19:26 ` fesoj000 [this message]
2022-03-08 20:39   ` Maxime Devos
2022-03-08 22:01     ` fesoj000
2022-03-08 20:44   ` Maxime Devos
     [not found]     ` <07a2e445-f1b8-16dc-ba68-add645ba2588@gmail.com>
2022-03-08 22:21       ` fesoj000
2022-03-08 22:29         ` Maxime Devos
2022-03-08 22:28       ` Maxime Devos
2022-03-08 23:10 ` fesoj000
2022-03-18 21:58 ` [bug#54266] [PATCH] gnu: samba: wrap scripts fesoj000
     [not found] <bf8a5283-8c17-0ee7-fe17-a376157f9677@gmail.com>
2022-03-08 23:09 ` [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH fesoj000
2023-01-16 17:53   ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f407fb7d-c411-7696-19a8-ae99eba69eab@gmail.com \
    --to=fesoj000@gmail.com \
    --cc=54266@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.