GNU bug report logs - #54266
[PATCH] samba: wrap scripts with GUIX_PYTHONPATH

Previous Next

Package: guix-patches;

Reported by: fesoj000 <fesoj000 <at> gmail.com>

Date: Sat, 5 Mar 2022 17:27:03 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 54266 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Sat, 05 Mar 2022 17:27:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to fesoj000 <fesoj000 <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 05 Mar 2022 17:27:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Sat, 5 Mar 2022 13:06:04 +0100
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(-)

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
            cmocka
            cups
            gamin
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Sat, 05 Mar 2022 20:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: fesoj000 <fesoj000 <at> gmail.com>, 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Sat, 05 Mar 2022 21:12:09 +0100
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 19:27:01 GMT) Full text and rfc822 format available.

Message #11 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: 54266 <at> debbugs.gnu.org
Subject: [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 8 Mar 2022 20:26:24 +0100
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





Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 20:40:01 GMT) Full text and rfc822 format available.

Message #14 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: fesoj000 <fesoj000 <at> gmail.com>, 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 08 Mar 2022 21:39:05 +0100
[Message part 1 (text/plain, inline)]
fesoj000 schreef op di 08-03-2022 om 20:26 [+0100]:
> -     (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

What's the reason for turning things from G-exps into S-exps?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 20:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: fesoj000 <fesoj000 <at> gmail.com>, 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 08 Mar 2022 21:44:45 +0100
[Message part 1 (text/plain, inline)]
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?

Also, it looks like some of the python stuf uses 'ldb', so 'ldb' might
need to be included as well.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 22:03:01 GMT) Full text and rfc822 format available.

Message #20 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>, 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 8 Mar 2022 23:01:59 +0100
On 3/8/22 9:39 PM, Maxime Devos wrote:
> fesoj000 schreef op di 08-03-2022 om 20:26 [+0100]:
>> -     (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
> 
> What's the reason for turning things from G-exps into S-exps?

Good question, here is the gexp version.

diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b775ad905c..c4457cc11e 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 (map (lambda (input)
+                                (string-append (assoc-ref inputs input)
+                                               site-package-path))
+                              '("tdb" "ldb" "talloc"))
+                         (list (string-append #$output site-package-path)))
+                 ":"))
+              (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





Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 22:22:02 GMT) Full text and rfc822 format available.

Message #23 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 8 Mar 2022 23:21:51 +0100
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




Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 22:29:01 GMT) Full text and rfc822 format available.

Message #26 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: fesoj000 <fesoj000 <at> gmail.com>
Cc: 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 08 Mar 2022 23:28:26 +0100
[Message part 1 (text/plain, inline)]
[Please keep 54266 <at> debbugs.gnu.org in CC]

fesoj000 schreef op di 08-03-2022 om 23:14 [+0100]:
> packages. If you talk about the samba package output then we can do this like
> the new diff below.

Looking at some of the python scripts, it seems that they
add samba's python libraries to the path by theirselves,
so I don't think this is necessary.

> > 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'.

Looking a little closer, it indeed seems fine (untested)!

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 22:30:02 GMT) Full text and rfc822 format available.

Message #29 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: fesoj000 <fesoj000 <at> gmail.com>, 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Tue, 08 Mar 2022 23:29:52 +0100
[Message part 1 (text/plain, inline)]
Nevermind the comment about keeping debbugs in CC or To, seems like the
mail was received twice and one of them has 54266 <at> debbugs.gnu.org
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 23:10:01 GMT) Full text and rfc822 format available.

Message #32 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: 54266 <at> debbugs.gnu.org
Subject: Re: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Wed, 9 Mar 2022 00:09:01 +0100
On 3/8/22 11:28 PM, Maxime Devos wrote:
> [Please keep 54266 <at> debbugs.gnu.org in CC]
> 
> fesoj000 schreef op di 08-03-2022 om 23:14 [+0100]:
>> packages. If you talk about the samba package output then we can do this like
>> the new diff below.
> 
> Looking at some of the python scripts, it seems that they
> add samba's python libraries to the path by theirselves,
> so I don't think this is necessary.
I just tested it, without the samba site-packages path the scripts still seem
to work just fine.

>>> 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'.
> 
> Looking a little closer, it indeed seems fine (untested)!
> 
> Greetings,
> Maxime.

(I again made the mistake to not include debbugs ...)




Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Tue, 08 Mar 2022 23:11:02 GMT) Full text and rfc822 format available.

Message #35 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: 54266 <at> debbugs.gnu.org
Subject: [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Wed, 9 Mar 2022 00:10:48 +0100
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 | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b775ad905c..cb34fd8c2c 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,35 @@ (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
+                 (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





Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Fri, 18 Mar 2022 21:59:01 GMT) Full text and rfc822 format available.

Message #38 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: fesoj000 <fesoj000 <at> gmail.com>
To: 54266 <at> debbugs.gnu.org
Subject: [PATCH] gnu: samba: wrap scripts
Date: Fri, 18 Mar 2022 22:58:19 +0100
Are there still open issues which are not addressed by the last patch?

BR




Information forwarded to guix-patches <at> gnu.org:
bug#54266; Package guix-patches. (Mon, 16 Jan 2023 17:54:01 GMT) Full text and rfc822 format available.

Message #41 received at 54266 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: fesoj000 <fesoj000 <at> gmail.com>
Cc: 54266 <at> debbugs.gnu.org
Subject: Re: bug#54266: [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
Date: Mon, 16 Jan 2023 12:53:49 -0500
Hi,

fesoj000 <fesoj000 <at> gmail.com> writes:

> On 3/8/22 11:28 PM, Maxime Devos wrote:
>> [Please keep 54266 <at> debbugs.gnu.org in CC]
>> fesoj000 schreef op di 08-03-2022 om 23:14 [+0100]:
>>> packages. If you talk about the samba package output then we can do this like
>>> the new diff below.
>> Looking at some of the python scripts, it seems that they
>> add samba's python libraries to the path by theirselves,
>> so I don't think this is necessary.
> I just tested it, without the samba site-packages path the scripts still seem
> to work just fine.
>
>>>> 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'.
>> Looking a little closer, it indeed seems fine (untested)!

I'm a bit lost, is there something left to do here?  Else let's close it
(replying to 54266-done <at> debbugs.gnu.org).

-- 
Thanks,
Maxim




This bug report was last modified 1 year and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.