From patchwork Sat Sep 10 15:26:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Bakke X-Patchwork-Id: 42442 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 85D7F27BBEA; Sat, 10 Sep 2022 16:27:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 059A327BBE9 for ; Sat, 10 Sep 2022 16:27:11 +0100 (BST) Received: from localhost ([::1]:36452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oX2Ny-0000kw-79 for patchwork@mira.cbaines.net; Sat, 10 Sep 2022 11:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX2Nr-0000kV-4I for guix-patches@gnu.org; Sat, 10 Sep 2022 11:27:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oX2Nq-0006JS-SD; Sat, 10 Sep 2022 11:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oX2Nq-0002sn-NW; Sat, 10 Sep 2022 11:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57717] [DRAFT PATCH core-updates] build-systems: Pass #:allowed-references and #:disallowed-references to builders. Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Sat, 10 Sep 2022 15:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57717 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57717@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by submit@debbugs.gnu.org id=B.166282357211023 (code B ref -1); Sat, 10 Sep 2022 15:27:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Sep 2022 15:26:12 +0000 Received: from localhost ([127.0.0.1]:40210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oX2N2-0002rj-Ak for submit@debbugs.gnu.org; Sat, 10 Sep 2022 11:26:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:40254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oX2Mz-0002rZ-8Z for submit@debbugs.gnu.org; Sat, 10 Sep 2022 11:26:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX2Mz-0000H0-33 for guix-patches@gnu.org; Sat, 10 Sep 2022 11:26:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX2My-00069U-Oq for guix-patches@gnu.org; Sat, 10 Sep 2022 11:26:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=ReO0TDOvcb5ioq6B4mcTOYq80LTlejtK2Mu18OOeOB4=; b=dlgcpYmxPZCWfo 7dny03OhiofL8upngwtcM5DcmVdZgUJHwiiiX9Aoi0iyYE0GSljvQiA3LpD13ObnWjqD+GZcrDbgq iQ8T8zAx4hGlBL9/YGLKbWPzZ2Tg2xbON9KqOrKHLzRqKHt7B+0LNHMB4a5EycDrACLFHybqG5pnl B9Fle3snrjYFFo4nYichh7choexZAIk4OSmuPPfa9hGTF0Jn9H2YwDbhnch7bqcGzxwYKc5rRZ+20 bXtcDj+wxr2pBjMzY247SWg6z+ri8TTdbbBn6sTFqwXTsut22pdqzaRbGbnQq9B3PwgB/jhAxSTGP gEA89ZonKX/+C8fEdCSg==; Received: from [84.214.173.6] (port=58818 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX2My-0001f6-4w for guix-patches@gnu.org; Sat, 10 Sep 2022 11:26:08 -0400 From: Marius Bakke Date: Sat, 10 Sep 2022 17:26:04 +0200 Message-Id: <20220910152604.3459-1-marius@gnu.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/build-system/gnu.scm (gnu-build, gnu-cross-build)[builder]: Pass along #:allowed-references and #:disallowed-references. * guix/build-system/meson.scm (meson-build, meson-cross-build)[builder]: Likewise. --- Hello Guix, This is an untested patch that makes #:allowed-references and #:disallowed-references available to build-side code. The intention is to make it easier to use these properties directly when e.g. wrapping. Consider the following: --8<---------------cut here---------------start------------->8--- (arguments (list #:disallowed-references (list (gexp-input glib "bin") (gexp-input inkscape/stable)) #:phases #~(modify-phases %standard-phases (replace 'glib-or-gtk-wrap (let ((wrap (assoc-ref %standard-phases 'glib-or-gtk-wrap))) (lambda* (#:key inputs outputs disallowed-references #:allow-other-keys) (wrap #:inputs (filter (match-lambda ((label . output) (not (member output disallowed-references)))) inputs) #:outputs outputs))))))) --8<---------------cut here---------------end--------------->8--- This way we don't have to build the list of disallowed references twice, which is difficult without labels in the case of e.g. `(,glib "bin"). Note: I implemented a variant of this approach using a let-binding in f0114656876dcf2e09874e4ea0c00cacf31f1bb2, perhaps that is "good enough" as this approach is unlikely to be much used. WDYT? I'll implement this for the remaining build systems if this is at all sane. --- diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 8eea1cd4c2..f85a172153 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -393,6 +393,8 @@ (define builder #:build #$build #:outputs %outputs #:inputs %build-inputs + #:allowed-references #$allowed-references + #:disallowed-references #$disallowed-references #:search-paths '#$(sexp->gexp (map search-path-specification->sexp search-paths)) @@ -531,6 +533,8 @@ (define %outputs #:target #$target #:outputs %outputs #:inputs %build-target-inputs + #:allowed-references #$allowed-references + #:disallowed-references #$disallowed-references #:native-inputs %build-host-inputs #:search-paths '#$(sexp->gexp (map search-path-specification->sexp diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index 9fee6c4570..1bef07230f 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -210,6 +210,8 @@ (define build-phases #$(with-build-variables inputs outputs #~(meson-build #:source #+source #:system #$system + #:allowed-references #$allowed-references + #:disallowed-references #$disallowed-references #:outputs %outputs #:inputs %build-inputs #:search-paths '#$(sexp->gexp @@ -318,6 +320,8 @@ (define build-phases #:system #$system #:build #$(nix-system->gnu-triplet system) #:target #$target + #:allowed-references #$allowed-references + #:disallowed-references #$disallowed-references #:outputs #$(outputs->gexp outputs) #:inputs #$inputs #:native-inputs #+(input-tuples->gexp build-inputs)