unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31178] [PATCH] gnu: Add inxi.
@ 2018-04-16 12:38 Pierre Neidhardt
  2018-04-22 21:42 ` [bug#31176] " Ludovic Courtès
  2018-04-30 13:17 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 18+ messages in thread
From: Pierre Neidhardt @ 2018-04-16 12:38 UTC (permalink / raw)
  To: 31178

* gnu/packages/admin.scm (inxi): New variable.
---
 gnu/packages/admin.scm               | 92 +++++++++++++++++++++++++++-
 gnu/packages/patches/inxi-path.patch | 13 ++++
 2 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/inxi-path.patch

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 6a7bed389..811e3d4cf 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -67,6 +67,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)
@@ -90,7 +91,10 @@
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages kerberos)
   #:use-module (gnu packages gtk)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages xml)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages file)
+  #:use-module (gnu packages web))
 
 (define-public aide
   (package
@@ -2505,3 +2509,89 @@ printed instead of after the entire file has been read, which is often too
 late.")
     (home-page "https://jwilk.net/software/hungrycat")
     (license license:expat)))
+
+(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"))))
+      (build-system trivial-build-system)
+      (inputs
+       `(("perl" ,perl)))
+      (native-inputs `(("tar" ,tar)
+                       ("gzip" ,gzip)))
+      (arguments
+       `(#:modules
+         ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils))
+           (setenv "PATH" (string-append
+                           (assoc-ref %build-inputs "tar") "/bin" ":"
+                           (assoc-ref %build-inputs "gzip") "/bin"))
+           (system* "tar" "xvf" (assoc-ref %build-inputs "source"))
+           (with-directory-excursion ,(string-append real-name "-" version)
+             (with-fluids ((%default-port-encoding #f))
+               (substitute* "inxi"
+                 (("/usr/bin/env perl")
+                  (string-append (assoc-ref %build-inputs "perl") "/bin/perl"))))
+             (install-file "inxi" (string-append %output "/bin"))
+             (system* "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 "Script to get system information")
+      (description
+       "This package provides a script to get system information.")
+      (license license:gpl3+))))
+
+(define-public inxi
+  ;; Use `inxi --recommends` for a check list of all the external programs
+  ;; it can use.
+  ;; TODO: Include additional inputs once their corresponding packages is no
+  ;; longer missing: hddtemp, dig (from dnsutils), perl-xml-dumper.  ipmitool
+  ;; and ipmi-sensors.
+  (package
+    (inherit inxi-minimal)
+    (name "inxi")
+    (propagated-inputs
+     `(("coreutils" ,coreutils)         ; uptime
+       ("curl" ,curl)                   ; only if dig is missing.
+       ("dmidecode" ,dmidecode)
+       ;; ("fdisk" ,fdisk)                 ; only as fallback, but not sure for what
+       ("file" ,file)
+       ("gzip" ,gzip)
+       ("iproute2" ,iproute)            ; ip
+       ("kmod" ,kmod)                   ; modinfo
+       ("lm-sensors" ,lm-sensors)
+       ("mesa-utils" ,mesa-utils)
+       ("pciutils" ,pciutils)
+       ("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)
+       ("procps" ,procps)
+       ("tar" ,tar)
+       ("tree" ,tree)
+       ("util-linux" ,util-linux)       ; lsblk, lsusb, etc.
+       ;; ("wget" ,wget)                   ; only if dig and curl are missing.
+       ("wmctrl" ,wmctrl)
+       ("xdpyinfo" ,xdpyinfo)
+       ("xprop" ,xprop)
+       ("xrandr" ,xrandr)))
+    (synopsis "Script to get system information")
+    (description
+     "This package provides a script to get system information.")
+    (license license:gpl3+)))
diff --git a/gnu/packages/patches/inxi-path.patch b/gnu/packages/patches/inxi-path.patch
new file mode 100644
index 000000000..3f0d846bd
--- /dev/null
+++ b/gnu/packages/patches/inxi-path.patch
@@ -0,0 +1,13 @@
+Use dynamic PATH.
+
+--- a/inxi
++++ b/inxi
+@@ -75,5 +75,5 @@ my ($b_sysctl_disk,$b_update,$b_weather) = (1,1,1);
+ ## System
+ my ($bsd_type,$language,$os) = ('','','');
+ my ($cpu_sleep,$dl_timeout,$limit,$ps_count,$usb_level) = (0.35,4,10,5,0);
+-my @paths = qw(/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /usr/X11R6/bin);
++my @paths = split /:/, $ENV{'PATH'};
+ my $sensors_cpu_nu = 0;
+
+ ## Tools
-- 
2.17.0

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-16 12:38 [bug#31178] [PATCH] gnu: Add inxi Pierre Neidhardt
@ 2018-04-22 21:42 ` Ludovic Courtès
  2018-04-23  4:33   ` Pierre Neidhardt
  2018-04-30 13:17 ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2018-04-22 21:42 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176

Hello Pierre & Oleg,

Pierre Neidhardt <ambrevar@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’.

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-22 21:42 ` [bug#31176] " Ludovic Courtès
@ 2018-04-23  4:33   ` Pierre Neidhardt
  2018-04-23  5:23     ` Oleg Pykhalov
  0 siblings, 1 reply; 18+ messages in thread
From: Pierre Neidhardt @ 2018-04-23  4:33 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31178, 31176

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


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-23  4:33   ` Pierre Neidhardt
@ 2018-04-23  5:23     ` Oleg Pykhalov
  2018-04-23  5:34       ` [bug#31176] " Pierre Neidhardt
  0 siblings, 1 reply; 18+ messages in thread
From: Oleg Pykhalov @ 2018-04-23  5:23 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176

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

Hello Pierre and Ludovic,

Pierre Neidhardt <ambrevar@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-23  5:23     ` Oleg Pykhalov
@ 2018-04-23  5:34       ` Pierre Neidhardt
  2018-04-28 21:27         ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: Pierre Neidhardt @ 2018-04-23  5:34 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 31178, 31176

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


Oleg Pykhalov <go.wigust@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-23  5:34       ` [bug#31176] " Pierre Neidhardt
@ 2018-04-28 21:27         ` Ludovic Courtès
  2018-04-29 17:38           ` Oleg Pykhalov
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2018-04-28 21:27 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176

Oleg, could you take care of this patch?  (See Pierre’s comments below.)

Pierre Neidhardt <ambrevar@gmail.com> skribis:

> Oleg Pykhalov <go.wigust@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?

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-28 21:27         ` Ludovic Courtès
@ 2018-04-29 17:38           ` Oleg Pykhalov
  2018-04-30 10:07             ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: Oleg Pykhalov @ 2018-04-29 17:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31178, 31176, Pierre Neidhardt

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

Hello,

ludo@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-29 17:38           ` Oleg Pykhalov
@ 2018-04-30 10:07             ` Ludovic Courtès
  2018-04-30 12:31               ` [bug#31176] " Pierre Neidhardt
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2018-04-30 10:07 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 31178, 31176, Pierre Neidhardt

Hi Oleg,

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

> ludo@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’.

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-30 10:07             ` Ludovic Courtès
@ 2018-04-30 12:31               ` Pierre Neidhardt
  2018-04-30 19:18                 ` Oleg Pykhalov
  0 siblings, 1 reply; 18+ messages in thread
From: Pierre Neidhardt @ 2018-04-30 12:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31178, 31176

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


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-16 12:38 [bug#31178] [PATCH] gnu: Add inxi Pierre Neidhardt
  2018-04-22 21:42 ` [bug#31176] " Ludovic Courtès
@ 2018-04-30 13:17 ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 18+ messages in thread
From: Tobias Geerinckx-Rice @ 2018-04-30 13:17 UTC (permalink / raw)
  To: Pierre Neidhardt, 31178

Pierre,

Thanks for your work so far! Discussions about inputs (bah, 
propagation's evil) and who'll write what aside:

On 2018-04-16 14:38, Pierre Neidhardt wrote:
> +  ;; TODO: Include additional inputs once their corresponding packages 
> is no
> +  ;; longer missing: hddtemp, dig (from dnsutils), perl-xml-dumper.  
> ipmitool
> +  ;; and ipmi-sensors.

The only canonical ‘dig’ that I know & love comes from the BIND project, 
as installed by ‘bind:utils’.
Does inxi explicitly require this ‘dnsutils’ version? Is it a fork? 
Patched? Separate implementation?

I think I have a ‘hddtemp’ package banging about somewhere.

> +       ("curl" ,curl)                   ; only if dig is missing.
> [...]
> +       ;; ("wget" ,wget)                   ; only if dig and curl are 
> missing.

Curl's closure is bigger than that of wget (~210 MiB vs. ~127 MiB), but 
it's probably smaller than wget+bind.
Would curl alone cover all uses of wget+bind in the script? (‘I can't be 
bothered to dig through it’ is an acceptable answer.)

Kind regards,

T G-R

Sent from a Web browser. Excuse or enjoy my brevity.

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-30 12:31               ` [bug#31176] " Pierre Neidhardt
@ 2018-04-30 19:18                 ` Oleg Pykhalov
  2018-05-01  7:27                   ` [bug#31178] [bug#31176] " Oleg Pykhalov
  2018-05-06  9:42                   ` Pierre Neidhardt
  0 siblings, 2 replies; 18+ messages in thread
From: Oleg Pykhalov @ 2018-04-30 19:18 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176


[-- Attachment #1.1: Type: text/plain, Size: 1205 bytes --]

Hello Pierre,

Pierre Neidhardt <ambrevar@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.


[-- Attachment #1.2: gnu: Add inxi. --]
[-- Type: text/x-patch, Size: 7300 bytes --]

From 49afb43e03b1de34741c0812cc45fe48c06c404b Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <ambrevar@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)))))
+             (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. ")
+      (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@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 {
-- 
2.17.0


[-- Attachment #1.3: Type: text/plain, Size: 284 bytes --]


[…]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31178] [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-30 19:18                 ` Oleg Pykhalov
@ 2018-05-01  7:27                   ` Oleg Pykhalov
  2018-05-06  9:42                   ` Pierre Neidhardt
  1 sibling, 0 replies; 18+ messages in thread
From: Oleg Pykhalov @ 2018-05-01  7:27 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176

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

Some notes to fix myself about the latest patch.

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

[…]

> From 49afb43e03b1de34741c0812cc45fe48c06c404b Mon Sep 17 00:00:00 2001
> From: Pierre Neidhardt <ambrevar@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-04-30 19:18                 ` Oleg Pykhalov
  2018-05-01  7:27                   ` [bug#31178] [bug#31176] " Oleg Pykhalov
@ 2018-05-06  9:42                   ` Pierre Neidhardt
  2018-05-06 13:31                     ` Oleg Pykhalov
  1 sibling, 1 reply; 18+ messages in thread
From: Pierre Neidhardt @ 2018-05-06  9:42 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 31178, 31176

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


Oleg Pykhalov <go.wigust@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@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@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-05-06  9:42                   ` Pierre Neidhardt
@ 2018-05-06 13:31                     ` Oleg Pykhalov
  2018-05-07 10:14                       ` Peter Neidhardt
  0 siblings, 1 reply; 18+ messages in thread
From: Oleg Pykhalov @ 2018-05-06 13:31 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 31178, 31176


[-- Attachment #1.1: Type: text/plain, Size: 5258 bytes --]

Hello Pierre,

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

> Oleg Pykhalov <go.wigust@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@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@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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gnu: Add inxi. --]
[-- Type: text/x-patch, Size: 6585 bytes --]

From e504bbc45e2fcd49bfe792bddd8d18faacb9e905 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <ambrevar@gmail.com>
Date: Mon, 16 Apr 2018 18:08:30 +0530
Subject: [PATCH] gnu: Add inxi.

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

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
---
 gnu/packages/admin.scm | 121 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 120 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 4a2fe145f..3d9ada84d 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
@@ -2652,3 +2657,117 @@ 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 ((real-name "inxi"))
+    (package
+      (name "inxi-minimal")
+      (version "3.0.04-1")
+      (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"))))
+      (build-system trivial-build-system)
+      (inputs
+       `(("bash" ,bash)
+         ("perl" ,perl)))
+      (native-inputs
+       `(("gzip" ,gzip)
+         ("tar" ,tar)))
+      (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" ":"))
+           (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
+           (with-directory-excursion ,(string-append real-name "-" version)
+             (with-fluids ((%default-port-encoding #f))
+               (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)
+                             (match input
+                               ((name . store)
+                                (let ((store-append
+                                       (cut string-append store <>)))
+                                  (cond
+                                   ((member name '("util-linux"))
+                                    (string-append (store-append "/bin") ":"
+                                                   (store-append "/sbin")))
+                                   ((member name '("dmidecode" "iproute2"))
+                                    (store-append "/sbin"))
+                                   (else (store-append "/bin")))))))
+                           %build-inputs)))
+                 `("PERL5LIB" ":" =
+                   ,(delete
+                     ""
+                     (map (match-lambda
+                            (((? (cut string-prefix? "perl-" <>) name) . dir)
+                             (string-append dir "/lib/perl5/site_perl"))
+                            (_ ""))
+                          %build-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.")
+      (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
+       ("usbutils" ,usbutils)           ; lsusb
+       ("wmctrl" ,wmctrl)
+       ("xdpyinfo" ,xdpyinfo)
+       ("xprop" ,xprop)
+       ("xrandr" ,xrandr)
+       ("coreutils" ,coreutils)         ; uptime
+       ("inetutils" ,inetutils)         ; ifconfig
+       ("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)
+       ;; TODO: Add more inputs:
+       ;; ipmi-sensors
+       ;; hddtemp
+       ;; perl-xml-dumper
+       ;; ipmitool
+       ,@(package-inputs inxi-minimal)))))
-- 
2.17.0


[-- Attachment #1.3: Type: text/plain, Size: 7 bytes --]


Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-05-06 13:31                     ` Oleg Pykhalov
@ 2018-05-07 10:14                       ` Peter Neidhardt
  2018-05-07 15:29                         ` Oleg Pykhalov
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Neidhardt @ 2018-05-07 10:14 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 31178, 31176

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


Oleg Pykhalov <go.wigust@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31178] [PATCH] gnu: Add inxi.
  2018-05-07 10:14                       ` Peter Neidhardt
@ 2018-05-07 15:29                         ` Oleg Pykhalov
  2018-05-07 19:52                           ` [bug#31176] " Peter Neidhardt
  0 siblings, 1 reply; 18+ messages in thread
From: Oleg Pykhalov @ 2018-05-07 15:29 UTC (permalink / raw)
  To: Peter Neidhardt; +Cc: 31178, 31176

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

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@googlemail.com> writes:

> Oleg Pykhalov <go.wigust@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-05-07 15:29                         ` Oleg Pykhalov
@ 2018-05-07 19:52                           ` Peter Neidhardt
  2018-05-08 18:11                             ` [bug#31178] " Oleg Pykhalov
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Neidhardt @ 2018-05-07 19:52 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 31178, 31176

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


Oleg Pykhalov <go.wigust@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* [bug#31178] [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
  2018-05-07 19:52                           ` [bug#31176] " Peter Neidhardt
@ 2018-05-08 18:11                             ` Oleg Pykhalov
  0 siblings, 0 replies; 18+ messages in thread
From: Oleg Pykhalov @ 2018-05-08 18:11 UTC (permalink / raw)
  To: Peter Neidhardt; +Cc: 31178, 31176, 31178-done

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

Hello Peter,

Peter Neidhardt <pe.neidhardt@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2018-05-08 18:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 12:38 [bug#31178] [PATCH] gnu: Add inxi Pierre Neidhardt
2018-04-22 21:42 ` [bug#31176] " Ludovic Courtès
2018-04-23  4:33   ` Pierre Neidhardt
2018-04-23  5:23     ` Oleg Pykhalov
2018-04-23  5:34       ` [bug#31176] " Pierre Neidhardt
2018-04-28 21:27         ` Ludovic Courtès
2018-04-29 17:38           ` Oleg Pykhalov
2018-04-30 10:07             ` Ludovic Courtès
2018-04-30 12:31               ` [bug#31176] " Pierre Neidhardt
2018-04-30 19:18                 ` Oleg Pykhalov
2018-05-01  7:27                   ` [bug#31178] [bug#31176] " Oleg Pykhalov
2018-05-06  9:42                   ` Pierre Neidhardt
2018-05-06 13:31                     ` Oleg Pykhalov
2018-05-07 10:14                       ` Peter Neidhardt
2018-05-07 15:29                         ` Oleg Pykhalov
2018-05-07 19:52                           ` [bug#31176] " Peter Neidhardt
2018-05-08 18:11                             ` [bug#31178] " Oleg Pykhalov
2018-04-30 13:17 ` Tobias Geerinckx-Rice

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