guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] display grafted package


From: zimoun
Subject: [PATCH] display grafted package
Date: Mon, 29 Mar 2021 01:37:23 +0200

Hi Mark and Andreas

Quoting from <871rc5jv1o.fsf@netris.org">https://yhetil.org/guix/871rc5jv1o.fsf@netris.org>.

On Tue, 23 Mar 2021 at 19:42, Mark H Weaver <mhw@netris.org> wrote:

> How about changing "guix package -A" and "guix package -s" to display
> information about the package's replacement, if it has one?
>
> Alternatively, those commands could somehow explicitly indicate that the
> package has been grafted, and show the version number of the
> replacement, in such a way that is less confusing to users.

The attached patch does that only for ’package->recutils’ (show and
search).  For instance, note the ’replaced’ field for the grafted
package.  (Obviously, it could be any other word than ’replaced’
compatible with the recutils record.)

--8<---------------cut here---------------start------------->8---
$ time ./pre-inst-env guix show zstd
name: zstd
version: 1.4.9
outputs: out lib static
systems: x86_64-linux i686-linux
dependencies: 
location: gnu/packages/compression.scm:1473:2
homepage: https://facebook.github.io/zstd/
license: Modified BSD, FreeBSD, GPL 2, GPL 3+, Expat, Public Domain, Zlib
synopsis: Zstandard real-time compression algorithm  
description: Zstandard (`zstd') is a lossless compression algorithm that
+ combines very fast operation with a compression ratio comparable to that of
+ zlib.  In most scenarios, both compression and decompression can be performed
+ in ‘real time’.  The compressor can be configured to provide the most suitable
+ trade-off between compression ratio and speed, without affecting decompression
+ speed.

name: zstd
version: 1.4.4
replaced: 1.4.9
outputs: out lib static
systems: x86_64-linux i686-linux
dependencies: 
location: gnu/packages/compression.scm:1402:2
homepage: https://facebook.github.io/zstd/
license: Modified BSD, FreeBSD, GPL 2, GPL 3+, Expat, Public Domain, Zlib
synopsis: Zstandard real-time compression algorithm  
description: Zstandard (`zstd') is a lossless compression algorithm that
+ combines very fast operation with a compression ratio comparable to that of
+ zlib.  In most scenarios, both compression and decompression can be performed
+ in ‘real time’.  The compressor can be configured to provide the most suitable
+ trade-off between compression ratio and speed, without affecting decompression
+ speed.

real    0m0.822s
user    0m1.039s
sys     0m0.057s
--8<---------------cut here---------------end--------------->8---

On my machine, it slows down from 0.5s to 0.8s; I do not know why.


How display such information for ’package -A’?  The (selected) output
looks like:

--8<---------------cut here---------------start------------->8---
zstd    1.4.9   out,lib,static  gnu/packages/compression.scm:1473:2
zstd    1.4.4   out,lib,static  gnu/packages/compression.scm:1402:2
--8<---------------cut here---------------end--------------->8---

And it appears to me hard to add another field or add something to the
’1.4.4’ line.  I mean, it would probably break some script.  Maybe some
people use this format to pipe.  I do not know.

WDYT?

Cheers,
simon

diff --git a/guix/ui.scm b/guix/ui.scm
index 7fbd4c63a2..b6497f5e5c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1528,9 +1528,18 @@ HYPERLINKS? is true, emit hyperlink escape sequences 
when appropriate."
   (define (package<? p1 p2)
     (string<? (package-full-name p1) (package-full-name p2)))
 
+  (define replacement
+    (package-replacement p))
+
   ;; Note: Don't i18n field names so that people can post-process it.
   (format port "name: ~a~%" (package-name p))
   (format port "version: ~a~%" (package-version p))
+  (when replacement
+    (unless
+     (string=?
+      (package-version p)
+      (package-version replacement))
+     (format port "replaced: ~a~%" (package-version replacement))))
   (format port "outputs: ~a~%" (string-join (package-outputs p)))
   (format port "systems: ~a~%"
           (string-join (package-transitive-supported-systems p)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]