all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: Pierre Neidhardt <pe.neidhardt@googlemail.com>
Cc: 31178@debbugs.gnu.org, 31176@debbugs.gnu.org
Subject: [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 06 May 2018 16:31:08 +0300	[thread overview]
Message-ID: <87o9hs52sj.fsf@gmail.com> (raw)
In-Reply-To: <87vac1ce7v.fsf@gmail.com> (Pierre Neidhardt's message of "Sun, 06 May 2018 11:42:28 +0200")


[-- 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 --]

  reply	other threads:[~2018-05-06 13:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9hs52sj.fsf@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=31176@debbugs.gnu.org \
    --cc=31178@debbugs.gnu.org \
    --cc=pe.neidhardt@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

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