From: zimoun <zimon.toutoune@gmail.com>
To: Mark H Weaver <mhw@netris.org>, Andreas Enge <andreas@enge.fr>
Cc: guix-devel@gnu.org
Subject: [PATCH] display grafted package
Date: Mon, 29 Mar 2021 01:37:23 +0200 [thread overview]
Message-ID: <86im5a6ea4.fsf@gmail.com> (raw)
[-- 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)))
next reply other threads:[~2021-03-29 5:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-28 23:37 zimoun [this message]
2021-03-30 12:15 ` [PATCH] display grafted package Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86im5a6ea4.fsf@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=andreas@enge.fr \
--cc=guix-devel@gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).