guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#31176] [bug#31178] [PATCH] gnu: Add inxi.


From: Pierre Neidhardt
Subject: [bug#31176] [bug#31178] [PATCH] gnu: Add inxi.
Date: Sun, 06 May 2018 11:42:28 +0200
User-agent: mu4e 1.0; emacs 26.1

Oleg Pykhalov <address@hidden> 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 <address@hidden>
> 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 <address@hidden>
> +
> +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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]