GNU bug report logs -
#62047
[PATCH 0/2] '--with-input' & co. no longer replace hidden packages
Previous Next
Reported by: Ludovic Courtès <ludo <at> gnu.org>
Date: Wed, 8 Mar 2023 12:02:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62047 in the body.
You can then email your comments to 62047 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
mail <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Wed, 08 Mar 2023 12:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
mail <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org
.
(Wed, 08 Mar 2023 12:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
This change makes things like:
guix build --with-input=guile=guile-next guix -n --no-grafts
more useful and tractable.
Low-level rewrites are still possible for packages not marked
as hidden in 'commencement.scm', such as glibc:
guix build --with-latest=glibc hello -n
Thoughts?
Ludo'.
Ludovic Courtès (2):
packages: Use SRFI-71 instead of SRFI-11.
packages: 'package-input-rewriting/spec' ignores hidden packages.
doc/guix.texi | 21 ++++++++++++---------
guix/packages.scm | 14 ++++++++------
tests/packages.scm | 20 +++++++++++++++++++-
3 files changed, 39 insertions(+), 16 deletions(-)
base-commit: 0a37921d851b94aef6900214098dc5bd62b46e26
--
2.39.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Wed, 08 Mar 2023 12:05:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 62047 <at> debbugs.gnu.org (full text, mbox):
* guix/packages.scm (package-input-rewriting/spec): Use SRFI-71 'let'.
---
guix/packages.scm | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 041a872f9d..cd61878bcc 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012-2023 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2014, 2015, 2017, 2018, 2019 Mark H Weaver <mhw <at> netris.org>
;;; Copyright © 2015 Eric Bavier <bavier <at> member.fsf.org>
;;; Copyright © 2016 Alex Kost <alezost <at> gmail.com>
@@ -51,10 +51,10 @@ (define-module (guix packages)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9 gnu)
- #:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
+ #:use-module (srfi srfi-71)
#:use-module (rnrs bytevectors)
#:use-module (web uri)
#:autoload (texinfo) (texi-fragment->stexi)
@@ -1534,8 +1534,7 @@ (define table
(fold (lambda (replacement table)
(match replacement
((spec . proc)
- (let-values (((name version)
- (package-name->name+version spec)))
+ (let ((name version (package-name->name+version spec)))
(vhash-cons name (list version proc) table)))))
vlist-null
replacements))
--
2.39.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Wed, 08 Mar 2023 12:05:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 62047 <at> debbugs.gnu.org (full text, mbox):
The primary motivation is to support things like:
guix build guix --with-input=guile=guile-next
without triggering a rebuild of (@@ (gnu packages commencement)
guile-final) and similar things.
It is also consistent with package name resolution on the command line:
a package that cannot be named cannot be replaced.
* guix/packages.scm (package-input-rewriting/spec)[rewrite]: When P is
hidden, return it as-is.
* tests/packages.scm ("package-input-rewriting/spec, hidden package"):
New test.
* doc/guix.texi (Defining Package Variants): Update.
(Package Transformation Options): Update '--with-input' example.
---
doc/guix.texi | 21 ++++++++++++---------
guix/packages.scm | 7 +++++--
tests/packages.scm | 20 +++++++++++++++++++-
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 6671ba9305..6803512435 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8331,10 +8331,13 @@ be replaced by name rather than by identity.
@deffn {Scheme Procedure} package-input-rewriting/spec @var{replacements} [#:deep? #t]
Return a procedure that, given a package, applies the given
@var{replacements} to all the package graph, including implicit inputs
-unless @var{deep?} is false. @var{replacements} is a list of
-spec/procedures pair; each spec is a package specification such as
-@code{"gcc"} or @code{"guile@@2"}, and each procedure takes a matching
-package and returns a replacement for that package.
+unless @var{deep?} is false.
+
+@var{replacements} is a list of spec/procedures pair; each spec is a
+package specification such as @code{"gcc"} or @code{"guile@@2"}, and
+each procedure takes a matching package and returns a replacement for
+that package. Matching packages that have the @code{hidden?} property
+set are not replaced.
@end deffn
The example above could be rewritten this way:
@@ -12664,18 +12667,18 @@ or @code{guile@@1.8}.
For instance, the following command builds Guix, but replaces its
dependency on the current stable version of Guile with a dependency on
-the legacy version of Guile, @code{guile@@2.0}:
+the legacy version of Guile, @code{guile@@2.2}:
@example
-guix build --with-input=guile=guile@@2.0 guix
+guix build --with-input=guile=guile@@2.2 guix
@end example
This is a recursive, deep replacement. So in this example, both
@code{guix} and its dependency @code{guile-json} (which also depends on
-@code{guile}) get rebuilt against @code{guile@@2.0}.
+@code{guile}) get rebuilt against @code{guile@@2.2}.
-This is implemented using the @code{package-input-rewriting} Scheme
-procedure (@pxref{Defining Packages, @code{package-input-rewriting}}).
+This is implemented using the @code{package-input-rewriting/spec} Scheme
+procedure (@pxref{Defining Packages, @code{package-input-rewriting/spec}}).
@item --with-graft=@var{package}=@var{replacement}
This is similar to @option{--with-input} but with an important difference:
diff --git a/guix/packages.scm b/guix/packages.scm
index cd61878bcc..11c066b292 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1527,9 +1527,11 @@ (define (cut? p)
(define* (package-input-rewriting/spec replacements #:key (deep? #t))
"Return a procedure that, given a package, applies the given REPLACEMENTS to
all the package graph, including implicit inputs unless DEEP? is false.
+
REPLACEMENTS is a list of spec/procedures pair; each spec is a package
specification such as \"gcc\" or \"guile <at> 2\", and each procedure takes a
-matching package and returns a replacement for that package."
+matching package and returns a replacement for that package. Matching
+packages that have the 'hidden?' property set are not replaced."
(define table
(fold (lambda (replacement table)
(match replacement
@@ -1557,7 +1559,8 @@ (define replacement-property
(gensym " package-replacement"))
(define (rewrite p)
- (if (assq-ref (package-properties p) replacement-property)
+ (if (or (assq-ref (package-properties p) replacement-property)
+ (hidden-package? p))
p
(match (find-replacement p)
(#f p)
diff --git a/tests/packages.scm b/tests/packages.scm
index f58c47817b..446be6ba52 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012-2023 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos <at> telenet.be>
@@ -1577,6 +1577,24 @@ (define right-system?
(match (delete-duplicates pythons eq?)
((p) (eq? p (rewrite python))))))
+(test-assert "package-input-rewriting/spec, hidden package"
+ ;; Hidden packages are not subject to rewriting.
+ (let* ((python (hidden-package python))
+ (p0 (dummy-package "chbouib"
+ (build-system trivial-build-system)
+ (inputs (list python))))
+ (rewrite (package-input-rewriting/spec
+ `(("python" . ,(const sed)))
+ #:deep? #t))
+ (p1 (rewrite p0))
+ (bag1 (package->bag p1))
+ (pythons (filter-map (match-lambda
+ (("python" python) python)
+ (_ #f))
+ (bag-transitive-inputs bag1))))
+ (match (delete-duplicates pythons eq?)
+ ((p) (eq? p python)))))
+
(test-equal "package-input-rewriting/spec, graft"
(derivation-file-name (package-derivation %store sed))
--
2.39.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Thu, 09 Mar 2023 20:16:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 62047 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Ludo,
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hello,
>
> This change makes things like:
>
> guix build --with-input=guile=guile-next guix -n --no-grafts
>
> more useful and tractable.
>
> Low-level rewrites are still possible for packages not marked
> as hidden in 'commencement.scm', such as glibc:
>
> guix build --with-latest=glibc hello -n
>
> Thoughts?
>
> Ludo'.
LGTM, and tested fine.
Best,
--
Josselin Poiret
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Fri, 10 Mar 2023 12:10:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 62047 <at> debbugs.gnu.org (full text, mbox):
Hi Ludo,
On mer., 08 mars 2023 at 13:03, Ludovic Courtès <ludo <at> gnu.org> wrote:
> - (let-values (((name version)
> - (package-name->name+version spec)))
> + (let ((name version (package-name->name+version spec)))
Out of curiosity, what is the difference? Aside SRFI-71 instead of
SRFI-11? Or why do you prefer SRFI-71 over -11?
Cheers,
simon
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Fri, 10 Mar 2023 16:47:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 62047 <at> debbugs.gnu.org (full text, mbox):
Simon Tournier <zimon.toutoune <at> gmail.com> skribis:
> On mer., 08 mars 2023 at 13:03, Ludovic Courtès <ludo <at> gnu.org> wrote:
>
>> - (let-values (((name version)
>> - (package-name->name+version spec)))
>> + (let ((name version (package-name->name+version spec)))
>
> Out of curiosity, what is the difference? Aside SRFI-71 instead of
> SRFI-11? Or why do you prefer SRFI-71 over -11?
There’s no semantic difference, but SRFI-71 looks clearer, doesn’t it?
:-)
See
<https://lists.gnu.org/archive/html/guix-devel/2021-01/msg00234.html>
for the original proposal.
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62047
; Package
guix-patches
.
(Fri, 10 Mar 2023 17:45:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 62047 <at> debbugs.gnu.org (full text, mbox):
Hi,
On Fri, 10 Mar 2023 at 17:46, Ludovic Courtès <ludo <at> gnu.org> wrote:
> See
> <https://lists.gnu.org/archive/html/guix-devel/2021-01/msg00234.html>
> for the original proposal.
Thanks! I had overlooked this.
Cheers,
simon
bug closed, send any further explanations to
62047 <at> debbugs.gnu.org and Ludovic Courtès <ludo <at> gnu.org>
Request was from
Ludovic Courtès <ludo <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 17 Mar 2023 21:03:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 15 Apr 2023 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 28 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.