GNU bug report logs - #43193
[PATCH] guix: Add --with-dependency-source option

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Jesse Gibbons <jgibbons2357@HIDDEN>; Keywords: patch; dated Fri, 4 Sep 2020 04:31:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Sep 2020 04:30:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 04 00:30:21 2020
Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kE3Mi-0007TM-Oq
	for submit <at> debbugs.gnu.org; Fri, 04 Sep 2020 00:30:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:34186)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jgibbons2357@HIDDEN>) id 1kE3Mi-0007TF-1L
 for submit <at> debbugs.gnu.org; Fri, 04 Sep 2020 00:30:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33344)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jgibbons2357@HIDDEN>)
 id 1kE3Mh-0005Ew-Qp
 for guix-patches@HIDDEN; Fri, 04 Sep 2020 00:30:19 -0400
Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:43288)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jgibbons2357@HIDDEN>)
 id 1kE3Mf-0001Pj-Cy
 for guix-patches@HIDDEN; Fri, 04 Sep 2020 00:30:19 -0400
Received: by mail-pl1-x62b.google.com with SMTP id y6so551244plk.10
 for <guix-patches@HIDDEN>; Thu, 03 Sep 2020 21:30:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:from:subject:message-id:date:user-agent:mime-version
 :content-language;
 bh=4IUevJTUERpGOl8SI9KH70iFuI4TYIfmHkFHscj2MYY=;
 b=ZgIW9bzr1Ulg7RgDu8ekydh9V6YML+hltYK9HWgfr0bJtDLFJcNF1zw86ZHOH6HSmV
 0JRNsJOlOc3PznDnq+CFptAk1lRUJiIuQyAcwF3FEipsaE3IGZNzZp1p0lampY1rjbjL
 3m2F7kifI1Tsyo2iNxX8tI6vXsTybXsMq3QdilDdebdEFx8SnZXUIDcqL7R3MwUCqwOe
 cd6cOPf+m+u7xy294xR+cQ1mNMBETXyMqCxswwttUxD5hOXi4oRF4RpokHZVn47lAAta
 t2NKJ+SJai3lPKCw5nAVzqaaTGkB5fc9vhlxxOuskzveatbU1/2ZArfLwVRU7Ex9qzuY
 a10A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:from:subject:message-id:date:user-agent
 :mime-version:content-language;
 bh=4IUevJTUERpGOl8SI9KH70iFuI4TYIfmHkFHscj2MYY=;
 b=d2FR7U8jXp+xSDK0A5/plBhbHChjSoIOBtIE7IQv6ruEXecDOuv2K+c+L2JpKBAFtE
 jPtzRpwtBnW3AbwPH1/OeZcazhj6BMzOlFtK75bEa9qtaXSAGH45mhZrRzHxEAzBlWaE
 AKsZdV/7v0Pew5EVoxgq6JESEMUVr5dOEXMzWxPPUGy1fKDRfLQmfuN8xzV3wyxQnKup
 xuM/au3JDU4hlQHBucZXvWvk/51eqVGGW/HUNOiI5imWsRKsOIs4lBWodQZ3Wklvw5sY
 XtIfB8lT8klzyYYqLMtK08TP4h9S3dAclmbOxxaHV3axN/E0fxn9OWJWYxQb5B2pyMug
 nDnw==
X-Gm-Message-State: AOAM530BUv7VsdJUER+nmGn6HOJDgtHMQOJrOx3W6dv/iPvSt01ZfsXC
 GJEBJccDaNVmYuF2Mv+3/EfkkRfGVhsMAw==
X-Google-Smtp-Source: ABdhPJzpQ5xMTCpKWw0qoFPAInIAhng0CkrMZ4nvBWyLw+MZfjY1o4RJ7wdLwJ9S1viXg1bT3lyMSg==
X-Received: by 2002:a17:90b:33ca:: with SMTP id
 lk10mr6043520pjb.233.1599193813231; 
 Thu, 03 Sep 2020 21:30:13 -0700 (PDT)
Received: from [192.168.1.25] ([38.141.58.134])
 by smtp.gmail.com with ESMTPSA id h11sm4166919pgm.79.2020.09.03.21.30.11
 for <guix-patches@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Sep 2020 21:30:12 -0700 (PDT)
To: Guix Patches <guix-patches@HIDDEN>
From: Jesse Gibbons <jgibbons2357@HIDDEN>
Subject: [PATCH] guix: Add --with-dependency-source option
Message-ID: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@HIDDEN>
Date: Thu, 3 Sep 2020 22:30:02 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Icedove/68.12.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------F77E79CE07BDCC6D5D304517"
Content-Language: en-US
Received-SPF: pass client-ip=2607:f8b0:4864:20::62b;
 envelope-from=jgibbons2357@HIDDEN; helo=mail-pl1-x62b.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

This is a multi-part message in MIME format.
--------------F77E79CE07BDCC6D5D304517
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

     The attached patch adds support for the --with-dependency-source 
common build option. It can be used to specify the sources of 
dependencies of specified packages. With this step, we can close #42155. 
This is also a step in closing #43061.

Note that I suggested making a new 
--with-dependency-source=package=source build option in response to 
#42155 and nobody responded with an objection. So I am sending this 
patch with the assumption that there are no objections to this new build 
option, and that if a member of the community wants to completely 
replace the behavior of --with-source with the behavior of the new 
option, that person can do the work required to not break 
--with-source=source.

-Jesse


--------------F77E79CE07BDCC6D5D304517
Content-Type: text/x-patch; charset=UTF-8;
 name="v1-0001-guix-Add-with-dependency-source-option.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="v1-0001-guix-Add-with-dependency-source-option.patch"

From 91a89277067fd454ad77edb3a09ed06382f3694c Mon Sep 17 00:00:00 2001
From: Jesse Gibbons <jgibbons2357+guix@HIDDEN>
Date: Thu, 3 Sep 2020 17:45:08 -0600
Subject: [PATCH v1 1/1] guix: Add --with-dependency-source option

* guix/scripts/build.scm: (transform-package-inputs/source): new
  function
(evaluate-source-replacement-specs): new function
(%transformations): add with-dependency-source option
(%transformation-options): add with-dependency-source-option
(show-transformation-options-help): document --with-dependency-source
---
 guix/scripts/build.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 6286a43c02..0713595a00 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -280,6 +280,24 @@ current 'gnutls' package, after which version 3.5.4 is grafted onto them."
           (rewrite obj)
           obj))))
 
+(define (transform-package-inputs/source replacement-specs)
+  "Return a procedure that, when passed a package, replaces its direct
+dependencies according to REPLACEMENT-SPECS.  REPLACEMENT-SPECS is a list of
+strings like \"guile=/path/to/source\" or
+\"guile=https://www.example.com/guile-source.tar.gz\" meaning that, any
+dependency on a package called \"guile\" must be replaced with a dependency on a
+\"guile\" built with the source at the specified location."
+  (lambda (store obj)
+    (let* ((replacements (evaluate-source-replacement-specs replacement-specs
+                                                            (lambda (old url)
+                                                              (package-with-source store old url))))
+           (rewrite (package-input-rewriting/spec replacements))
+           (rewrite* (lambda (obj)
+                       (rewrite obj))))
+      (if (package? obj)
+          (rewrite* obj)
+          obj))))
+
 (define %not-equal
   (char-set-complement (char-set #\=)))
 
@@ -314,6 +332,21 @@ syntax, or if a package it refers to could not be found."
             (leave (G_ "invalid replacement specification: ~s~%") spec))))
        specs))
 
+(define (evaluate-source-replacement-specs specs proc)
+  "Parse SPECS, a list of strings like \"guile=/path/to/source\", and return a
+list of package pairs, where (PROC PACKAGE URL) returns the replacement package.
+Raise an error if an element of SPECS uses invalid syntax, or if a package it
+refers to could not be found."
+  (map (lambda (spec)
+         (match (string-tokenize spec %not-equal)
+           ((spec url)
+            (define (replace old)
+              (proc old url))
+            (cons spec replace))
+           (x
+            (leave (G_ "invalid replacement specification: ~s~%") spec))))
+       specs))
+
 (define (transform-package-source-branch replacement-specs)
   "Return a procedure that, when passed a package, replaces its direct
 dependencies according to REPLACEMENT-SPECS.  REPLACEMENT-SPECS is a list of
@@ -399,6 +432,7 @@ a checkout of the Git repository at the given URL."
   ;; procedure; it is called with two arguments: the store, and a list of
   ;; things to build.
   `((with-source . ,transform-package-source)
+    (with-dependency-source . ,transform-package-inputs/source)
     (with-input  . ,transform-package-inputs)
     (with-graft  . ,transform-package-inputs/graft)
     (with-branch . ,transform-package-source-branch)
@@ -414,6 +448,8 @@ a checkout of the Git repository at the given URL."
                            rest)))))
     (list (option '("with-source") #t #f
                   (parser 'with-source))
+          (option '("with-dependency-source") #t #f
+                  (parser 'with-dependency-source))
           (option '("with-input") #t #f
                   (parser 'with-input))
           (option '("with-graft") #t #f
@@ -429,6 +465,9 @@ a checkout of the Git repository at the given URL."
   (display (G_ "
       --with-source=SOURCE
                          use SOURCE when building the corresponding package"))
+  (display (G_ "
+      --with-dependency-source=PACKAGE=SOURCE
+                         use SOURCE when building the corresponding dependency package"))
   (display (G_ "
       --with-input=PACKAGE=REPLACEMENT
                          replace dependency PACKAGE by REPLACEMENT"))
-- 
2.28.0


--------------F77E79CE07BDCC6D5D304517--




Acknowledgement sent to Jesse Gibbons <jgibbons2357@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#43193; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 4 Sep 2020 04:45:02 UTC

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