unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
@ 2022-03-05 12:06 fesoj000
  2022-03-05 20:12 ` Maxime Devos
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: fesoj000 @ 2022-03-05 12:06 UTC (permalink / raw)
  To: 54266

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





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-03-05 20:12 UTC (permalink / raw)
  To: fesoj000, 54266

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  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
  2022-03-08 20:39   ` Maxime Devos
  2022-03-08 20:44   ` Maxime Devos
  2022-03-08 23:10 ` fesoj000
  2022-03-18 21:58 ` [bug#54266] [PATCH] gnu: samba: wrap scripts fesoj000
  3 siblings, 2 replies; 13+ messages in thread
From: fesoj000 @ 2022-03-08 19:26 UTC (permalink / raw)
  To: 54266

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





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  2022-03-08 19:26 ` fesoj000
@ 2022-03-08 20:39   ` Maxime Devos
  2022-03-08 22:01     ` fesoj000
  2022-03-08 20:44   ` Maxime Devos
  1 sibling, 1 reply; 13+ messages in thread
From: Maxime Devos @ 2022-03-08 20:39 UTC (permalink / raw)
  To: fesoj000, 54266

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

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?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  2022-03-08 19:26 ` fesoj000
  2022-03-08 20:39   ` Maxime Devos
@ 2022-03-08 20:44   ` Maxime Devos
       [not found]     ` <07a2e445-f1b8-16dc-ba68-add645ba2588@gmail.com>
  1 sibling, 1 reply; 13+ messages in thread
From: Maxime Devos @ 2022-03-08 20:44 UTC (permalink / raw)
  To: fesoj000, 54266

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  2022-03-08 20:39   ` Maxime Devos
@ 2022-03-08 22:01     ` fesoj000
  0 siblings, 0 replies; 13+ messages in thread
From: fesoj000 @ 2022-03-08 22:01 UTC (permalink / raw)
  To: Maxime Devos, 54266

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





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
       [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
  1 sibling, 1 reply; 13+ messages in thread
From: fesoj000 @ 2022-03-08 22:21 UTC (permalink / raw)
  To: 54266


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




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
       [not found]     ` <07a2e445-f1b8-16dc-ba68-add645ba2588@gmail.com>
  2022-03-08 22:21       ` fesoj000
@ 2022-03-08 22:28       ` Maxime Devos
  1 sibling, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-03-08 22:28 UTC (permalink / raw)
  To: fesoj000; +Cc: 54266

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

[Please keep 54266@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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  2022-03-08 22:21       ` fesoj000
@ 2022-03-08 22:29         ` Maxime Devos
  0 siblings, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-03-08 22:29 UTC (permalink / raw)
  To: fesoj000, 54266

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

Nevermind the comment about keeping debbugs in CC or To, seems like the
mail was received twice and one of them has 54266@debbugs.gnu.org

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
       [not found] <bf8a5283-8c17-0ee7-fe17-a376157f9677@gmail.com>
@ 2022-03-08 23:09 ` fesoj000
  2023-01-16 17:53   ` Maxim Cournoyer
  0 siblings, 1 reply; 13+ messages in thread
From: fesoj000 @ 2022-03-08 23:09 UTC (permalink / raw)
  To: 54266


On 3/8/22 11:28 PM, Maxime Devos wrote:
> [Please keep 54266@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 ...)




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  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
@ 2022-03-08 23:10 ` fesoj000
  2022-03-18 21:58 ` [bug#54266] [PATCH] gnu: samba: wrap scripts fesoj000
  3 siblings, 0 replies; 13+ messages in thread
From: fesoj000 @ 2022-03-08 23:10 UTC (permalink / raw)
  To: 54266

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





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] gnu: samba: wrap scripts
  2022-03-05 12:06 [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH fesoj000
                   ` (2 preceding siblings ...)
  2022-03-08 23:10 ` fesoj000
@ 2022-03-18 21:58 ` fesoj000
  3 siblings, 0 replies; 13+ messages in thread
From: fesoj000 @ 2022-03-18 21:58 UTC (permalink / raw)
  To: 54266

Are there still open issues which are not addressed by the last patch?

BR




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH
  2022-03-08 23:09 ` [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH fesoj000
@ 2023-01-16 17:53   ` Maxim Cournoyer
  0 siblings, 0 replies; 13+ messages in thread
From: Maxim Cournoyer @ 2023-01-16 17:53 UTC (permalink / raw)
  To: fesoj000; +Cc: 54266

Hi,

fesoj000 <fesoj000@gmail.com> writes:

> On 3/8/22 11:28 PM, Maxime Devos wrote:
>> [Please keep 54266@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@debbugs.gnu.org).

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-01-16 17:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).