GNU bug report logs - #31176
[PATCH] gnu: Add inxi.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Mon, 16 Apr 2018 10:24:01 UTC

Severity: normal

Tags: patch

Merged with 31178

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

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 31176 in the body.
You can then email your comments to 31176 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 16 Apr 2018 10:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 16 Apr 2018 10:24:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH] gnu: Add inxi.
Date: Mon, 16 Apr 2018 13:22:31 +0300
* gnu/packages/inxi.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add this.
---
 gnu/local.mk          |   1 +
 gnu/packages/inxi.scm | 116 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
 create mode 100644 gnu/packages/inxi.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 713d9ae11..1c0c3d16c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -228,6 +228,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/indent.scm			\
   %D%/packages/inklingreader.scm		\
   %D%/packages/inkscape.scm			\
+  %D%/packages/inxi.scm			\
   %D%/packages/irc.scm  			\
   %D%/packages/iso-codes.scm			\
   %D%/packages/java.scm				\
diff --git a/gnu/packages/inxi.scm b/gnu/packages/inxi.scm
new file mode 100644
index 000000000..ada2ce216
--- /dev/null
+++ b/gnu/packages/inxi.scm
@@ -0,0 +1,116 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages inxi)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages admin)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages file)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gl)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages pciutils)
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (ice-9 match))
+
+(define-public inxi-minimal
+  (let ((commit "c934578ffb4f920cb04c91305a54dbdc4aa99d80"))
+    (package
+      (name "inxi-minimal")
+      (version (git-version "2.3.56" "1" commit))
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/smxi/inxi"
+                             "/raw/" commit "/inxi.tar.gz"))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (sha256
+          (base32
+           "0cmb95fw4jf5fqxmivwxy63sqyl7jnb3v7sbqqhafx0iwxgxi77h"))))
+      (build-system trivial-build-system)
+      (inputs
+       `(("bash" ,bash)))
+      (native-inputs
+       `(("coreutils" ,coreutils)
+         ("gawk" ,gawk)
+         ("grep" ,grep)
+         ("pciutils" ,pciutils)
+         ("procps" ,procps)
+         ("sed" ,sed)
+         ("tar" ,tar)
+         ("gzip" ,gzip)))
+      (arguments
+       `(#:modules
+         ((guix build utils)
+          (ice-9 match))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (ice-9 match))
+           (setenv "PATH" (string-append
+                           (assoc-ref %build-inputs "tar") "/bin" ":"
+                           (assoc-ref %build-inputs "gzip") "/bin" ":"
+                           (assoc-ref %build-inputs "bash") "/bin"))
+           (system* "tar" "xvf" (assoc-ref %build-inputs "source"))
+           (substitute* "inxi" (("/usr/bin/env bash") (which "bash")))
+           (let ((bin (string-append %output "/bin")))
+             (install-file "inxi" bin)
+             (wrap-program (string-append bin "/inxi")
+               `("PATH" ":" = ("$PATH"
+                               ,@(map (lambda (input)
+                                        (string-append
+                                         (match input ((name . store) store))
+                                         "/bin"))
+                                      %build-inputs)))))
+           (install-file "inxi.1.gz"
+                         (string-append %output "/share/doc/man/man1"))
+           #t)))
+      (home-page "https://smxi.org/")
+      (synopsis "Full featured system information script")
+      (description "Inxi is a system information script that can display
+various things about your hardware and software to users in an IRC chatroom or
+support forum.  It runs with the /exec command in most IRC clients. ")
+      (license license:gpl3+))))
+
+(define-public inxi
+  (package
+    (inherit inxi-minimal)
+    (name "inxi")
+    (native-inputs
+     `(("dmidecode" ,dmidecode)
+       ("file" ,file)
+       ("iproute" ,iproute)
+       ("kmod" ,kmod)
+       ("lm-sensors" ,lm-sensors)
+       ("mesa-utils" ,mesa-utils)
+       ("net-tools" ,net-tools)
+       ("sudo" ,sudo)
+       ("usbutils" ,usbutils)
+       ("xdpyinfo" ,xdpyinfo)
+       ("xprop" ,xprop)
+       ("xrandr" ,xrandr)
+       ;; XXX: Add more inputs after packaging them.
+       ;; ("hddtemp" ,hddtemp)
+       ,@(package-native-inputs inxi-minimal)))))
-- 
2.17.0





Merged 31176. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Sun, 22 Apr 2018 21:41:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Sun, 22 Apr 2018 21:43:01 GMT) Full text and rfc822 format available.

Message #10 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 22 Apr 2018 23:42:19 +0200
Hello Pierre & Oleg,

Pierre Neidhardt <ambrevar <at> gmail.com> skribis:

> * gnu/packages/admin.scm (inxi): New variable.

Could you compare what the two of you submitted at pretty much the same
time?  :-)

<https://bugs.gnu.org/31176>
<https://bugs.gnu.org/31178>

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 23 Apr 2018 04:34:02 GMT) Full text and rfc822 format available.

Message #13 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 23 Apr 2018 10:03:23 +0530
[Message part 1 (text/plain, inline)]
I didn't know Oleg was going to submit a patch, maybe there was some
confusion in the process :p

I've quickly reviewed our two patches.  Overall I'd opt for mine :p

- It's the latest version.
- It has more inputs.

I think we should use propagated-inputs and not native-inputs.  What do
you think?

I'd opt for Oleg's description however!

One thing I forgot is to add a comment about why I've used

 (with-fluids ((%default-port-encoding #f))

It's because the `inxi` file contains some weird character.  It was
mentioned before on the mailing list.

-- 
Pierre Neidhardt
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 23 Apr 2018 05:24:02 GMT) Full text and rfc822 format available.

Message #16 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 23 Apr 2018 08:23:11 +0300
[Message part 1 (text/plain, inline)]
Hello Pierre and Ludovic,

Pierre Neidhardt <ambrevar <at> gmail.com> writes:

> I didn't know Oleg was going to submit a patch, maybe there was some
> confusion in the process :p

I've mentioned it in our mailing list discussion, see
https://lists.gnu.org/archive/html/help-guix/2018-04/msg00130.html

Nevertheless thank you for a 31178!  :-)

> I've quickly reviewed our two patches.  Overall I'd opt for mine :p
>
> - It's the latest version.
> - It has more inputs.

I thought that we stuck with an ‘inxi’ Perl script version (31178) and
there was no patch until I pushed one.  It's better to get 31178 version
than 31176 ofcourse because of ‘inxi’ version.

But I don't like all those ‘propagated-inputs’ except ‘perl-*’ and I
guess we could do better.  Maybe we could use PATH for non ‘perl-*’
inputs the same way as in 31176.  WDYT?

> I think we should use propagated-inputs and not native-inputs.  What do
> you think?

I'm not sure about 31178 currently.  Usually we prefer to avoid
‘propagated-inputs’ if possible in Guix, because all ‘propagated-inputs’
will be in a Guix profile and could lead to collisions.

If you are talking about 31176, then no, because I've used a wrapper to
find all ‘inxi-minimal’ or ‘inxi’ requisites.  It was easy to do,
because ‘inxi’ in 31176 is a Shell script, not a Perl script.  Thanks to
Chris Marusich for an idea.

[…]

[1]  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31176

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 23 Apr 2018 05:35:01 GMT) Full text and rfc822 format available.

Message #19 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 23 Apr 2018 11:04:40 +0530
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

>> I didn't know Oleg was going to submit a patch, maybe there was some
>> confusion in the process :p
>
> I've mentioned it in our mailing list discussion, see
> https://lists.gnu.org/archive/html/help-guix/2018-04/msg00130.html

Sorry, I had completely missed the last line :)

> If you are talking about 31176, then no, because I've used a wrapper to
> find all ‘inxi-minimal’ or ‘inxi’ requisites.  It was easy to do,
> because ‘inxi’ in 31176 is a Shell script, not a Perl script.  Thanks to
> Chris Marusich for an idea.

I think we can do the same thing for the Perl version.  You want to give
it a try?

If I understand correctly, relying on native-inputs would mean that if the user
runs `guix gc`, then all of inxi "optional" dependencies would go.
Is this correct?

-- 
Pierre Neidhardt

Computers are unreliable, but humans are even more unreliable.
Any system which depends on human reliability is unreliable.
		-- Gilb
[signature.asc (application/pgp-signature, inline)]

Merged 31176 31178. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Sat, 28 Apr 2018 21:27:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Sat, 28 Apr 2018 21:28:01 GMT) Full text and rfc822 format available.

Message #24 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Sat, 28 Apr 2018 23:27:08 +0200
Oleg, could you take care of this patch?  (See Pierre’s comments below.)

Pierre Neidhardt <ambrevar <at> gmail.com> skribis:

> Oleg Pykhalov <go.wigust <at> gmail.com> writes:
>
>>> I didn't know Oleg was going to submit a patch, maybe there was some
>>> confusion in the process :p
>>
>> I've mentioned it in our mailing list discussion, see
>> https://lists.gnu.org/archive/html/help-guix/2018-04/msg00130.html
>
> Sorry, I had completely missed the last line :)
>
>> If you are talking about 31176, then no, because I've used a wrapper to
>> find all ‘inxi-minimal’ or ‘inxi’ requisites.  It was easy to do,
>> because ‘inxi’ in 31176 is a Shell script, not a Perl script.  Thanks to
>> Chris Marusich for an idea.
>
> I think we can do the same thing for the Perl version.  You want to give
> it a try?
>
> If I understand correctly, relying on native-inputs would mean that if the user
> runs `guix gc`, then all of inxi "optional" dependencies would go.
> Is this correct?




Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Sun, 29 Apr 2018 17:40:02 GMT) Full text and rfc822 format available.

Message #27 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 31178 <at> debbugs.gnu.org, 31176 <at> debbugs.gnu.org,
 Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 29 Apr 2018 20:38:43 +0300
[Message part 1 (text/plain, inline)]
Hello,

ludo <at> gnu.org (Ludovic Courtès) writes:

> Oleg, could you take care of this patch?

[…]

Sure I will try because I want ‘inxi’ to be in Guix package collection,
too.  But I don't want to give a promise because I'm not much familiar
with a Perl, so it will require some time for me.  I don't like current
implementation of the latest version of ‘inxi’ package recipe in 31178.
If I'm only one thinking like that and it's good enough for a push to
‘origin/master’, feel free to say me about this or push it.

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 30 Apr 2018 10:08:01 GMT) Full text and rfc822 format available.

Message #30 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 31178 <at> debbugs.gnu.org, 31176 <at> debbugs.gnu.org,
 Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 30 Apr 2018 12:07:08 +0200
Hi Oleg,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Oleg, could you take care of this patch?
>
> […]
>
> Sure I will try because I want ‘inxi’ to be in Guix package collection,
> too.  But I don't want to give a promise because I'm not much familiar
> with a Perl, so it will require some time for me.  I don't like current
> implementation of the latest version of ‘inxi’ package recipe in 31178.
> If I'm only one thinking like that and it's good enough for a push to
> ‘origin/master’, feel free to say me about this or push it.

I really trust you to make the right decision.  The only reason I’m
pinging you is so these patches don’t get lost; they look simple enough
that it shouldn’t take months to apply them.  :-)

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 30 Apr 2018 12:32:02 GMT) Full text and rfc822 format available.

Message #33 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 30 Apr 2018 18:01:43 +0530
[Message part 1 (text/plain, inline)]
Oleg, if I understood correctly, your concern was about inputs.
To re-quote myself:

> If I understand correctly, relying on native-inputs would mean that if the user
> runs `guix gc`, then all of inxi "optional" dependencies would go.
> Is this correct?

What's your take on inputs then?  If there is anything else, please go
ahead, I can try to address those issues.

I don't have deep knowledge of Perl either so there might be some more
issues I haven't noticed yet.  But I think those can easily be patched
in the future when we have more user feedback.

I think it's better to have a package that behaves well in the general
case than not having a package at all.

-- 
Pierre Neidhardt

The solution of problems is the most characteristic and peculiar sort
of voluntary thinking.
		-- William James
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 30 Apr 2018 19:19:01 GMT) Full text and rfc822 format available.

Message #36 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 30 Apr 2018 22:18:13 +0300
[Message part 1 (text/plain, inline)]
Hello Pierre,

Pierre Neidhardt <ambrevar <at> gmail.com> writes:

> Oleg, if I understood correctly, your concern was about inputs.
> To re-quote myself:
>
>> If I understand correctly, relying on native-inputs would mean that if the user
>> runs `guix gc`, then all of inxi "optional" dependencies would go.
>> Is this correct?

All “references” should survive ‘guix gc’:
--8<---------------cut here---------------start------------->8---
guix gc --references $(env GUIX_PACKAGE_PATH= guix build --no-grafts inxi)
--8<---------------cut here---------------end--------------->8---

> What's your take on inputs then?  If there is anything else, please go
> ahead, I can try to address those issues.

OK, here is a new recipe, which works even in a container (unlike old
‘inxi’ which is a Shell script and not Perl).

--8<---------------cut here---------------start------------->8---
~/src/guix/pre-inst-env env GUIX_PACKAGE_PATH= guix environment --no-grafts --container --ad-hoc inxi
--8<---------------cut here---------------end--------------->8---

I've succeeded to test it by invoking ‘inxi’ and ‘inxi --full’, but
please test it more for your use cases.

[0001-gnu-Add-inxi.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
[…]

> I think it's better to have a package that behaves well in the general
> case than not having a package at all.

I agree.  We have an old ‘inxi’ (Shell script version), which should not
produce collisions because of unnecessary ‘propagated-inputs’.

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Tue, 01 May 2018 07:29:01 GMT) Full text and rfc822 format available.

Message #39 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
Date: Tue, 01 May 2018 10:27:51 +0300
[Message part 1 (text/plain, inline)]
Some notes to fix myself about the latest patch.

Oleg Pykhalov <go.wigust <at> gmail.com> writes:

[…]

> From 49afb43e03b1de34741c0812cc45fe48c06c404b Mon Sep 17 00:00:00 2001
> From: Pierre Neidhardt <ambrevar <at> gmail.com>
> Date: Mon, 16 Apr 2018 18:08:30 +0530
> Subject: [PATCH] gnu: Add inxi.
>
> * gnu/packages/admin.scm (inxi): New variable.

I forgot about mentioning a patch in ‘gnu/local.mk’.

[…]

> +(define-public inxi-minimal
> +  (let ((version "3.0.04-1")
> +        (real-name "inxi"))

‘let version’ is not necessary.  We could use ‘,version’ in ‘arguments’..

[…]

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Sun, 06 May 2018 09:43:01 GMT) Full text and rfc822 format available.

Message #42 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <pe.neidhardt <at> googlemail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 06 May 2018 11:42:28 +0200
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

>>> If I understand correctly, relying on native-inputs would mean that if the user
>>> runs `guix gc`, then all of inxi "optional" dependencies would go.
>>> Is this correct?
>
> All “references” should survive ‘guix gc’:
> --8<---------------cut here---------------start------------->8---
> guix gc --references $(env GUIX_PACKAGE_PATH= guix build --no-grafts inxi)
> --8<---------------cut here---------------end--------------->8---

OK, so if I understand correctly, only native-inputs get
garbage-collected, right?

Unless I've missed something in the manual, those details should be
better documented in my opinion.

> I've succeeded to test it by invoking ‘inxi’ and ‘inxi --full’, but
> please test it more for your use cases.

I've tested with `inxi --recommends` and everything looks OK.

See comments on patch below:

> From 49afb43e03b1de34741c0812cc45fe48c06c404b Mon Sep 17 00:00:00 2001
> From: Pierre Neidhardt <ambrevar <at> gmail.com>
> Date: Mon, 16 Apr 2018 18:08:30 +0530
> Subject: [PATCH] gnu: Add inxi.
>
> * gnu/packages/admin.scm (inxi): New variable.
> ---
>  gnu/packages/admin.scm                        | 115 +++++++++++++++++-
>  .../patches/inxi-minimal-fix-syntax.patch     |  18 +++
>  2 files changed, 132 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/inxi-minimal-fix-syntax.patch
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 5e2cf2d7a..7081f7f08 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -50,8 +50,11 @@
>    #:use-module (guix build-system trivial)
>    #:use-module (gnu packages)
>    #:use-module (gnu packages base)
> +  #:use-module (gnu packages bash)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages cyrus-sasl)
> +  #:use-module (gnu packages dns)
> +  #:use-module (gnu packages file)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages readline)
>    #:use-module (gnu packages linux)
> @@ -70,6 +73,7 @@
>    #:use-module (gnu packages gnupg)
>    #:use-module (gnu packages bison)
>    #:use-module (gnu packages flex)
> +  #:use-module (gnu packages gl)
>    #:use-module (gnu packages glib)
>    #:use-module (gnu packages openldap)
>    #:use-module (gnu packages mcrypt)
> @@ -97,7 +101,8 @@
>    #:use-module (gnu packages xml)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages elf)
> -  #:use-module (gnu packages mpi))
> +  #:use-module (gnu packages mpi)
> +  #:use-module (gnu packages web))
>  
>  (define-public aide
>    (package
> @@ -2649,3 +2654,111 @@ Python loading in HPC environments.")
>      ;; This package supports x86_64 and PowerPC64
>      (supported-systems '("x86_64-linux"))
>      (license license:lgpl2.1)))
> +
> +(define-public inxi-minimal
> +  (let ((version "3.0.04-1")
> +        (real-name "inxi"))
> +    (package
> +      (name "inxi-minimal")
> +      (version version)
> +      (source
> +       (origin
> +         (method url-fetch)
> +         (uri (string-append "https://github.com/smxi/inxi"
> +                             "/archive/" version "/inxi.tar.gz"))
> +         (file-name (string-append real-name "-" version ".tar.gz"))
> +         (sha256
> +          (base32
> +           "14zxdsjgh9dbijmpp0hhvg2yiqqfwnqgcc6x8dpl1v15z1h1r7pc"))
> +         (patches (search-patches "inxi-minimal-fix-syntax.patch"))))
> +      (build-system trivial-build-system)
> +      (inputs
> +       `(("bash" ,bash)
> +         ("perl" ,perl)))
> +      (native-inputs
> +       `(("gzip" ,gzip)
> +         ("tar" ,tar)
> +         ("xz" ,xz)))
> +      (arguments
> +       `(#:modules
> +         ((guix build utils)
> +          (ice-9 match)
> +          (srfi srfi-26))
> +         #:builder
> +         (begin
> +           (use-modules (guix build utils)
> +                        (ice-9 match)
> +                        (srfi srfi-26))
> +           (setenv "PATH" (string-append
> +                           (assoc-ref %build-inputs "bash") "/bin" ":"
> +                           (assoc-ref %build-inputs "gzip") "/bin" ":"
> +                           (assoc-ref %build-inputs "perl") "/bin" ":"
> +                           (assoc-ref %build-inputs "tar") "/bin" ":"
> +                           (assoc-ref %build-inputs "xz") "/bin"))
> +           (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
> +           (with-directory-excursion ,(string-append real-name "-" version)
> +             (substitute* "inxi" (("/usr/bin/env perl") (which "perl")))
> +             (let ((bin (string-append %output "/bin")))
> +               (install-file "inxi" bin)
> +               (wrap-program (string-append bin "/inxi")
> +                 `("PATH" ":" =
> +                   ("$PATH"
> +                    ,@(map (lambda (input)
> +                             (string-append (match input
> +                                              ((name . store) store))
> +                                            "/bin"))
> +                           %build-inputs)))
> +                 `("PERL5LIB" ":" =
> +                   ,(delete
> +                     ""
> +                     (map (match-lambda
> +                            (((? (cut string-prefix? "perl-" <>) name) . dir)
> +                             (string-append dir "/lib/perl5/site_perl"))
> +                            (_ ""))
> +                          %build-inputs)))))

I'm not too familiar with Perl, so can you explain why you need to tweak
PERL5LIB?
Is it the same as PATH but for perl-cpanel-json-xs, etc.?
If so, why are the perl plugins propagated-inputs and not just inputs?

> +             (invoke "gzip" "inxi.1")
> +             (install-file "inxi.1.gz"
> +                           (string-append %output "/share/doc/man/man1")))
> +           #t)))
> +      (home-page "https://smxi.org/docs/inxi.htm")
> +      (synopsis "Full featured system information script")
> +      (description "Inxi is a system information script that can display
> +various things about your hardware and software to users in an IRC chatroom or
> +support forum.  It runs with the /exec command in most IRC clients. ")

Spurious trailing space.

> +      (license license:gpl3+))))
> +
> +(define-public inxi
> +  (package
> +    (inherit inxi-minimal)
> +    (name "inxi")
> +    (inputs
> +     `(("dmidecode" ,dmidecode)
> +       ("file" ,file)
> +       ("bind:utils" ,isc-bind "utils") ; dig
> +       ("gzip" ,gzip)
> +       ("iproute2" ,iproute)            ; ip
> +       ("kmod" ,kmod)                   ; modinfo
> +       ("lm-sensors" ,lm-sensors)
> +       ("mesa-utils" ,mesa-utils)
> +       ("pciutils" ,pciutils)
> +       ("procps" ,procps)
> +       ("tar" ,tar)
> +       ("tree" ,tree)
> +       ("util-linux" ,util-linux)       ; lsblk, lsusb, etc.
> +       ("wmctrl" ,wmctrl)
> +       ("xdpyinfo" ,xdpyinfo)
> +       ("xprop" ,xprop)
> +       ("xrandr" ,xrandr)
> +       ("coreutils" ,coreutils)         ; uptime
> +       ;; TODO: Add more inputs:
> +       ;; ipmi-sensors
> +       ;; hddtemp
> +       ;; perl-xml-dumper
> +       ;; ipmitool
> +       ,@(package-inputs inxi-minimal)))
> +    (propagated-inputs
> +     `(("perl-cpanel-json-xs" ,perl-cpanel-json-xs)
> +       ("perl-http-tiny" ,perl-http-tiny)
> +       ("perl-io-socket-ssl" ,perl-io-socket-ssl)
> +       ("perl-json-xs" ,perl-json-xs)
> +       ("perl-time-hires" ,perl-time-hires)))))
> diff --git a/gnu/packages/patches/inxi-minimal-fix-syntax.patch b/gnu/packages/patches/inxi-minimal-fix-syntax.patch
> new file mode 100644
> index 000000000..ca5cde328
> --- /dev/null
> +++ b/gnu/packages/patches/inxi-minimal-fix-syntax.patch
> @@ -0,0 +1,18 @@
> +Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
> +
> +This patch fixes “Quantifier follows nothing in regex” error.
> +
> +--- a/inxi	2018-04-30 20:51:47.665352075 +0300
> ++++ b/inxi	2018-04-30 20:52:21.721804635 +0300
> +@@ -4602,11 +4602,6 @@
> + sub cleaner {
> + 	my ($item) = @_;
> + 	return $item if !$item;# handle cases where it was 0 or ''
> +-	$item =~ s/chipset|components|computing|computer|corporation|communications|electronics|electrical|electric|gmbh|group|incorporation|industrial|international|nee|revision|semiconductor|software|technologies|technology|ltd\.|<ltd>|\bltd\b|inc\.|<inc>|\binc\b|intl\.|co\.|<co>|corp\.|<corp>|\(tm\)|\(r\)|®|\(rev ..\)|\'|\"|\sinc\s*$|\?//gi;
> +-	$item =~ s/,|\*/ /g;
> +-	$item =~ s/\s\s+/ /g;
> +-	$item =~ s/^\s+|\s+$//g;
> +-	return $item;
> + }
> + 
> + sub dmi_cleaner {

I'm not sure I get the purpose of this patch.  Unless we are talking
about a different error, I had initially fixed it with

             (with-fluids ((%default-port-encoding #f))

so that the "®" in the above regexp would not get garbled during the
substitution.
Does your patch does something else / more?

-- 
Pierre Neidhardt

That's the true harbinger of spring, not crocuses or swallows
returning to Capistrano, but the sound of a bat on a ball.
		-- Bill Veeck
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Sun, 06 May 2018 13:32:01 GMT) Full text and rfc822 format available.

Message #45 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Pierre Neidhardt <pe.neidhardt <at> googlemail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 06 May 2018 16:31:08 +0300
[Message part 1 (text/plain, inline)]
Hello Pierre,

Pierre Neidhardt <pe.neidhardt <at> googlemail.com> writes:

> Oleg Pykhalov <go.wigust <at> gmail.com> writes:
>
>>>> If I understand correctly, relying on native-inputs would mean that if the user
>>>> runs `guix gc`, then all of inxi "optional" dependencies would go.
>>>> Is this correct?
>>
>> All “references” should survive ‘guix gc’:
>> --8<---------------cut here---------------start------------->8---
>> guix gc --references $(env GUIX_PACKAGE_PATH= guix build --no-grafts inxi)
>> --8<---------------cut here---------------end--------------->8---
>
> OK, so if I understand correctly, only native-inputs get
> garbage-collected, right?

Not quite, missing inputs (*not only* ‘(native-inputs …)’) in the output
of mentioned ‘guix gc’ command get garbage-collected.

Also a good test for missing run-time dependencies is a ‘guix
environment --no-grafts --container --ad-hoc PACKAGE’ command.

[…]

> See comments on patch below:
>
>> From 49afb43e03b1de34741c0812cc45fe48c06c404b Mon Sep 17 00:00:00 2001
>> From: Pierre Neidhardt <ambrevar <at> gmail.com>
>> Date: Mon, 16 Apr 2018 18:08:30 +0530
>> Subject: [PATCH] gnu: Add inxi.
>>
>> * gnu/packages/admin.scm (inxi): New variable.
>> ---
>>  gnu/packages/admin.scm                        | 115 +++++++++++++++++-
>>  .../patches/inxi-minimal-fix-syntax.patch     |  18 +++
>>  2 files changed, 132 insertions(+), 1 deletion(-)
>>  create mode 100644 gnu/packages/patches/inxi-minimal-fix-syntax.patch
>>
>> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
>> index 5e2cf2d7a..7081f7f08 100644
>> --- a/gnu/packages/admin.scm
>> +++ b/gnu/packages/admin.scm

[…]

>> +               (wrap-program (string-append bin "/inxi")
>> +                 `("PATH" ":" =
>> +                   ("$PATH"
>> +                    ,@(map (lambda (input)
>> +                             (string-append (match input
>> +                                              ((name . store) store))
>> +                                            "/bin"))
>> +                           %build-inputs)))
>> +                 `("PERL5LIB" ":" =
>> +                   ,(delete
>> +                     ""
>> +                     (map (match-lambda
>> +                            (((? (cut string-prefix? "perl-" <>) name) . dir)
>> +                             (string-append dir "/lib/perl5/site_perl"))
>> +                            (_ ""))
>> +                          %build-inputs)))))
>
> I'm not too familiar with Perl, so can you explain why you need to tweak
> PERL5LIB?
> Is it the same as PATH but for perl-cpanel-json-xs, etc.?

I cannot say PERL5LIB is the same as PATH, because PATH is for
executables, but I could lie PERL5LIB is the same in ‘inxi’ case.
Because of ‘inxi’ is Perl program, it requires to find run-time
libraries with a help of PERL5LIB.  As you could see ‘inxi --recommends’
will complain about missing Perl libraries without PERL5LIB.

> If so, why are the perl plugins propagated-inputs and not just inputs?

Good catch.  Yes, we could have Perl packages in ‘propagated-inputs’.

[…]

>> +      (description "Inxi is a system information script that can display
>> +various things about your hardware and software to users in an IRC chatroom or
>> +support forum.  It runs with the /exec command in most IRC clients. ")
>
> Spurious trailing space.

Oh, thanks.

Hm, ‘guix lint’ was quite.  Probably a possible place for improvements.

[…]

>> diff --git a/gnu/packages/patches/inxi-minimal-fix-syntax.patch
>> b/gnu/packages/patches/inxi-minimal-fix-syntax.patch
>> new file mode 100644
>> index 000000000..ca5cde328
>> --- /dev/null
>> +++ b/gnu/packages/patches/inxi-minimal-fix-syntax.patch
>> @@ -0,0 +1,18 @@
>> +Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
>> +
>> +This patch fixes “Quantifier follows nothing in regex” error.
>> +
>> +--- a/inxi	2018-04-30 20:51:47.665352075 +0300
>> ++++ b/inxi	2018-04-30 20:52:21.721804635 +0300
>> +@@ -4602,11 +4602,6 @@
>> + sub cleaner {
>> + 	my ($item) = @_;
>> + 	return $item if !$item;# handle cases where it was 0 or ''
>> +- $item =~
>> s/chipset|components|computing|computer|corporation|communications|electronics|electrical|electric|gmbh|group|incorporation|industrial|international|nee|revision|semiconductor|software|technologies|technology|ltd\.|<ltd>|\bltd\b|inc\.|<inc>|\binc\b|intl\.|co\.|<co>|corp\.|<corp>|\(tm\)|\(r\)|®|\(rev
>> ..\)|\'|\"|\sinc\s*$|\?//gi;
>> +-	$item =~ s/,|\*/ /g;
>> +-	$item =~ s/\s\s+/ /g;
>> +-	$item =~ s/^\s+|\s+$//g;
>> +-	return $item;
>> + }
>> + 
>> + sub dmi_cleaner {
>
> I'm not sure I get the purpose of this patch.  Unless we are talking
> about a different error, I had initially fixed it with
>
>              (with-fluids ((%default-port-encoding #f))
>
> so that the "®" in the above regexp would not get garbled during the
> substitution.

I believe I tried this ‘with-fluids’ tip, but not succeeded.

Well another attempt seems to work.  Thank you for noticed this.

> Does your patch does something else / more?

No, it doesn't.

Here is a new patch.
[0001-gnu-Add-inxi.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 07 May 2018 10:15:01 GMT) Full text and rfc822 format available.

Message #48 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Peter Neidhardt <pe.neidhardt <at> googlemail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 31178 <at> debbugs.gnu.org,
 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 07 May 2018 12:14:12 +0200
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

>> OK, so if I understand correctly, only native-inputs get
>> garbage-collected, right?
>
> Not quite, missing inputs (*not only* ‘(native-inputs …)’) in the output
> of mentioned ‘guix gc’ command get garbage-collected.

So what are the rules for garbage collection then?  I'm confused...
I don't see how _some_ inputs could get garbage collected and others not.


>> If so, why are the perl plugins propagated-inputs and not just inputs?
>
> Good catch.  Yes, we could have Perl packages in ‘propagated-inputs’.

You meant `inputs', right?

-- 
Peter Neidhardt

"Poor man... he was like an employee to me."
-- The police commissioner on "Sledge Hammer" laments the death of his
bodyguard
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 07 May 2018 15:30:02 GMT) Full text and rfc822 format available.

Message #51 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Peter Neidhardt <pe.neidhardt <at> googlemail.com>
Cc: 31178 <at> debbugs.gnu.org, 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 07 May 2018 18:29:47 +0300
[Message part 1 (text/plain, inline)]
Hello Peter,

I've removed Ludovic from a Cc because I think it doesn't seem a good
thing to disturb him with following questions.

Peter Neidhardt <pe.neidhardt <at> googlemail.com> writes:

> Oleg Pykhalov <go.wigust <at> gmail.com> writes:
>
>>> OK, so if I understand correctly, only native-inputs get
>>> garbage-collected, right?
>>
>> Not quite, missing inputs (*not only* ‘(native-inputs …)’) in the output
>> of mentioned ‘guix gc’ command get garbage-collected.
>
> So what are the rules for garbage collection then?  I'm confused...
> I don't see how _some_ inputs could get garbage collected and others not.

When ‘guix gc --references PATH’ shows a ‘/gnu/store/…-INPUT’,
then ‘/gnu/store/…-INPUT’ *will not* be garbage collected.

For example:
--8<---------------cut here---------------start------------->8---
$ guix gc --references $(env GUIX_PACKAGE_PATH= guix build --no-grafts inxi)
[…]
/gnu/store/…-file-5.32
[…]
/gnu/store/…-xrandr-1.5.0
/gnu/store/…-xprop-1.2.3
--8<---------------cut here---------------end--------------->8---
‘file’, ‘xrandr’ and ‘xprop’ packages *will not* be garbage collected.

>>> If so, why are the perl plugins propagated-inputs and not just inputs?
>>
>> Good catch.  Yes, we could have Perl packages in ‘propagated-inputs’.
>
> You meant `inputs', right?

Yes, apologies for a mistyping.

Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Mon, 07 May 2018 19:53:01 GMT) Full text and rfc822 format available.

Message #54 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Peter Neidhardt <pe.neidhardt <at> googlemail.com>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 31178 <at> debbugs.gnu.org, 31176 <at> debbugs.gnu.org
Subject: Re: [bug#31178] [PATCH] gnu: Add inxi.
Date: Mon, 07 May 2018 21:52:26 +0200
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

>> So what are the rules for garbage collection then?  I'm confused...
>> I don't see how _some_ inputs could get garbage collected and others not.
>
> When ‘guix gc --references PATH’ shows a ‘/gnu/store/…-INPUT’,
> then ‘/gnu/store/…-INPUT’ *will not* be garbage collected.
>
> For example:
> --8<---------------cut here---------------start------------->8---
> $ guix gc --references $(env GUIX_PACKAGE_PATH= guix build --no-grafts inxi)
> […]
> /gnu/store/…-file-5.32
> […]
> /gnu/store/…-xrandr-1.5.0
> /gnu/store/…-xprop-1.2.3
> --8<---------------cut here---------------end--------------->8---
> ‘file’, ‘xrandr’ and ‘xprop’ packages *will not* be garbage collected.

In understand that, my question was _why_ would some inputs get garbage
collected, and why not.  My question is on from a logical perspective in
terms of functional package management.


Other than that, the patch looks good to me, feel free to merge! :)

-- 
Peter Neidhardt
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31176; Package guix-patches. (Tue, 08 May 2018 18:12:01 GMT) Full text and rfc822 format available.

Message #57 received at 31176 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Peter Neidhardt <pe.neidhardt <at> googlemail.com>
Cc: 31178 <at> debbugs.gnu.org, 31176 <at> debbugs.gnu.org, 31178-done <at> debbugs.gnu.org
Subject: Re: [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
Date: Tue, 08 May 2018 21:11:09 +0300
[Message part 1 (text/plain, inline)]
Hello Peter,

Peter Neidhardt <pe.neidhardt <at> googlemail.com> writes:

[…]

> Other than that, the patch looks good to me, feel free to merge! :)

OK.  Let me know if ‘inxi’ behaves not as you expected.

Pushed as bbc94ed03a219c10740921f64eea2f630458f538

I'll close the bug report.

Oleg.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Jun 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.