From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yOLPJWtV42O0agAAbAwnHQ (envelope-from ) for ; Wed, 08 Feb 2023 08:55:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MIrUJWtV42M/GQEA9RJhRA (envelope-from ) for ; Wed, 08 Feb 2023 08:55:23 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5C55E11D51 for ; Wed, 8 Feb 2023 08:55:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPfIJ-0000fW-Oj; Wed, 08 Feb 2023 02:55:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPfIG-0000f3-IC for guix-patches@gnu.org; Wed, 08 Feb 2023 02:55:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pPfIE-0002P4-47; Wed, 08 Feb 2023 02:55:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pPfID-0000Ac-HY; Wed, 08 Feb 2023 02:55:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61363] [PATCH 1/2] packages: Add explicit-grafting record type to assist with grafts. References: <871qn08uo7.fsf@cbaines.net> In-Reply-To: <871qn08uo7.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Wed, 08 Feb 2023 07:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61363 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61363@debbugs.gnu.org Cc: ludo@gnu.org X-Debbugs-Original-Xcc: ludo@gnu.org Received: via spool by 61363-submit@debbugs.gnu.org id=B61363.1675842847578 (code B ref 61363); Wed, 08 Feb 2023 07:55:01 +0000 Received: (at 61363) by debbugs.gnu.org; 8 Feb 2023 07:54:07 +0000 Received: from localhost ([127.0.0.1]:54683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPfHL-00009F-8S for submit@debbugs.gnu.org; Wed, 08 Feb 2023 02:54:07 -0500 Received: from mira.cbaines.net ([212.71.252.8]:42176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPfHJ-000091-K3 for 61363@debbugs.gnu.org; Wed, 08 Feb 2023 02:54:06 -0500 Received: from localhost (unknown [IPv6:2a02:1808:280:f63d:f055:17e:cfb4:3]) by mira.cbaines.net (Postfix) with ESMTPSA id 9081C16D28 for <61363@debbugs.gnu.org>; Wed, 8 Feb 2023 07:54:04 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id eac9e016 for <61363@debbugs.gnu.org>; Wed, 8 Feb 2023 07:54:03 +0000 (UTC) From: Christopher Baines Date: Wed, 8 Feb 2023 08:54:02 +0100 Message-Id: <20230208075403.11788-1-mail@cbaines.net> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675842923; a=rsa-sha256; cv=none; b=bDW+5yonYBf/BtKq3ZBeMqZm34ceiciT5t775WoqVaLcgrmnW3mA2RN8hdj5NeqOWLoXWX KjRX+l10Vp0SJUm98lOmDpV+uAFrAhEMoOS+GnC6mZMVk7KXw5Xl6qus5vccFe5y2g3xOX DsGEP0eY9jMylhU48L+4ogovA2rWX1M3BsLihTL3EAv9BOdqlCE9nOyuOyg46eUUQxNqAa 8jGNxh1yk8JQN3gbZHbGsjsLvy60xXEuTKgwxlGwZchkvJsnXN3aed4xDeJx5bQk7cIkA2 ClqaRiTTZr53vJjFSZuI/vBMxEzV4u2puuZ9bdQpLht5mpTmGdOmYWoe7Xadfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675842923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=h7jdG86gkYZ+iN7h3k1HU3sLbay5i/E7d0u2tROgHKk=; b=AO5LdHzAgOE4+I+upFMStxM/+SrkuJnx55n9u2ZKcgUWQlxaY4FfxqL9UKSkVzhApPOtPW /QCflyvG0m6Y4QZc+ac9eQYcL/t36P7/c34z0iEz2J1Bocm3MF7z5bp8zW4lF197AHn6Gy tXWO3n2XvG4Xqp9g+uPzBsPIyErBqDr0i5VgAa5od7y/S4GC3f/N/qmNwyx2b0KzTiXZ52 o9J1PrhK+MmSRSAIkKEpsfB4do0eMBYiPfJxm0zPfZQe5V5YSO01BPxJhoIplzabtye6nl ToazwklifpyyrtQvhwqr9Umd8NObenhuGnDOVaw1SgdRmUA5+oQCb5BhdN4Yng== X-Migadu-Spam-Score: -1.59 X-Spam-Score: -1.59 X-Migadu-Queue-Id: 5C55E11D51 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-TUID: KKbYoVE0FLi/ Normally the grafting takes place when lowering packages, but this record assists with applying the same transformation to arbitrary objects/store items. I'm adding this to allow grafting the channel instance derivation outputs. * guix/packages.scm (explicit-grafting, explicit-grafting?, explicit-grafting-obj, explicit-grafting-grafts): New procedures. --- guix/packages.scm | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/guix/packages.scm b/guix/packages.scm index 041a872f9d..877bf89522 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -188,7 +188,12 @@ (define-module (guix packages) package-file package->derivation package->cross-derivation - origin->derivation)) + origin->derivation + + explicit-grafting + explicit-grafting? + explicit-grafting-obj + explicit-grafting-grafts)) ;; The 'source-module-closure' procedure ca. 1.2.0 did not recognize ;; #:re-export-and-replace: . @@ -2093,3 +2098,41 @@ (define package-source-derivation ;somewhat deprecated (add-to-store store (basename file) #t "sha256" file)) (_ (lower store source system)))))) + +;; Apply grafts explicitly +(define-immutable-record-type + (%explicit-grafting obj packages) + explicit-grafting? + (obj explicit-grafting-obj) ;obj + (packages explicit-grafting-packages)) ;list of s + +(define (write-explicit-grafting rec port) + (match rec + (($ obj packages) + (format port "#" obj packages)))) + +(define (explicit-grafting obj packages) + (%explicit-grafting obj packages)) + +(define-gexp-compiler (explicit-grafting-compiler (explicit-grafting ) + system target) + (match explicit-grafting + (($ obj packages) + (mlet* %store-monad ((drv (without-grafting + (lower-object obj system #:target target))) + (grafts + (mapm %store-monad + (lambda (pkg) + (package-grafts* pkg system #:target target)) + packages))) + (match (delete-duplicates + (concatenate grafts)) + (() + (return drv)) + (grafts + (mlet %store-monad ((guile (package->derivation + (guile-for-grafts) + system #:graft? #f))) + (graft-derivation* drv grafts + #:system system + #:guile guile)))))))) -- 2.38.1