From unknown Mon Aug 18 02:07:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58032 <58032@debbugs.gnu.org> To: bug#58032 <58032@debbugs.gnu.org> Subject: Status: [PATCH] transformations: '--with-source' now operates in depth. Reply-To: bug#58032 <58032@debbugs.gnu.org> Date: Mon, 18 Aug 2025 09:07:40 +0000 retitle 58032 [PATCH] transformations: '--with-source' now operates in dept= h. reassign 58032 guix-patches submitter 58032 Ludovic Court=C3=A8s severity 58032 normal tag 58032 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 23 16:42:28 2022 Received: (at submit) by debbugs.gnu.org; 23 Sep 2022 20:42:28 +0000 Received: from localhost ([127.0.0.1]:41844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obpVD-0007N2-NC for submit@debbugs.gnu.org; Fri, 23 Sep 2022 16:42:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:55414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obpVB-0007Mu-FR for submit@debbugs.gnu.org; Fri, 23 Sep 2022 16:42:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obpV9-0002Q4-S3 for guix-patches@gnu.org; Fri, 23 Sep 2022 16:42:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obpV7-00009t-J1; Fri, 23 Sep 2022 16:42:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=CLZItMJxIOrI8pmYHm1ruwDwgA0pAQmTugXbnIyXA0Q=; b=gvGa1iHA1bbN5K Wzt8RBMElH3lN9yE7jx3INEb93XozpMoBXukVuPCwrqg9AXgFGMAQiyim2vSEbsS3imtDjc5a22/b +lQdg2gmqyrFaOT4SZ/ITrzL7SP1CeGMQNl9mEd55zxRIrLf5PGqSFTVCCEG0cDdLbBSsgh+kc/TY OXEp75v/BEBMKM62yqxj6+4zjMsVeOitgNQekABcGhNp9/N8V5xjopq3RyG7fd74C4hBAF1dT8jb6 +8DZBkoVcQrJv9tVF4snqxUBXQRxY4BXvD4kXY9P8sS5sxOhwPH+yFgtBML2zcZrpKGhXbx3BJNGN dUKjHwdfB/AlTCE1x1qw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:62283 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obpV6-00073I-Vc; Fri, 23 Sep 2022 16:42:21 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] transformations: '--with-source' now operates in depth. Date: Fri, 23 Sep 2022 22:42:08 +0200 Message-Id: <20220923204208.31957-1-ludo@gnu.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Debbugs-CC: philippe.swartvagher@inria.fr, 43193@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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 (---) From: Ludovic Courtès 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. * guix/transformations.scm (evaluate-source-replacement-specs): New procedure. (transform-package-source): Rewrite using it. * tests/transformations.scm ("options->transformation, with-source, no matches"): Rewrite since we no longer get a warning. ("options->transformation, with-source, in depth"): New test. * doc/guix.texi (Package Transformation Options): Adjust examples. --- doc/guix.texi | 7 ++-- guix/transformations.scm | 74 +++++++++++++++++++++------------------ tests/transformations.scm | 32 +++++++++++++---- 3 files changed, 68 insertions(+), 45 deletions(-) Hi! That ‘--with-source’ doesn’t work recursively, unlike other transformations, has been a source of confusion. This change addresses that. (It could probably use a channel news entry.) Thoughts? Actually a similar attempt had been made by Jesse Gibbons at . Oh well… Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index eb12efa85e..7316b1c157 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12348,14 +12348,15 @@ one provided by the distribution. The example below downloads the @code{ed} package: @example -guix build ed --with-source=mirror://gnu/ed/ed-1.7.tar.gz +guix build ed --with-source=mirror://gnu/ed/ed-1.4.tar.gz @end example As a developer, @option{--with-source} makes it easy to test release -candidates: +candidates, and even to test their impact on packages that depend on +them: @example -guix build guile --with-source=../guile-2.0.9.219-e1bb7.tar.xz +guix build elogind --with-source=@dots{}/shepherd-0.9.0rc1.tar.gz @end example @dots{} or to build from a checkout in a pristine environment: 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 version) ;;; Transformations. ;;; -(define (transform-package-source sources) +(define (evaluate-source-replacement-specs specs) + "Parse SPECS, a list of strings like \"guile=/tmp/guile-4.2.tar.gz\" or just +\"/tmp/guile-4.2.tar.gz\" and return a list of package spec/procedure pairs as +expected by 'package-input-rewriting/spec'. Raise an error if an element of +SPECS uses invalid syntax." + (define not-equal + (char-set-complement (char-set #\=))) + + (map (lambda (spec) + (match (string-tokenize spec not-equal) + ((uri) + (let* ((base (tarball-base-name (basename uri))) + (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))) + ;; 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 #\=) - (#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-specs)) + (rewrite (package-input-rewriting/spec replacements))) + (lambda (obj) + (if (package? obj) + (rewrite obj) + obj)))) (define (evaluate-replacement-specs specs proc) "Parse SPECS, a list of strings like \"guile=guile@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)))))))))) (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)))) (test-assert "options->transformation, with-source, PKG=URI" (let* ((p (dummy-package "foo")) @@ -147,6 +142,29 @@ (define-module (test-transformations) (add-to-store store (basename s) #t "sha256" s))))))) +(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=" 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=? (package-name p0*) (package-name p0)) + (string=? (package-version p0*) "42.0") + (string=? (add-to-store store (basename s) #t + "sha256" s) + (run-with-store store + (lower-object + (package-source p0*)))))))))))))) + (test-assert "options->transformation, with-input" (let* ((p (dummy-package "guix.scm" (inputs `(("foo" ,(specification->package "coreutils")) -- 2.37.3 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 28 12:46:51 2022 Received: (at 58032) by debbugs.gnu.org; 28 Sep 2022 16:46:51 +0000 Received: from localhost ([127.0.0.1]:34435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odaCw-000599-I4 for submit@debbugs.gnu.org; Wed, 28 Sep 2022 12:46:51 -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 To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#58032: [PATCH] transformations: '--with-source' now operates in depth. 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?Cou?= =?utf-8?Q?rt=C3=A8s=22'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-Debbugs-Envelope-To: 58032 Cc: 58032@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= , 43193@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: -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 debbugs-submit-bounces@debbugs.gnu.org Thu Sep 29 07:00:18 2022 Received: (at 58032) by debbugs.gnu.org; 29 Sep 2022 11:00:18 +0000 Received: from localhost ([127.0.0.1]:36274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odrH7-0002hl-Jt for submit@debbugs.gnu.org; Thu, 29 Sep 2022 07:00:18 -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: =?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> 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=2C?= 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-Debbugs-Envelope-To: 58032 Cc: 58032@debbugs.gnu.org, 43193@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 (---) 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 debbugs-submit-bounces@debbugs.gnu.org Thu Sep 29 17:11:59 2022 Received: (at 58032-done) by debbugs.gnu.org; 29 Sep 2022 21:11:59 +0000 Received: from localhost ([127.0.0.1]:39812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oe0p5-0000gm-3j 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: 58032-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'. From unknown Mon Aug 18 02:07:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 28 Oct 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator