all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] display grafted package
@ 2021-03-28 23:37 zimoun
  2021-03-30 12:15 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: zimoun @ 2021-03-28 23:37 UTC (permalink / raw)
  To: Mark H Weaver, Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3124 bytes --]

Hi Mark and Andreas

Quoting from <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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: show-graft.patch --]
[-- Type: text/x-diff, Size: 876 bytes --]

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)))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] display grafted package
  2021-03-28 23:37 [PATCH] display grafted package zimoun
@ 2021-03-30 12:15 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2021-03-30 12:15 UTC (permalink / raw)
  To: zimoun; +Cc: guix-devel

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> 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.)

[...]

> name: zstd
> version: 1.4.4
> replaced: 1.4.9

I’d make it “replacement” rather than “replaced”.

> How display such information for ’package -A’?  The (selected) output
> looks like:
>
> 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

Ultimately, you’d want ‘fold-packages’ to traverse replacements, but I
don’t think that’s a good idea because it would break the assumption
that ‘fold-packages’ only traverses public packages.

All in all, I’m in favor of either the status quo or the
‘package->recutils’ patch you propose.

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-30 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-28 23:37 [PATCH] display grafted package zimoun
2021-03-30 12:15 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.