From patchwork Tue Mar 8 22:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: fesoj000 X-Patchwork-Id: 37693 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2C50F27BBEA; Tue, 8 Mar 2022 22:22:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A85A727BBE9 for ; Tue, 8 Mar 2022 22:22:09 +0000 (GMT) Received: from localhost ([::1]:52616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRiDY-0002aS-Rc for patchwork@mira.cbaines.net; Tue, 08 Mar 2022 17:22:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRiDS-0002a6-Ia for guix-patches@gnu.org; Tue, 08 Mar 2022 17:22:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRiDS-0000v3-AF for guix-patches@gnu.org; Tue, 08 Mar 2022 17:22:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nRiDS-0002pD-6U for guix-patches@gnu.org; Tue, 08 Mar 2022 17:22:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54266] [PATCH] samba: wrap scripts with GUIX_PYTHONPATH Resent-From: fesoj000 Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 08 Mar 2022 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54266@debbugs.gnu.org Received: via spool by 54266-submit@debbugs.gnu.org id=B54266.164677812010849 (code B ref 54266); Tue, 08 Mar 2022 22:22:02 +0000 Received: (at 54266) by debbugs.gnu.org; 8 Mar 2022 22:22:00 +0000 Received: from localhost ([127.0.0.1]:58078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRiDP-0002ou-Ov for submit@debbugs.gnu.org; Tue, 08 Mar 2022 17:22:00 -0500 Received: from mail-ej1-f48.google.com ([209.85.218.48]:43781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRiDN-0002oh-Nn for 54266@debbugs.gnu.org; Tue, 08 Mar 2022 17:21:58 -0500 Received: by mail-ej1-f48.google.com with SMTP id d10so934460eje.10 for <54266@debbugs.gnu.org>; Tue, 08 Mar 2022 14:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:references :content-language:reply-to:to:in-reply-to:content-transfer-encoding; bh=oNqoTSw7GjO1UbCbDqZLiRqcz4C8j0ZYt61kh7Dn/eU=; b=RzN5vBGGtQjpvl6xUSR/ntSCAgFUAG05NtyhiPe0uP+7morby0jljUioGkOdsl0GG9 cF8cQUxR24UwGS8muMZFVUa+m7l0Hx1GRBEUr6MRfoX2UT0hjYEe2+07ZqL4S9xCpUM5 dR7EM0jlhHu0pi9phe/sbXlAy6jxp3OViVZnFKnVK70Dag2RlemhuyaAstG4JUFZoeDy b6GhDg9839zU0/y/g4wcstnntcicnjtzODJGvpc1GCX0U+AQZ0uuJtLhWWSrdBLAFDF2 xfwGQrIfJSrdHO6Aqq0rfpcbKEOT20eEkRAmhUamSjS2VabWfe1In1qHnm21TLSS5oZZ krUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:references:content-language:reply-to:to:in-reply-to :content-transfer-encoding; bh=oNqoTSw7GjO1UbCbDqZLiRqcz4C8j0ZYt61kh7Dn/eU=; b=6LnVr14EQ9fsWceFBQ7NtLc8i8XmxQHqX+tRrqe9q8SCdWjRLN29xF+FEwW9Ej+sag rKoYK1LFDWgHlUwxhJMFwoR9RMLbg8XFiKja54rVsRvqWxNFaPBrNBHUMouQASuM64C8 0rmR1nI6pdFpUaHvKevay6fgDFe2GtViS1RY25pZTDhFfWL3iz1n//cyBNqbuKyj+bKS s9sLAVR5QhElPVzWtVHe+0ldyXmakwJCjLc+zGjvD+ObPYDPmSc/lfUlfQYF7pgisgBJ FlG85ZnppDvo5Y+yR09ZSeEZyz9fsZUX7gyR0WbnnrMMf63pBr9psFRlxzw0ybHfg6Ho aY8g== X-Gm-Message-State: AOAM531GMW0EbBSOGh/qgzy5EOU/0T1a1S419GeIWN4pssQgPZPngDI7 xj1IhBh+GVAfDZdJsfO2SvJr7S7o1lU= X-Google-Smtp-Source: ABdhPJzL43i3UNF+IiNkawcv/dtKmNpbHl8QbW0ruOwRWYzEyYKnBOw13wvYYW34KPLxg0NUQXKd+A== X-Received: by 2002:a17:906:fc10:b0:6cd:84e:7248 with SMTP id ov16-20020a170906fc1000b006cd084e7248mr15576915ejb.281.1646778111917; Tue, 08 Mar 2022 14:21:51 -0800 (PST) Received: from ?IPV6:2003:ee:af2f:e00:c2f9:c2bb:bf95:1fc5? (p200300eeaf2f0e00c2f9c2bbbf951fc5.dip0.t-ipconnect.de. [2003:ee:af2f:e00:c2f9:c2bb:bf95:1fc5]) by smtp.gmail.com with ESMTPSA id i22-20020a170906251600b006d6d9081f46sm20571ejb.150.2022.03.08.14.21.51 for <54266@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Mar 2022 14:21:51 -0800 (PST) Message-ID: <42365ae6-a63a-5825-8a96-59a54b706b15@gmail.com> Date: Tue, 8 Mar 2022 23:21:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: fesoj000 References: <07a2e445-f1b8-16dc-ba68-add645ba2588@gmail.com> Content-Language: en-US In-Reply-To: <07a2e445-f1b8-16dc-ba68-add645ba2588@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: fesoj000 Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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