From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Sep 2020 04:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43193@debbugs.gnu.org X-Debbugs-Original-To: Guix Patches Received: via spool by submit@debbugs.gnu.org id=B.159919382128732 (code B ref -1); Fri, 04 Sep 2020 04:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Sep 2020 04:30:21 +0000 Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kE3Mi-0007TM-Oq for submit@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 ) id 1kE3Mi-0007TF-1L for submit@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 ) id 1kE3Mh-0005Ew-Qp for guix-patches@gnu.org; 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 ) id 1kE3Mf-0001Pj-Cy for guix-patches@gnu.org; Fri, 04 Sep 2020 00:30:19 -0400 Received: by mail-pl1-x62b.google.com with SMTP id y6so551244plk.10 for ; 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 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 21:30:12 -0700 (PDT) From: Jesse Gibbons Message-ID: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> 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@gmail.com; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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-- From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 10 Sep 2020 09:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jesse Gibbons Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.15997310464024 (code B ref 43193); Thu, 10 Sep 2020 09:45:01 +0000 Received: (at 43193) by debbugs.gnu.org; 10 Sep 2020 09:44:06 +0000 Received: from localhost ([127.0.0.1]:37141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGJ7e-00012l-6m for submit@debbugs.gnu.org; Thu, 10 Sep 2020 05:44:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGJ7c-000128-MV for 43193@debbugs.gnu.org; Thu, 10 Sep 2020 05:44:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55080) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGJ7X-0004QE-CQ; Thu, 10 Sep 2020 05:43:59 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=40476 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kGJ7W-0007CV-Qk; Thu, 10 Sep 2020 05:43:59 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> Date: Thu, 10 Sep 2020 11:43:50 +0200 In-Reply-To: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> (Jesse Gibbons's message of "Thu, 3 Sep 2020 22:30:02 -0600") Message-ID: <87y2lige5l.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Jesse, Jesse Gibbons skribis: > =C2=A0=C2=A0=C2=A0 The attached patch adds support for the --with-depende= ncy-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. Excellent! > Note that I suggested making a new > --with-dependency-source=3Dpackage=3Dsource 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=3Dsource. OK. Like I wrote at , I wouldn=E2=80= =99t mind simply calling this new option =E2=80=98--with-source=E2=80=99. What = we=E2=80=99d lose by doing so is the warning you get if you do =E2=80=98--with-source=3Ddoes-not-exist=3Dwhatever=E2=80=99, saying the opt= ion had no effect, but that=E2=80=99s about it. The new =E2=80=98--with-source=E2=80= =99 behavior (recursive) would be consistent with the other options, which, to me, is more important. WDYT? >>>From 91a89277067fd454ad77edb3a09ed06382f3694c Mon Sep 17 00:00:00 2001 > From: Jesse Gibbons > 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 [...] > +(define (evaluate-source-replacement-specs specs proc) > + "Parse SPECS, a list of strings like \"guile=3D/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 packa= ge 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))= )) ^ Add =E2=80=9Csource=E2=80=9D here. It=E2=80=99s always a good idea to not = have the exact same error message in several places. :-) Could you: 1. adjust doc/guix.texi accordingly? That is, if we rename this new option to =E2=80=98--with-source=E2=80=99, simply add a note stating t= hat it=E2=80=99s recursive. 2. add a test to tests/guix-build.sh? There are already --with-source tests in other files. You can mimic them, essentially to make sure the option has an effect. 3. optionally add an entry as a separate commit to etc/news.scm. I can do that for you if you want. Thanks! Ludo=E2=80=99. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 11 Sep 2020 05:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.159980141822281 (code B ref 43193); Fri, 11 Sep 2020 05:17:02 +0000 Received: (at 43193) by debbugs.gnu.org; 11 Sep 2020 05:16:58 +0000 Received: from localhost ([127.0.0.1]:42034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGbQf-0005nI-NV for submit@debbugs.gnu.org; Fri, 11 Sep 2020 01:16:58 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:34171) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGbQe-0005n5-57 for 43193@debbugs.gnu.org; Fri, 11 Sep 2020 01:16:56 -0400 Received: by mail-pf1-f194.google.com with SMTP id v196so6504898pfc.1 for <43193@debbugs.gnu.org>; Thu, 10 Sep 2020 22:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=xLILgtYB5U7mNFbrseGmfu+0IeQ96pscWWvGULjwTmY=; b=QC7FXqzPEnw4KtRzxkypKv3Cpg9zCpsEbvGIUbSUsmYLoPJtNLWUJwuIyYxGmF+Xa9 PQX4CuqDy5/CCfhtMWYogLDO6S01cgShmefXTiCjYM5c1dlpqkMRoa7raZLdGjbvH0JT vvtyqmnauoMeCdOhHjkZoaBOBxJ8xXbpXVt0KwvYnaOuIfXVnRvboIsrpd5z37pbVqO/ CmNqaKR0OGWuYQ3XCmpfT5a/XHkKT/n2B6EC6gpM0NdTvgmRH+O9xPd+unyfAjWR/Ona HainYhZpfIXrYRv3aRHlVMMlEs4P4BRhtlFZ3/HVHpuBWOOPkRLK3Y34pKULx5eKzka6 Mwbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=xLILgtYB5U7mNFbrseGmfu+0IeQ96pscWWvGULjwTmY=; b=anekytNYn8w1FJZ3buQVJx9Ej5RQzjTnlDA5CWsPU72EpQ6uMm04oKmmUnoniGxFgx hQo/gtebT3zM/xtf44RnrOsLxQMHrdqs8jKWqa02dMTrqFf3sjkzA7r6WQ+87TghysZY AmU+9cTL7YC59Fzie1yneEb4JfJj2gwZmNr3Ov+2wobc51bUH/XN/paKgqswwD7TuKkI /KyZddz+W2/qQRkgRcChCZ+76LzMSLPYkoMFFvaeAer6nkeqfXehHzTacOiVBrQ5jtfD /TOwsmEy42gFM1giginplw9iQj6splTQ5kVpr8MtVybvL+VbcWHGu+nu9t5uqv0Kt8bN 7d0A== X-Gm-Message-State: AOAM5303hobN0WGy0Du9sLAc9ldR4sl+NT8lJEW2bZ0uuulxII2AuvwH ijCO3kgb+gB9SnEluTHR9nqKBCmdfd60Vg== X-Google-Smtp-Source: ABdhPJyWhXEVx17lXTvEKre8I6i84OfkIP7+cEfBixXIkYYxkGFgNHeEWpwamUu6DFplZ3AphWVNwQ== X-Received: by 2002:a63:fc18:: with SMTP id j24mr445875pgi.452.1599801409763; Thu, 10 Sep 2020 22:16:49 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id ca6sm642804pjb.53.2020.09.10.22.16.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Sep 2020 22:16:48 -0700 (PDT) References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> From: Jesse Gibbons Message-ID: <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> Date: Thu, 10 Sep 2020 23:16:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <87y2lige5l.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------0008A2252BA00AF6095D44A9" Content-Language: en-US X-Spam-Score: -3.3 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) This is a multi-part message in MIME format. --------------0008A2252BA00AF6095D44A9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 9/10/20 3:43 AM, Ludovic Courtès wrote: > Hi Jesse, > > Jesse Gibbons skribis: > >>     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. > Excellent! > >> 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. > OK. Like I wrote at , I wouldn’t > mind simply calling this new option ‘--with-source’. What we’d lose by > doing so is the warning you get if you do > ‘--with-source=does-not-exist=whatever’, saying the option had no > effect, but that’s about it. The new ‘--with-source’ behavior > (recursive) would be consistent with the other options, which, to me, is > more important. I agree that '--with-source' is a better name for the option, but I don't want to lose that particular functionality. I worked a little more to alter "--with-source" while still preserving the simple '--with-source=source' option, because once it's committed to master, it will be difficult to turn back and get the ideal implementation. The result is a bit dirty and should be refactored and cleaned, but at least it works. Attached is the updated patch. > > WDYT? > >> >From 91a89277067fd454ad77edb3a09ed06382f3694c Mon Sep 17 00:00:00 2001 >> From: Jesse Gibbons >> 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 > [...] > >> +(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)))) > ^ > Add “source” here. It’s always a good idea to not have the exact same > error message in several places. :-) Fixed. > Could you: > > 1. adjust doc/guix.texi accordingly? That is, if we rename this new > option to ‘--with-source’, simply add a note stating that it’s > recursive. I included this in the attached patch. > 2. add a test to tests/guix-build.sh? There are already --with-source > tests in other files. You can mimic them, essentially to make sure > the option has an effect. > 3. optionally add an entry as a separate commit to > etc/news.scm. I can do that for you if you want. > Do you still think the tests should be updated and this change should be announced in the news file? I'm willing to do these. > Thanks! > > Ludo’. -Jesse --------------0008A2252BA00AF6095D44A9 Content-Type: text/x-patch; charset=UTF-8; name="0001-guix-Make-with-source-option-recursive.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-guix-Make-with-source-option-recursive.patch" >From 2786da1e7011c59f08fc150dfa284f35bc0ed093 Mon Sep 17 00:00:00 2001 From: Jesse Gibbons Date: Thu, 3 Sep 2020 17:45:08 -0600 Subject: [PATCH 1/1] guix: Make --with-source option recursive * guix/scripts/build.scm: (transform-package-inputs/source): new function (evaluate-source-replacement-specs): new function (%transformations): change with-source to use evaluate-source-replacement-specs *doc/guix.texi (Package Transformation Options): Document it. --- doc/guix.texi | 3 ++- guix/scripts/build.scm | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1d6782e6fa..4036861c23 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9129,7 +9129,8 @@ without having to type in the definitions of package variants @itemx --with-source=@var{package}=@var{source} @itemx --with-source=@var{package}@@@var{version}=@var{source} Use @var{source} as the source of @var{package}, and @var{version} as -its version number. +its version number. This replacement is applied recursively on all +dependencies only if PACKAGE is specified. @var{source} must be a file name or a URL, as for @command{guix download} (@pxref{Invoking guix download}). diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 6286a43c02..095457b174 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -280,6 +280,28 @@ 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." + (match (string-tokenize (car replacement-specs) %not-equal) + ((spec url) + (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)))) + ((url) + (transform-package-source replacement-specs)))) + (define %not-equal (char-set-complement (char-set #\=))) @@ -314,6 +336,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 source 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 @@ -398,7 +435,7 @@ a checkout of the Git repository at the given URL." ;; key used in the option alist, and the cdr is the transformation ;; procedure; it is called with two arguments: the store, and a list of ;; things to build. - `((with-source . ,transform-package-source) + `((with-source . ,transform-package-inputs/source) (with-input . ,transform-package-inputs) (with-graft . ,transform-package-inputs/graft) (with-branch . ,transform-package-source-branch) -- 2.28.0 --------------0008A2252BA00AF6095D44A9-- From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 11 Sep 2020 15:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jesse Gibbons Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.159983900630402 (code B ref 43193); Fri, 11 Sep 2020 15:44:01 +0000 Received: (at 43193) by debbugs.gnu.org; 11 Sep 2020 15:43:26 +0000 Received: from localhost ([127.0.0.1]:45193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGlCv-0007uI-PV for submit@debbugs.gnu.org; Fri, 11 Sep 2020 11:43:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGlCu-0007u5-8g for 43193@debbugs.gnu.org; Fri, 11 Sep 2020 11:43:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41634) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGlCp-0001IW-01; Fri, 11 Sep 2020 11:43:19 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39618 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kGlCn-0005cf-2N; Fri, 11 Sep 2020 11:43:18 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Fructidor an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 11 Sep 2020 17:43:09 +0200 In-Reply-To: <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> (Jesse Gibbons's message of "Thu, 10 Sep 2020 23:16:28 -0600") Message-ID: <87wo10s4j6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Jesse Gibbons skribis: >> Could you: >> >> 1. adjust doc/guix.texi accordingly? That is, if we rename this new >> option to =E2=80=98--with-source=E2=80=99, simply add a note stati= ng that it=E2=80=99s >> recursive. > I included this in the attached patch. >> 2. add a test to tests/guix-build.sh? There are already --with-source >> tests in other files. You can mimic them, essentially to make sure >> the option has an effect. >> 3. optionally add an entry as a separate commit to >> etc/news.scm. I can do that for you if you want. >> > Do you still think the tests should be updated and this change should > be announced in the news file? I'm willing to do these. Yes, please. There=E2=80=99s should be a test that checks that --with-sour= ce works for non-leaf packages. A new entry would also be nice. > From 2786da1e7011c59f08fc150dfa284f35bc0ed093 Mon Sep 17 00:00:00 2001 > From: Jesse Gibbons > Date: Thu, 3 Sep 2020 17:45:08 -0600 > Subject: [PATCH 1/1] guix: Make --with-source option recursive > > * guix/scripts/build.scm: (transform-package-inputs/source): new > function > (evaluate-source-replacement-specs): new function > (%transformations): change with-source to use > evaluate-source-replacement-specs > > *doc/guix.texi (Package Transformation Options): Document it. Nitpick: There are spacing and capitalization issues. Please see =E2=80=98= git log=E2=80=99 for examples. > +++ b/doc/guix.texi > @@ -9129,7 +9129,8 @@ without having to type in the definitions of packag= e variants > @itemx --with-source=3D@var{package}=3D@var{source} > @itemx --with-source=3D@var{package}@@@var{version}=3D@var{source} > Use @var{source} as the source of @var{package}, and @var{version} as > -its version number. > +its version number. This replacement is applied recursively on all > +dependencies only if PACKAGE is specified. s/PACKAGE/@var{package}/ However, the semantics are a bit =E2=80=9Cweird=E2=80=9D. I would just do = the recursive replacement thing unconditionally. WDYT? > +(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 lis= t of > +strings like \"guile=3D/path/to/source\" or > +\"guile=3Dhttps://www.example.com/guile-source.tar.gz\" meaning that, any > +dependency on a package called \"guile\" must be replaced with a depende= ncy on a > +\"guile\" built with the source at the specified location." > + (match (string-tokenize (car replacement-specs) %not-equal) > + ((spec url) s/url/file/ since it=E2=80=99s a file name. > + (lambda (store obj) > + (let* ((replacements (evaluate-source-replacement-specs replaceme= nt-specs > + (lambda (= old url) > + (packag= e-with-source store old url)))) > + (rewrite (package-input-rewriting/spec replacements)) > + (rewrite* (lambda (obj) > + (rewrite obj)))) > + (if (package? obj) > + (rewrite* obj) > + obj)))) > + ((url) > + (transform-package-source replacement-specs)))) So maybe drop the second clause for non-recursive replacement, and drop =E2=80=98transform-package-source=E2=80=99 as well. Thanks! Ludo=E2=80=99. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 11 Sep 2020 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.159984893522492 (code B ref 43193); Fri, 11 Sep 2020 18:29:02 +0000 Received: (at 43193) by debbugs.gnu.org; 11 Sep 2020 18:28:55 +0000 Received: from localhost ([127.0.0.1]:45461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGnn5-0005qi-Do for submit@debbugs.gnu.org; Fri, 11 Sep 2020 14:28:55 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:33561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGnn3-0005qU-MD for 43193@debbugs.gnu.org; Fri, 11 Sep 2020 14:28:54 -0400 Received: by mail-pj1-f66.google.com with SMTP id md22so2949156pjb.0 for <43193@debbugs.gnu.org>; Fri, 11 Sep 2020 11:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=qWr8bIE3UeF57/nVuPkLv2XoGFzIVf9sWyVihsXwdeE=; b=ZMeCeoVaRtdQxT7w4JTrZ8i6/B+Se5zNuoNHPvkKEvo6Jyq5PnSqKna1ProPGBDgwm 6KpxvWhi/7H2s0iO1Cq+ayv2ODeSkiE4Pm74o8HPT/22USZvP/ez3kDSJyZ7jlAOeFW9 aFZm7jQ5lG64WaD51RcqPJBl25DblgJIsMKNe7PBQeQN/wCiANapugLFagpk8OptbaxJ gi9Nle/9woM3xCUM04RmKraQrelysEMaGytwcqrIwxbOBGHY3MMlsSvOUwnrfpr3gVye HmGG3veMe5X+hKwj49BU4w0A+UW18SR0/kApIs4rj0s2yL04bqf5V2xsYyMOlcRhmBlA Kfdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=qWr8bIE3UeF57/nVuPkLv2XoGFzIVf9sWyVihsXwdeE=; b=TiYygkVfITHO+RLoeSjYbuVKm411FynGCIwg/EAzjOpxYpXL2n19tahq9f+BUTOqWZ AKZKdet2kajIzSFZENoRwavbulViZhqY7g1LK7WiDzTIKV0bc1KZgkRXfatd3FYnBBBw jCiJw0RXS8HpWeO9RF7joXWnfX0g6X+xPe84CU9wGizPMFnQKf1F3URhIfx9qNhFYmoL otKP80n3Ap2V4WnR3deXuaDGKJLbG3ajizYnsVOGnZBznxSkqKLAiUHdhaWP6eCqJGal +1BXM0dRZ6gKfJAG+q0sJQk/PNJqRjoIA6/by9D+FMeYkIWaDSFi/g4liQ/GQf694SN8 PB6A== X-Gm-Message-State: AOAM533Kj3x1puuTcXYxBm/Jlv4kbBcl5999eFMZfzKjpfHQykGSRL5h kCX4OoqYSqXJ8we88cdxqLmcAACAYXHA3w== X-Google-Smtp-Source: ABdhPJwj75f3qlFVrMV1RYlARfsCjW5+dxPgPTY1S3UdzgeLZDo07nxlpABb2rcb6XU8U6gKc5fQZg== X-Received: by 2002:a17:90a:65ca:: with SMTP id i10mr3419028pjs.137.1599848927290; Fri, 11 Sep 2020 11:28:47 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id r144sm3151881pfc.63.2020.09.11.11.28.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Sep 2020 11:28:46 -0700 (PDT) References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> From: Jesse Gibbons Message-ID: <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> Date: Fri, 11 Sep 2020 12:28:31 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <87wo10s4j6.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.2 (---) On 9/11/20 9:43 AM, Ludovic Courtès wrote: > Hi, > > Jesse Gibbons skribis: > >>> Could you: >>> >>> 1. adjust doc/guix.texi accordingly? That is, if we rename this new >>> option to ‘--with-source’, simply add a note stating that it’s >>> recursive. >> I included this in the attached patch. >>> 2. add a test to tests/guix-build.sh? There are already --with-source >>> tests in other files. You can mimic them, essentially to make sure >>> the option has an effect. >>> 3. optionally add an entry as a separate commit to >>> etc/news.scm. I can do that for you if you want. >>> >> Do you still think the tests should be updated and this change should >> be announced in the news file? I'm willing to do these. > Yes, please. There’s should be a test that checks that --with-source > works for non-leaf packages. A new entry would also be nice. I will work on that then. > >> From 2786da1e7011c59f08fc150dfa284f35bc0ed093 Mon Sep 17 00:00:00 2001 >> From: Jesse Gibbons >> Date: Thu, 3 Sep 2020 17:45:08 -0600 >> Subject: [PATCH 1/1] guix: Make --with-source option recursive >> >> * guix/scripts/build.scm: (transform-package-inputs/source): new >> function >> (evaluate-source-replacement-specs): new function >> (%transformations): change with-source to use >> evaluate-source-replacement-specs >> >> *doc/guix.texi (Package Transformation Options): Document it. > Nitpick: There are spacing and capitalization issues. Please see ‘git > log’ for examples. I'll fix this. >> +++ b/doc/guix.texi >> @@ -9129,7 +9129,8 @@ without having to type in the definitions of package variants >> @itemx --with-source=@var{package}=@var{source} >> @itemx --with-source=@var{package}@@@var{version}=@var{source} >> Use @var{source} as the source of @var{package}, and @var{version} as >> -its version number. >> +its version number. This replacement is applied recursively on all >> +dependencies only if PACKAGE is specified. > s/PACKAGE/@var{package}/ > > However, the semantics are a bit “weird”. I would just do the recursive > replacement thing unconditionally. WDYT? > >> +(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." >> + (match (string-tokenize (car replacement-specs) %not-equal) >> + ((spec url) > s/url/file/ since it’s a file name. > >> + (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)))) >> + ((url) >> + (transform-package-source replacement-specs)))) > So maybe drop the second clause for non-recursive replacement, and drop > ‘transform-package-source’ as well. I included a fallback to transform-package-source because the following happens: $ ./pre-inst-env guix build --with-source=$(guix build --source hello) hello guix build: error: invalid source replacement specification: "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" This does not fail when I fall back to the non-recursive logic. I can drop transform-package-source, but I will need to do some more hacking to figure out how the package name and version are parsed from the file name as described in the manual, and move it to the logic in transform-package-inputs/source. I'm not going to have as much free time starting next week, so I might not be able to do that for a while, but I will try to get it done ASAP. > > Thanks! > > Ludo’. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Sep 2020 12:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jesse Gibbons Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.16000017464655 (code B ref 43193); Sun, 13 Sep 2020 12:56:01 +0000 Received: (at 43193) by debbugs.gnu.org; 13 Sep 2020 12:55:46 +0000 Received: from localhost ([127.0.0.1]:49677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHRXm-0001D1-0U for submit@debbugs.gnu.org; Sun, 13 Sep 2020 08:55:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHRXk-0001Cp-RI for 43193@debbugs.gnu.org; Sun, 13 Sep 2020 08:55:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57785) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHRXe-0003ei-UP; Sun, 13 Sep 2020 08:55:39 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=47026 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kHRXd-0005c1-MP; Sun, 13 Sep 2020 08:55:38 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 Fructidor an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 13 Sep 2020 14:55:28 +0200 In-Reply-To: <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> (Jesse Gibbons's message of "Fri, 11 Sep 2020 12:28:31 -0600") Message-ID: <87y2ld7s5b.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Jesse Gibbons skribis: > On 9/11/20 9:43 AM, Ludovic Court=C3=A8s wrote: [...] >> So maybe drop the second clause for non-recursive replacement, and drop >> =E2=80=98transform-package-source=E2=80=99 as well. > I included a fallback to transform-package-source because the > following happens: > > $ ./pre-inst-env guix build --with-source=3D$(guix build --source hello) = hello > guix build: error: invalid source replacement specification: > "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" > > This does not fail when I fall back to the non-recursive logic. > > I can drop transform-package-source, but I will need to do some more > hacking to figure out how the package name and version are parsed from=20 > the file name as described in the manual, and move it to the logic in > transform-package-inputs/source. Yes, that=E2=80=99d be nice. Namely, if you do: guix build hello --source=3Dhello-1.2.3.tar.gz it should work just as now (from the source file name, we assume that the source applies to package =E2=80=9Chello=E2=80=9D). Conversely, doing: guix build hello --source=3Dxyz-hello-1.2.3.tar.gz would have no effect. It would not even emit a warning, unlike now. > I'm not going to have as much free time starting next week, so I might > not be able to do that for a while, but I will try to get it done > ASAP. Sure, let=E2=80=99s stay in touch, I think we=E2=80=99re almost done! Thank you, Ludo=E2=80=99. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Sep 2020 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.160000735615413 (code B ref 43193); Sun, 13 Sep 2020 14:30:02 +0000 Received: (at 43193) by debbugs.gnu.org; 13 Sep 2020 14:29:16 +0000 Received: from localhost ([127.0.0.1]:51267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHT0G-00040X-Ar for submit@debbugs.gnu.org; Sun, 13 Sep 2020 10:29:16 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:37465) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHT0E-00040J-0J for 43193@debbugs.gnu.org; Sun, 13 Sep 2020 10:29:15 -0400 Received: by mail-pl1-f177.google.com with SMTP id u9so3259933plk.4 for <43193@debbugs.gnu.org>; Sun, 13 Sep 2020 07:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=+LbvV8sH7AxX8smWhh0DFYdr1jACRN/jOKPdTkpMN/g=; b=TjduH85SaNSmfDBlyA1ky/TXpV8zBjITWe12/qZdXQeA+atZbvj9nPnjK2LgiH9wuY eXOqDmmMGZmNaxtLVG8JTu8o9FmZBGNc70xNG7nmWVR451urv8IBsAeL6egZGnzyBWcJ MuayVxcGV/CNR7SyUbtg+1vPP3fOMPDEt9+RLtE8SrejaTc6Be5igQX1KfLqMK0ZztL4 A50jcx7B5ggW/teJfS6CjKr+JDcQyhAJBoG+t2ksc6KzQ7AC1hjJNxkN95ehp//q+eta tLLbhvaGrnnjLy0AsJx02y7ZdPy+WAgLKolyQZPW/zRIsGMboW1hUj/XoK7p+BO9kVfi Qwow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=+LbvV8sH7AxX8smWhh0DFYdr1jACRN/jOKPdTkpMN/g=; b=ntdHltDPMoaBCRt2ELlXk3NQLBl/5S0U+hYdbbU99ixa729R3XJYKEDEw6cPQAcpEM wN6/ce6m7xPVmgF6B0/Ct/9wyKlGsxcgpGOKZpErKgOWfnR1KFfay/yUIBWmNgAHw9Lv sWv51ESQWv1U2FsSa94uaiFVxLRzzsZ+1Xaq3+SNAY4FemRuT9dm/5tIWkXTjHp/7SCJ UR0KPug7SoEROoYvd5g6gQmDiuTXEunjASyaEk6RyD3QIkz2cQZoqpDYnu71Rb7KArbW prOHQrEhg2iMlZAnd5APlS7NMHdGJk2+eq5ckRfPGvlBDkZRp5As4ThEfjKmL78SrQhz f1Ng== X-Gm-Message-State: AOAM530o+Gjo399zXcZmogeYx3YjGFrSwBJ42dww0RX161kwITIaBC69 7w8beWfVrUKdMQrA3DtIscleWUgO583nFw== X-Google-Smtp-Source: ABdhPJw075jPFwR1LC36cwUv2vCynEwwT6doGL2Ur0SohG+Z4C5JhXTu9qMNyWqy20R/MX5LumaP+A== X-Received: by 2002:a17:902:be11:b029:d1:bb21:4c9c with SMTP id r17-20020a170902be11b02900d1bb214c9cmr6690444pls.8.1600007347699; Sun, 13 Sep 2020 07:29:07 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id b11sm576315pfd.33.2020.09.13.07.29.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Sep 2020 07:29:06 -0700 (PDT) References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> <87y2ld7s5b.fsf@gnu.org> From: Jesse Gibbons Message-ID: <9130ce2d-4d10-0aa5-ad68-b312097fcb4a@gmail.com> Date: Sun, 13 Sep 2020 08:28:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <87y2ld7s5b.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 9/13/20 6:55 AM, Ludovic Courtès wrote: > Hi, > > Jesse Gibbons skribis: > >> On 9/11/20 9:43 AM, Ludovic Courtès wrote: > [...] > >>> So maybe drop the second clause for non-recursive replacement, and drop >>> ‘transform-package-source’ as well. >> I included a fallback to transform-package-source because the >> following happens: >> >> $ ./pre-inst-env guix build --with-source=$(guix build --source hello) hello >> guix build: error: invalid source replacement specification: >> "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" >> >> This does not fail when I fall back to the non-recursive logic. >> >> I can drop transform-package-source, but I will need to do some more >> hacking to figure out how the package name and version are parsed from >> the file name as described in the manual, and move it to the logic in >> transform-package-inputs/source. > Yes, that’d be nice. Namely, if you do: > > guix build hello --source=hello-1.2.3.tar.gz > > it should work just as now (from the source file name, we assume that > the source applies to package “hello”). > > Conversely, doing: > > guix build hello --source=xyz-hello-1.2.3.tar.gz > > would have no effect. It would not even emit a warning, unlike now. I was able to get this working nicely. >> I'm not going to have as much free time starting next week, so I might >> not be able to do that for a while, but I will try to get it done >> ASAP. > Sure, let’s stay in touch, I think we’re almost done! I wrote a new test that checks non-leafs. The following tests fail: test-name: options->transformation, no transformations test-name: options->transformation, with-source test-name: options->transformation, with-source, replacement test-name: options->transformation, with-source, with version test-name: options->transformation, with-source, no matches test-name: options->transformation, with-source, PKG@VER=URI Some of these tests raise a similar error, some only have a false actual value, and "options->transformation, with-source, no matches" will need to be changed at the test level because it checks for a warning in the output. I've been trying to debug, but the tests don't even give a stack trace. I will do what I can to fix the tests and follow up at the end of the week. -Jesse From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Sep 2020 22:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.160116038919608 (code B ref 43193); Sat, 26 Sep 2020 22:47:02 +0000 Received: (at 43193) by debbugs.gnu.org; 26 Sep 2020 22:46:29 +0000 Received: from localhost ([127.0.0.1]:48012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMIxZ-00056B-3M for submit@debbugs.gnu.org; Sat, 26 Sep 2020 18:46:29 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:43456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMIxV-00055u-N8 for 43193@debbugs.gnu.org; Sat, 26 Sep 2020 18:46:27 -0400 Received: by mail-pl1-f180.google.com with SMTP id e4so1303170pln.10 for <43193@debbugs.gnu.org>; Sat, 26 Sep 2020 15:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=TfrrivFkJiF8MVWcZgjo+/2NOFiqjlWPvzjft7B3xtA=; b=DyuV8MMQeBgoJwOxU1SZOMIR9ifqKyZwlNE21V2yH5VowmOtJa51owm/CmEp2E7LVS N87thVy6GRmzBaDM6IQGm9tjhw6U7Od++viJbdww+UErPY8pq7eyNfZuWsk0X3aKEr+o ZpC504lI9M0Se+C/Tvvw77BpwdZizhhDtBspNoo0cY1qxtqti965Qh5fYNkBANfdAtZW ysTf71QNbGLHnqxh0cfPflWnDmo97Z1cNscIDRjS5xsGK/V11GJKG9sK0R50On6pK52v 2tYLhRDFAxi9XlfePrX0RjbHYqpP6rfN0l4QIXNJ4IyZLEKUeCbTHwMm8sBdsy8eHqHR Fi6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=TfrrivFkJiF8MVWcZgjo+/2NOFiqjlWPvzjft7B3xtA=; b=CLT0vSYBWySUkEw307aiepoDFd/IlGKkFCAuvBRJA5yK2Hk9peOuGKHjfP/WiXVf6u tBo9m91xmgzP9n5VCy4wQbv33HTcAM/0XzaGX/woQFVaJElALY3xLeMmNPGTOwMN9rIc c5GtieRa8Ww0ZJf/93DUb8Gsll+IXWrUueBBugwbbKnYMx+UjNdJQJ4InFXyGBJBwaot VYPL0++OblCo4r8JTxalcvWBDOT4E+T3LcRPt0GeGaW9sOUpriq9R8YzAwjcc9s3y2Uk DSnnwcdRl3HhWafZ8r3LUaXQrH/la2nX7R4NeLRk/xhb8wQdNp9PsZGFvccOe2akKcju MP/Q== X-Gm-Message-State: AOAM531toDAwNcMYGq7tiLiBVnNR/JbKpbGtfQkqGFcQIYLXK9wGA4vJ Ym6HAjtxZC+/ohKdN6iugotewzsgL6Y= X-Google-Smtp-Source: ABdhPJxYeT9DmWwA2Fg3CyWTCD0LkFG94iJAT38ACIYv0/vs6IJ69TS0pIyVVvSuMckX+bqKeXAfgw== X-Received: by 2002:a17:902:8e88:b029:d2:42fe:394b with SMTP id bg8-20020a1709028e88b02900d242fe394bmr5202316plb.41.1601160379257; Sat, 26 Sep 2020 15:46:19 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id r188sm2593094pfc.67.2020.09.26.15.46.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Sep 2020 15:46:18 -0700 (PDT) References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> <87y2ld7s5b.fsf@gnu.org> From: Jesse Gibbons Message-ID: <9c60e5f2-e9fa-55c9-863f-cc3bccc2cf15@gmail.com> Date: Sat, 26 Sep 2020 16:46:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <87y2ld7s5b.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------B5D816F1D9A948810AFD3908" Content-Language: en-US X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------B5D816F1D9A948810AFD3908 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Attached are the patches that make the --with-source option recursive, add documentation, add a test, adjust a test, and update the news. As expected, the changes I made are incompatible with the test "options->transformation, with-source, no matches". Since options->transformation, with-source does a recursive replacement, it returns a clone of the package in question. I have tried changing the comparison to eq?, eqv? and equal?, each returning false, so I settled on a (limited) comparison of the packages' attributes. On 9/13/20 6:55 AM, Ludovic Courtès wrote: > Hi, > > Jesse Gibbons skribis: > >> On 9/11/20 9:43 AM, Ludovic Courtès wrote: > [...] > >>> So maybe drop the second clause for non-recursive replacement, and drop >>> ‘transform-package-source’ as well. >> I included a fallback to transform-package-source because the >> following happens: >> >> $ ./pre-inst-env guix build --with-source=$(guix build --source hello) hello >> guix build: error: invalid source replacement specification: >> "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" >> >> This does not fail when I fall back to the non-recursive logic. >> >> I can drop transform-package-source, but I will need to do some more >> hacking to figure out how the package name and version are parsed from >> the file name as described in the manual, and move it to the logic in >> transform-package-inputs/source. > Yes, that’d be nice. Namely, if you do: > > guix build hello --source=hello-1.2.3.tar.gz > > it should work just as now (from the source file name, we assume that > the source applies to package “hello”). > > Conversely, doing: > > guix build hello --source=xyz-hello-1.2.3.tar.gz > > would have no effect. It would not even emit a warning, unlike now. > >> I'm not going to have as much free time starting next week, so I might >> not be able to do that for a while, but I will try to get it done >> ASAP. > Sure, let’s stay in touch, I think we’re almost done! > > Thank you, > Ludo’. --------------B5D816F1D9A948810AFD3908 Content-Type: text/x-patch; charset=UTF-8; name="0001-guix-Make-with-source-option-recursive.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-guix-Make-with-source-option-recursive.patch" >From 2d2f6c97ad1deeb2fc8a214d992c7894a7c5e293 Mon Sep 17 00:00:00 2001 From: Jesse Gibbons Date: Thu, 3 Sep 2020 17:45:08 -0600 Subject: [PATCH 1/2] guix: Make --with-source option recursive * guix/scripts/build.scm: (transform-package-inputs/source): new function (evaluate-source-replacement-specs): new function (%transformations): change with-source to use evaluate-source-replacement-specs * doc/guix.texi (Package Transformation Options): document it. * tests/scripts-build.scm: (options->transformation, with-source, no matches): adjust to new expectations. (options->transformation, with-source, recursive): new test. --- doc/guix.texi | 4 +-- guix/scripts/build.scm | 61 ++++++++++++++++++++++++++++++++++++++--- tests/scripts-build.scm | 25 +++++++++++++++-- 3 files changed, 81 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 82241b010a..3470ccc99c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9142,8 +9142,8 @@ without having to type in the definitions of package variants @itemx --with-source=@var{package}=@var{source} @itemx --with-source=@var{package}@@@var{version}=@var{source} Use @var{source} as the source of @var{package}, and @var{version} as -its version number. -@var{source} must be a file name or a URL, as for @command{guix +its version number. This replacement is applied recursively on all +dependencies. @var{source} must be a file name or a URL, as for @command{guix download} (@pxref{Invoking guix download}). When @var{package} is omitted, diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 38e0516c95..a899f18a61 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -201,9 +201,9 @@ matching URIs given in SOURCES." (#f ;; Determine the package name and version from URI. (call-with-values - (lambda () - (hyphen-package-name->name+version - (tarball-base-name (basename uri)))) + (lambda () + (hyphen-package-name->name+version + (tarball-base-name (basename uri)))) (lambda (name version) (list name version uri)))) (index @@ -280,6 +280,26 @@ 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. SPECS may also +simply be a file location, in which case the package name and version are parsed +from the file name." + (lambda (store obj) + (let* ((replacements (evaluate-source-replacement-specs replacement-specs + (lambda* (old file #:optional version) + (package-with-source store old file version)))) + (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 +334,39 @@ 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." + (define* (replacement file #:optional version) + (lambda (old) + (proc old file version))) + (map (lambda (spec) + (match (string-tokenize spec %not-equal) + ((package-spec file) + (let* ((spec-list (call-with-values + (lambda () + (package-specification->name+version+output package-spec)) + list)) + (name (list-ref spec-list 0)) + (version (list-ref spec-list 1))) + (cons name (replacement file version)))) + ((file) + (let* ((package-spec + (call-with-values + (lambda () + (hyphen-package-name->name+version + (tarball-base-name (basename file)))) + (lambda (name version) + (cons name version)))) + (name (car package-spec)) + (version (cdr package-spec))) + (cons name (replacement file version)))) + (_ + (leave (G_ "invalid source 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 @@ -398,7 +451,7 @@ a checkout of the Git repository at the given URL." ;; key used in the option alist, and the cdr is the transformation ;; procedure; it is called with two arguments: the store, and a list of ;; things to build. - `((with-source . ,transform-package-source) + `((with-source . ,transform-package-inputs/source) (with-input . ,transform-package-inputs) (with-graft . ,transform-package-inputs/graft) (with-branch . ,transform-package-source-branch) diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm index 32876e956a..40d7d03637 100644 --- a/tests/scripts-build.scm +++ b/tests/scripts-build.scm @@ -94,9 +94,9 @@ (let* ((port (open-output-string)) (new (parameterize ((guix-warning-port port)) (t store p)))) - (and (eq? new p) - (string-contains (get-output-string port) - "had no effect")))))) + (and (eq? (package-version new) (package-version p)) + (eq? (package-name new) (package-name p)) + (eq? (package-source new) (package-source p))))))) (test-assert "options->transformation, with-source, PKG=URI" (let* ((p (dummy-package "foo")) @@ -127,6 +127,25 @@ (add-to-store store (basename s) #t "sha256" s))))))) +(test-assert "options->transformation, with-source, recursive" + (let* ((q (dummy-package "foo")) + (p (dummy-package "guix.scm" + (inputs `(("foo" ,q))))) + (s (search-path %load-path "guix.scm")) + (f (string-append "foo@42.0=" s)) + (t (options->transformation `((with-source . ,f))))) + (with-store store + (let ((new (t store p))) + (and (not (eq? new p)) + (match (package-inputs new) + ((("foo" dep1)) + (and + (string=? (package-name dep1) "foo") + (string=? (package-version dep1) "42.0") + (string=? (package-source dep1) + (add-to-store store (basename s) #t + "sha256" s)))))))))) + (test-assert "options->transformation, with-input" (let* ((p (dummy-package "guix.scm" (inputs `(("foo" ,(specification->package "coreutils")) -- 2.28.0 --------------B5D816F1D9A948810AFD3908 Content-Type: text/x-patch; charset=UTF-8; name="0002-news-Add-entry-for-with-source.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-news-Add-entry-for-with-source.patch" >From 738fdb35af1449e245ce2e48c266c82f798d89af Mon Sep 17 00:00:00 2001 From: Jesse Gibbons Date: Sat, 26 Sep 2020 16:29:25 -0600 Subject: [PATCH 2/2] news: Add entry for "--with-source" * etc/news,scm: Add entry. --- etc/news.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/news.scm b/etc/news.scm index 1ef238ca2d..fcb195c679 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -13,6 +13,14 @@ (channel-news (version 0) + (entry (commit "2d2f6c97ad1deeb2fc8a214d992c7894a7c5e293") + (title (en "@option{--with-source} now recursive")) + (body (en "The @option{--with-source} common option now uses the +specified source for all matching dependencies of any packages guix is directed +to work with. This option is useful for all package maintainers, developers, +and, in general, all users who want guix to facilitate their rights to modify +their software and share their changes."))) + (entry (commit "a98712785e0b042a290420fd74e5a4a5da4fc68f") (title (en "New @command{guix git authenticate} command") (de "Neuer Befehl @command{guix git authenticate}") -- 2.28.0 --------------B5D816F1D9A948810AFD3908-- From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 08 Oct 2020 03:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.160212862820783 (code B ref 43193); Thu, 08 Oct 2020 03:44:02 +0000 Received: (at 43193) by debbugs.gnu.org; 8 Oct 2020 03:43:48 +0000 Received: from localhost ([127.0.0.1]:58390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQMqK-0005P8-8x for submit@debbugs.gnu.org; Wed, 07 Oct 2020 23:43:48 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:39566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQMqG-0005Ot-Mq for 43193@debbugs.gnu.org; Wed, 07 Oct 2020 23:43:46 -0400 Received: by mail-pf1-f176.google.com with SMTP id n14so2852320pff.6 for <43193@debbugs.gnu.org>; Wed, 07 Oct 2020 20:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=o7D8LKUhJLE14e5aglikZlSuBGDxnoRLvNbqT5/EMc8=; b=gUEqUzihpRG8WYnK1ebXb6xuCOylMfjcRZVRd+fl9kNCnI45duUG+MSgWD6B674ddE 75EVd3ClI2ZJeDDPiHKExBe37h/RIBOphCdMVQEfqe41gBjsTRnqtmT5be5KieHuRvwE Ld9GiofY5Jh0rJ+cAb10e/C2scxEtKYgkgeww+xALZwshbvHb/2hV+zqxxoDFS3PY4sj udFsO81Sr7DKnADBoRX3OdXQo8s272SuTeZvIZAwW1pRpfaQZ4IumvOFbzPQ0xi0clCu qPVCVUfJu9q1dCm+CJCBGvdsbSrDDZA0BdesyZsTzVs/5uboYnUJnSe5jqiuBD4/0jlW UasA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=o7D8LKUhJLE14e5aglikZlSuBGDxnoRLvNbqT5/EMc8=; b=qsL1jJFfmuTBIgDZhrwWHBuOJO7dUEWEwFgyIrI+D8jb+dvyluOXUZw43+RhlTKH4C RdoGIgbqiDNeCtXvsL6K0yXbjfeXfOyBIqIynTnIZjLTAPz/IlmrNZXUWbJd3nkBtZcw lcUnRwHMIOz5fYTjwX9Vkto/TFIaNIf2YI2S3CXq8/KFGNCXcz894Y76lVCKOT6LBcw6 tHNIVrXYjbIgwYuN9UUgb8etRoPJ4t88b0t/VhBA4oVlVA43vovEd/hYRaaxQ2ycmpfA G8iFFrkNtuF1ve/LS04I+bUB7gI9MQZ0JG1ux5E2pNC9bOJVA66lrNmQw6yv4OYhWCsa 4PhA== X-Gm-Message-State: AOAM531z8m5ImiBlN3cpww4VsvYVoXPuDNH7dvaONSeKBEfvYgESsHZ4 I099+S+g+FbWttlrC8gQzHBwqU8h7f8= X-Google-Smtp-Source: ABdhPJxf3Fr/CDRQtZtQxJUzRxPxiHiLJnLpIjde/tDUUyIZWKUdccqCyHztAatB/fYiQHYCh3t8RQ== X-Received: by 2002:a17:90a:9f91:: with SMTP id o17mr5997848pjp.228.1602128618091; Wed, 07 Oct 2020 20:43:38 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id p4sm1080835pjk.8.2020.10.07.20.43.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Oct 2020 20:43:37 -0700 (PDT) From: Jesse Gibbons References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> <87y2ld7s5b.fsf@gnu.org> <9c60e5f2-e9fa-55c9-863f-cc3bccc2cf15@gmail.com> Message-ID: Date: Wed, 7 Oct 2020 21:43:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.3.1 MIME-Version: 1.0 In-Reply-To: <9c60e5f2-e9fa-55c9-863f-cc3bccc2cf15@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) This is a friendly bump. On 9/26/20 4:46 PM, Jesse Gibbons wrote: > Attached are the patches that make the --with-source option recursive, > add documentation, add a test, adjust a test, and update the news. > > As expected, the changes I made are incompatible with the test > "options->transformation, with-source, no matches". Since > options->transformation, with-source does a recursive replacement, it > returns a clone of the package in question. I have tried changing the > comparison to eq?, eqv? and equal?, each returning false, so I settled > on a (limited) comparison of the packages' attributes. > > On 9/13/20 6:55 AM, Ludovic Courtès wrote: >> Hi, >> >> Jesse Gibbons skribis: >> >>> On 9/11/20 9:43 AM, Ludovic Courtès wrote: >> [...] >> >>>> So maybe drop the second clause for non-recursive replacement, and >>>> drop >>>> ‘transform-package-source’ as well. >>> I included a fallback to transform-package-source because the >>> following happens: >>> >>> $ ./pre-inst-env guix build --with-source=$(guix build --source >>> hello) hello >>> guix build: error: invalid source replacement specification: >>> "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" >>> >>> This does not fail when I fall back to the non-recursive logic. >>> >>> I can drop transform-package-source, but I will need to do some more >>> hacking to figure out how the package name and version are parsed from >>> the file name as described in the manual, and move it to the logic in >>> transform-package-inputs/source. >> Yes, that’d be nice.  Namely, if you do: >> >>    guix build hello --source=hello-1.2.3.tar.gz >> >> it should work just as now (from the source file name, we assume that >> the source applies to package “hello”). >> >> Conversely, doing: >> >>    guix build hello --source=xyz-hello-1.2.3.tar.gz >> >> would have no effect.  It would not even emit a warning, unlike now. >> >>> I'm not going to have as much free time starting next week, so I might >>> not be able to do that for a while, but I will try to get it done >>> ASAP. >> Sure, let’s stay in touch, I think we’re almost done! >> >> Thank you, >> Ludo’. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 22 Oct 2020 15:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jesse Gibbons Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.16033793019622 (code B ref 43193); Thu, 22 Oct 2020 15:09:02 +0000 Received: (at 43193) by debbugs.gnu.org; 22 Oct 2020 15:08:21 +0000 Received: from localhost ([127.0.0.1]:53494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVcCS-0002V7-Jo for submit@debbugs.gnu.org; Thu, 22 Oct 2020 11:08:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVcCQ-0002Ut-D9 for 43193@debbugs.gnu.org; Thu, 22 Oct 2020 11:08:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44897) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVcCL-0000yP-5O; Thu, 22 Oct 2020 11:08:13 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51376 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kVcCK-0006wr-N3; Thu, 22 Oct 2020 11:08:12 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> <87y2ld7s5b.fsf@gnu.org> <9c60e5f2-e9fa-55c9-863f-cc3bccc2cf15@gmail.com> Date: Thu, 22 Oct 2020 17:08:10 +0200 In-Reply-To: <9c60e5f2-e9fa-55c9-863f-cc3bccc2cf15@gmail.com> (Jesse Gibbons's message of "Sat, 26 Sep 2020 16:46:16 -0600") Message-ID: <87pn5as3hh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Jesse, Jesse Gibbons skribis: > Attached are the patches that make the --with-source option recursive, > add documentation, add a test, adjust a test, and update the news. Great, and apologies for the delay. >>>From 2d2f6c97ad1deeb2fc8a214d992c7894a7c5e293 Mon Sep 17 00:00:00 2001 > From: Jesse Gibbons > Date: Thu, 3 Sep 2020 17:45:08 -0600 > Subject: [PATCH 1/2] guix: Make --with-source option recursive > > * guix/scripts/build.scm: (transform-package-inputs/source): new > function > (evaluate-source-replacement-specs): new function > (%transformations): change with-source to use > evaluate-source-replacement-specs > > * doc/guix.texi (Package Transformation Options): document it. > > * tests/scripts-build.scm: (options->transformation, with-source, no > matches): adjust to new expectations. > (options->transformation, with-source, recursive): new test. [...] > +++ b/doc/guix.texi > @@ -9142,8 +9142,8 @@ without having to type in the definitions of packag= e variants > @itemx --with-source=3D@var{package}=3D@var{source} > @itemx --with-source=3D@var{package}@@@var{version}=3D@var{source} > Use @var{source} as the source of @var{package}, and @var{version} as > -its version number. > -@var{source} must be a file name or a URL, as for @command{guix > +its version number. This replacement is applied recursively on all > +dependencies. @var{source} must be a file name or a URL, as for @comman= d{guix > download} (@pxref{Invoking guix download}). Maybe s/all dependencies/all matching dependencies/? > +++ b/guix/scripts/build.scm > @@ -201,9 +201,9 @@ matching URIs given in SOURCES." > (#f > ;; Determine the package name and version from URI. > (call-with-values > - (lambda () > - (hyphen-package-name->name+version > - (tarball-base-name (basename uri)))) > + (lambda () > + (hyphen-package-name->name+version > + (tarball-base-name (basename uri)))) Please avoid unrelated whitespace changes like this one. > +(define (transform-package-inputs/source replacement-specs) Maybe call it =E2=80=98transform-package-source=E2=80=99 and remove the pre= vious =E2=80=98transform-package-source=E2=80=99 procedure. > + "Return a procedure that, when passed a package, replaces its direct > +dependencies according to REPLACEMENT-SPECS. REPLACEMENT-SPECS is a lis= t of > +strings like \"guile=3D/path/to/source\" or > +\"guile=3Dhttps://www.example.com/guile-source.tar.gz\" meaning that, any > +dependency on a package called \"guile\" must be replaced with a depende= ncy on a > +\"guile\" built with the source at the specified location. SPECS may al= so > +simply be a file location, in which case the package name and version ar= e parsed > +from the file name." > + (lambda (store obj) > + (let* ((replacements (evaluate-source-replacement-specs replacement-s= pecs > + (lambda* (old= file #:optional version) > + (package-with= -source store old file version)))) Please indent like the rest of the code (if you use Emacs, you can hit M-q to have it indent the surrounding expression correctly). Here the second line should be aligned with the first =E2=80=98a=E2=80=99 of =E2=80= =98lambda*=E2=80=99. Also please arrange to keep lines below 80 chars. > + (rewrite (package-input-rewriting/spec replacements)) > + (rewrite* (lambda (obj) > + (rewrite obj)))) You can remove =E2=80=98rewrite*=E2=80=99 and use =E2=80=98rewrite=E2=80=99= directly. > +(define (evaluate-source-replacement-specs specs proc) > + "Parse SPECS, a list of strings like \"guile=3D/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 packa= ge it > +refers to could not be found." > + (define* (replacement file #:optional version) > + (lambda (old) > + (proc old file version))) > + (map (lambda (spec) > + (match (string-tokenize spec %not-equal) > + ((package-spec file) > + (let* ((spec-list (call-with-values > + (lambda () > + (package-specification->name+version+o= utput package-spec)) > + list)) > + (name (list-ref spec-list 0)) > + (version (list-ref spec-list 1))) Use =E2=80=98let-values=E2=80=99 instead: (let-values (((name version) (package-specification->name+version+output spec))) =E2=80=A6) Also maybe s/package-spec/spec/; it=E2=80=99s clear enough in this context. > + (cons name (replacement file version)))) > + ((file) > + (let* ((package-spec > + (call-with-values > + (lambda () > + (hyphen-package-name->name+version > + (tarball-base-name (basename file)))) > + (lambda (name version) > + (cons name version)))) > + (name (car package-spec)) > + (version (cdr package-spec))) > + (cons name (replacement file version)))) =E2=80=98let-values=E2=80=99 also. > +++ b/tests/scripts-build.scm > @@ -94,9 +94,9 @@ > (let* ((port (open-output-string)) > (new (parameterize ((guix-warning-port port)) > (t store p)))) > - (and (eq? new p) > - (string-contains (get-output-string port) > - "had no effect")))))) > + (and (eq? (package-version new) (package-version p)) > + (eq? (package-name new) (package-name p)) > + (eq? (package-source new) (package-source p))))))) We can probably remove this test since the behavior it was checking no longer exists. > +(test-assert "options->transformation, with-source, recursive" > + (let* ((q (dummy-package "foo")) > + (p (dummy-package "guix.scm" > + (inputs `(("foo" ,q))))) > + (s (search-path %load-path "guix.scm")) > + (f (string-append "foo@42.0=3D" s)) > + (t (options->transformation `((with-source . ,f))))) > + (with-store store > + (let ((new (t store p))) > + (and (not (eq? new p)) > + (match (package-inputs new) > + ((("foo" dep1)) > + (and > + (string=3D? (package-name dep1) "foo") > + (string=3D? (package-version dep1) "42.0") > + (string=3D? (package-source dep1) > + (add-to-store store (basename s) #t > + "sha256" s)))))))))) Please indent correctly. >>>From 738fdb35af1449e245ce2e48c266c82f798d89af Mon Sep 17 00:00:00 2001 > From: Jesse Gibbons > Date: Sat, 26 Sep 2020 16:29:25 -0600 > Subject: [PATCH 2/2] news: Add entry for "--with-source" > > * etc/news,scm: Add entry. [...] > + (entry (commit "2d2f6c97ad1deeb2fc8a214d992c7894a7c5e293") > + (title (en "@option{--with-source} now recursive")) ^ + =E2=80=9Cpackage transformation option is=E2=80=9D > + (body (en "The @option{--with-source} common option now uses the > +specified source for all matching dependencies of any packages guix is d= irected > +to work with. This option is useful for all package maintainers, develop= ers, > +and, in general, all users who want guix to facilitate their rights to m= odify > +their software and share their changes."))) Usually there=E2=80=99s an extra sentence like =E2=80=9CRun info =E2=80=A6= =E2=80=9D explaining how to read the relevant part of the manual; it may be a good idea to add it. Could you send an updated patch? Hopefully the last one! Thanks, Ludo=E2=80=99. From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] bug#58032: [PATCH] transformations: '--with-source' now operates in depth. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Sep 2022 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 58032@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= , 43193@debbugs.gnu.org, philippe.swartvagher@inria.fr Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.166438361019790 (code B ref 43193); Wed, 28 Sep 2022 16:47:01 +0000 Received: (at 43193) by debbugs.gnu.org; 28 Sep 2022 16:46:50 +0000 Received: from localhost ([127.0.0.1]:34433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odaCv-000597-UC for submit@debbugs.gnu.org; Wed, 28 Sep 2022 12:46:50 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]:46965) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odaCt-00058p-5y; Wed, 28 Sep 2022 12:46:47 -0400 Received: by mail-qk1-f169.google.com with SMTP id d17so8196606qko.13; Wed, 28 Sep 2022 09:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date; bh=VDX+dRJLNfdkz2VJLwYss0AD/4bj/g76rUPmoyLIuJg=; b=oQ9wPmRAZDdRl0KyIfwvdxTMK2JoQkvmQVw44pUIsqzvMPAJQScwDBdxlXARNZI9DT HSWrqXaCJkki6zEFpLgLbsTqf3iKPnYEMHyu9LilWMzo+/B+HT27VFXIqBq1eWNvITeE koV2KHvbc8VnbCjNA3Lkf3Uej+GPJydcPv3TYBFlB0rtx75TlfbeaJ7QYHYc5jessyM5 5rbzxAqOPOavbEx1QhJtMeU/sii9HhZjCypsJNq+upxF5/B3xOw+PBbrfffc9b09ovNo hOmE0SBAWJR1g/Nf9HmauozQWWlCo/FmrCmCQu8pGb2lqzFrowyX/QqDsYxDIB7iHxPv 4mgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date; bh=VDX+dRJLNfdkz2VJLwYss0AD/4bj/g76rUPmoyLIuJg=; b=teuNq0c0x7Wq+JSVUHvnuMKs/I9wTN9nyXjiwyCI+4ixlMXjbohmrxvMMLllgUXcYo D4u4NLcaSl7lWOkynG0ihP907u/JJ1B1Kw78HOSBppnAOjGFiQRzwQuZYT9odBuK0nXi Tv/5uisZsthjRMB8t4iBD40lr6zsHoLA1kcO2PxNNbcZST3kEISI7bmGDASj2XfEcqpG pyaNXLx00D41JRxUxj9Og9NQdWSRlliPgpcVZi8F5kYpqSPDmBOh/bSupeygkfdeTLlO kVJgpTEqvtFVVCOW4iQmMhd3IZhuy52YIz381DSbW3cG3EGTwz9LtZ2OkxJfvcC1zX8T thlw== X-Gm-Message-State: ACrzQf0KuUcKCPMBVNHCPBk2sJih3imltgyk1zveXZBrNaOtzQcY/6AC GBRcMp2zg1BqhawntdClD+lKkkCvlp/vTw== X-Google-Smtp-Source: AMsMyM7mZ/Tia31jQAOvjSo3qclAivL/ITqCm1con5WTACVVgbQY7yknklQ/g9hbGV0DeaJ/NK0qSg== X-Received: by 2002:a37:b782:0:b0:6ce:1c45:c201 with SMTP id h124-20020a37b782000000b006ce1c45c201mr22770029qkf.454.1664383601193; Wed, 28 Sep 2022 09:46:41 -0700 (PDT) Received: from hurd (dsl-148-95.b2b2c.ca. [66.158.148.95]) by smtp.gmail.com with ESMTPSA id bb20-20020a05622a1b1400b003435bb7fe9csm3131273qtb.78.2022.09.28.09.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 09:46:40 -0700 (PDT) From: Maxim Cournoyer References: <20220923204208.31957-1-ludo@gnu.org> Date: Wed, 28 Sep 2022 12:46:39 -0400 In-Reply-To: <20220923204208.31957-1-ludo@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 23 Sep 2022 22:42:08 +0200") Message-ID: <87fsgbwiog.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Ludovic Court=C3=A8s writes: > From: Ludovic Court=C3=A8s > > The '--with-source' option is the first one that was implemented, and > it's the only one that would operate only on leaf packages rather than > traversing the dependency graph. This change makes it consistent with > the rest of the transformation options. Good idea! I needed to workaround the lack of recursion at least once. [...] > diff --git a/guix/transformations.scm b/guix/transformations.scm > index 411c4014cb..be2d31b8c7 100644 > --- a/guix/transformations.scm > +++ b/guix/transformations.scm > @@ -129,42 +129,46 @@ (define* (package-with-source p uri #:optional vers= ion) > ;;; Transformations. > ;;; >=20=20 > -(define (transform-package-source sources) > +(define (evaluate-source-replacement-specs specs) > + "Parse SPECS, a list of strings like \"guile=3D/tmp/guile-4.2.tar.gz\"= or just > +\"/tmp/guile-4.2.tar.gz\" and return a list of package spec/procedure pa= irs as > +expected by 'package-input-rewriting/spec'. Raise an error if an elemen= t of > +SPECS uses invalid syntax." > + (define not-equal > + (char-set-complement (char-set #\=3D))) > + > + (map (lambda (spec) > + (match (string-tokenize spec not-equal) > + ((uri) > + (let* ((base (tarball-base-name (basename uri))) Unrelated, but 'tarball-base-name' is a bit of a misnomer since the file could be a single, non-tarball archive (or plain file). > + (name (hyphen-package-name->name+version base))) > + (cons name > + (lambda (old) > + (package-with-source old uri))))) > + ((spec uri) > + (let-values (((name version) > + (package-name->name+version spec))) You usually recommend (srfi srfi-71) when using multiple values; why not use it here? I don't have a preference myself (I find srfi-71 surprising for the non-initiated (I was), although I like its simple interface! :-)). > + ;; Note: Here VERSION is used as the version string of the= new > + ;; package rather than as part of the spec of the package = being > + ;; targeted. > + (cons name > + (lambda (old) > + (package-with-source old uri version))))) > + (_ > + (raise (formatted-message > + (G_ "invalid source replacement specification: ~s") > + spec))))) > + specs)) > + > +(define (transform-package-source replacement-specs) > "Return a transformation procedure that replaces package sources with = the > -matching URIs given in SOURCES." > - (define new-sources > - (map (lambda (uri) > - (match (string-index uri #\=3D) > - (#f > - ;; Determine the package name and version from URI. > - (call-with-values > - (lambda () > - (hyphen-package-name->name+version > - (tarball-base-name (basename uri)))) > - (lambda (name version) > - (list name version uri)))) > - (index > - ;; What's before INDEX is a "PKG@VER" or "PKG" spec. > - (call-with-values > - (lambda () > - (package-name->name+version (string-take uri index))) > - (lambda (name version) > - (list name version > - (string-drop uri (+ 1 index)))))))) > - sources)) > - > - (lambda (obj) > - (let loop ((sources new-sources) > - (result '())) > - (match obj > - ((? package? p) > - (match (assoc-ref sources (package-name p)) > - ((version source) > - (package-with-source p source version)) > - (#f > - p))) > - (_ > - obj))))) > +matching URIs given in REPLACEMENT-SPECS." > + (let* ((replacements (evaluate-source-replacement-specs replacement-sp= ecs)) > + (rewrite (package-input-rewriting/spec replacements))) > + (lambda (obj) > + (if (package? obj) > + (rewrite obj) > + obj)))) >=20=20 > (define (evaluate-replacement-specs specs proc) > "Parse SPECS, a list of strings like \"guile=3Dguile@2.1\" and return = a list > diff --git a/tests/transformations.scm b/tests/transformations.scm > index dbfe523518..47b1fc650d 100644 > --- a/tests/transformations.scm > +++ b/tests/transformations.scm > @@ -103,16 +103,11 @@ (define-module (test-transformations) > "sha256" f)))))))))) >=20=20 > (test-assert "options->transformation, with-source, no matches" > - ;; When a transformation in not applicable, a warning must be raised. > (let* ((p (dummy-package "foobar")) > (s (search-path %load-path "guix.scm")) > (t (options->transformation `((with-source . ,s))))) > - (let* ((port (open-output-string)) > - (new (parameterize ((guix-warning-port port)) > - (t p)))) > - (and (eq? new p) > - (string-contains (get-output-string port) > - "had no effect"))))) > + (eq? (package-source (t p)) > + (package-source p)))) I'd personally find it a better interface if it failed noisily when --with-source doesn't have any effect. The warning was of little use because it got lost in the other outputs; now it would be totally silent, right? > (test-assert "options->transformation, with-source, PKG=3DURI" > (let* ((p (dummy-package "foo")) > @@ -147,6 +142,29 @@ (define-module (test-transformations) > (add-to-store store (basename s) #t > "sha256" s))))))) >=20=20 > +(test-assert "options->transformation, with-source, in depth" > + (let* ((p0 (dummy-package "foo" (version "0.0"))) > + (s (search-path %load-path "guix.scm")) > + (f (string-append "foo@42.0=3D" s)) > + (t (options->transformation `((with-source . ,f)))) > + (p1 (dummy-package "bar" (inputs (list p0)))) > + (p2 (dummy-package "baz" (inputs (list p1))))) > + (with-store store > + (let ((new (t p2))) > + (and (not (eq? new p2)) > + (match (package-inputs new) > + ((("bar" p1*)) > + (match (package-inputs p1*) > + ((("foo" p0*)) > + (and (not (eq? p0* p0)) > + (string=3D? (package-name p0*) (package-name p0)) > + (string=3D? (package-version p0*) "42.0") > + (string=3D? (add-to-store store (basename s) #t > + "sha256" s) > + (run-with-store store > + (lower-object > + (package-source p0*)))))))))))))) > + The recursive? option should probably be #f in the add-store above, since the "dummy" source is a single file. It may be better to create the dummy file ourselves instead of relying on the existence of a 'guix.scm' one (it'd help clarify the test too, that bit was a bit mysterious at first). Other than that, LGTM! Thanks, Maxim From unknown Mon Jun 23 11:27:05 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] bug#58032: [PATCH] transformations: '--with-source' now operates in depth. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 29 Sep 2022 11:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 58032@debbugs.gnu.org, 43193@debbugs.gnu.org, philippe.swartvagher@inria.fr Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.166444921710404 (code B ref 43193); Thu, 29 Sep 2022 11:01:02 +0000 Received: (at 43193) by debbugs.gnu.org; 29 Sep 2022 11:00:17 +0000 Received: from localhost ([127.0.0.1]:36272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odrH7-0002hf-6X for submit@debbugs.gnu.org; Thu, 29 Sep 2022 07:00:17 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:18661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odrH2-0002g3-9p; Thu, 29 Sep 2022 07:00:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version:content-transfer-encoding; bh=U1y4OIKBNp79oujF4G7lvLRBltc7lICmdQqbh0gIJtI=; b=W6gZjpNJdxsprarKK0Maajhd2U5jC9eK6mVsdkslLKlEA7okGdT92CTc ELKZxHMKU1OY1MrAafFj+3IGzcY490Lcpfa/+mbcsntV1PCW5E/bwfeCG VfJzXyq1v0VdPu1cmw1tU4eTAuBE285h1nn/Bqqzi6u461NsBT7h9l7UC Q=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludovic.courtes@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.93,354,1654552800"; d="scan'208";a="25006377" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 13:00:04 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220923204208.31957-1-ludo@gnu.org> <87fsgbwiog.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Octidi 8 =?UTF-8?Q?Vend=C3=A9miaire?= an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour de l'Amarante X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 29 Sep 2022 13:00:04 +0200 In-Reply-To: <87fsgbwiog.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 28 Sep 2022 12:46:39 -0400") Message-ID: <87h70qcuob.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Maxim, Maxim Cournoyer skribis: >> + (name (hyphen-package-name->name+version base))) >> + (cons name >> + (lambda (old) >> + (package-with-source old uri))))) >> + ((spec uri) >> + (let-values (((name version) >> + (package-name->name+version spec))) > > You usually recommend (srfi srfi-71) when using multiple values; why not > use it here? I don't have a preference myself (I find srfi-71 > surprising for the non-initiated (I was), although I like its simple > interface! :-)). This file is still on SRFI-11 so I followed that, but now that you mention it, I=E2=80=99ll switch it to SRFI-71 in a subsequent commit. :-) >> (test-assert "options->transformation, with-source, no matches" >> - ;; When a transformation in not applicable, a warning must be raised. >> (let* ((p (dummy-package "foobar")) >> (s (search-path %load-path "guix.scm")) >> (t (options->transformation `((with-source . ,s))))) >> - (let* ((port (open-output-string)) >> - (new (parameterize ((guix-warning-port port)) >> - (t p)))) >> - (and (eq? new p) >> - (string-contains (get-output-string port) >> - "had no effect"))))) >> + (eq? (package-source (t p)) >> + (package-source p)))) > > I'd personally find it a better interface if it failed noisily when > --with-source doesn't have any effect. The warning was of little use > because it got lost in the other outputs; now it would be totally > silent, right? Yes, it=E2=80=99ll be silent now, as with the other options. That=E2=80=99s not great; the problem is that it=E2=80=99s impossible to te= ll whether a package variant differs from the original one until they=E2=80=99ve been lo= wered to a bag (or a derivation). >> +(test-assert "options->transformation, with-source, in depth" >> + (let* ((p0 (dummy-package "foo" (version "0.0"))) >> + (s (search-path %load-path "guix.scm")) >> + (f (string-append "foo@42.0=3D" s)) >> + (t (options->transformation `((with-source . ,f)))) >> + (p1 (dummy-package "bar" (inputs (list p0)))) >> + (p2 (dummy-package "baz" (inputs (list p1))))) >> + (with-store store >> + (let ((new (t p2))) >> + (and (not (eq? new p2)) >> + (match (package-inputs new) >> + ((("bar" p1*)) >> + (match (package-inputs p1*) >> + ((("foo" p0*)) >> + (and (not (eq? p0* p0)) >> + (string=3D? (package-name p0*) (package-name p0= )) >> + (string=3D? (package-version p0*) "42.0") >> + (string=3D? (add-to-store store (basename s) #t >> + "sha256" s) >> + (run-with-store store >> + (lower-object >> + (package-source p0*)))))))))))))) >> + > > The recursive? option should probably be #f in the add-store above, > since the "dummy" source is a single file. No, it must be #t because that=E2=80=99s also how the transformation intern= s the file (the option is called =E2=80=9Crecursive?=E2=80=9D but it has little t= o do with recursive directory traversal and more to do with the serialization format.) > It may be better to create the dummy file ourselves instead of relying > on the existence of a 'guix.scm' one (it'd help clarify the test too, > that bit was a bit mysterious at first). Right, we could do that but that=E2=80=99s a tiny bit more verbose. Here I followed what existing tests do; perhaps we should plan for a face lift of some of these tests. Thanks for your feedback! Ludo=E2=80=99. From unknown Mon Jun 23 11:27:05 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jesse Gibbons Subject: bug#43193: closed (Re: bug#58032: [PATCH] transformations: '--with-source' now operates in depth.) Message-ID: References: <87edvt997x.fsf_-_@gnu.org> <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> X-Gnu-PR-Message: they-closed 43193 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 43193@debbugs.gnu.org Date: Thu, 29 Sep 2022 21:12:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1664485922-2672-1" This is a multi-part message in MIME format... ------------=_1664485922-2672-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #43193: [PATCH] guix: Add --with-dependency-source option which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 43193@debbugs.gnu.org. --=20 43193: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D43193 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1664485922-2672-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 43193-done) by debbugs.gnu.org; 29 Sep 2022 21:11:59 +0000 Received: from localhost ([127.0.0.1]:39810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oe0p4-0000gj-RF for submit@debbugs.gnu.org; Thu, 29 Sep 2022 17:11:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oe0p0-0000gS-Ju; Thu, 29 Sep 2022 17:11:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48148) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe0ou-0007ag-CQ; Thu, 29 Sep 2022 17:11:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=udfsfqHqakYzfDRKb7iwpRyJu1NDpFw9sGity/Gi6ck=; b=BRQFLTkaujpKNUg5Jwme uhbjMNACeopydyAPylXweifmShRzqIszNdn65UuM/eZV5IDMKengqLqSQj91oDQCAnH5+JXF7otdC xkNvXCnYt2JBEDo+jvq9/tooL3mF7OV3WPb4bxqOPLqVTk7JIG+hizpGEgrpsBFfsHI7z8KNXXNts Z7WoqrtZh3Sy5bCKOuCNevA1EGWio7YPOkKnXGuGRUerHtexqThSQED63oSRO/FuZ1f6gSCgFAt8D yz/Tm+e1d+YeR9HMWMxnLxGZC61iEPDG8lt1Ql//z3RPRt7fzzUMKt8SASBTf97gAkz8WMbr5mVyp byezaQSeWUhOtg==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36308 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe0ot-00076n-Pv; Thu, 29 Sep 2022 17:11:48 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: bug#58032: [PATCH] transformations: '--with-source' now operates in depth. References: <20220923204208.31957-1-ludo@gnu.org> <87fsgbwiog.fsf@gmail.com> <87h70qcuob.fsf@gnu.org> Date: Thu, 29 Sep 2022 23:11:46 +0200 In-Reply-To: <87h70qcuob.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 29 Sep 2022 13:00:04 +0200") Message-ID: <87edvt997x.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43193-done Cc: 58032-done@debbugs.gnu.org, 43193-done@debbugs.gnu.org, philippe.swartvagher@inria.fr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Pushed! 4244f5e9a7 news: Add entry for '--with-source'. 28ade1bab2 transformations: '--with-source' now operates in depth. Ludo'. ------------=_1664485922-2672-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Sep 2020 04:30:21 +0000 Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kE3Mi-0007TM-Oq for submit@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 ) id 1kE3Mi-0007TF-1L for submit@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 ) id 1kE3Mh-0005Ew-Qp for guix-patches@gnu.org; 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 ) id 1kE3Mf-0001Pj-Cy for guix-patches@gnu.org; Fri, 04 Sep 2020 00:30:19 -0400 Received: by mail-pl1-x62b.google.com with SMTP id y6so551244plk.10 for ; 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 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 21:30:12 -0700 (PDT) To: Guix Patches From: Jesse Gibbons Subject: [PATCH] guix: Add --with-dependency-source option Message-ID: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> 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@gmail.com; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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-- ------------=_1664485922-2672-1--