diff mbox series

[bug#54069,v3,4/7] gnu: pciutils: Unbundle pci.ids and use latest.

Message ID 20220310093145.31649-5-mail@brendan.scot
State Accepted
Headers show
Series : Update and make use of hwdata | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Brendan Tildesley March 10, 2022, 9:31 a.m. UTC
* gnu/packages/pciutils.scm (pciutils):
[inputs]: Add hwdata:pci for latest pci.ids file.
[arguments]: Don't install update-pciids script or it's man page. Don't
install bundled old pci.ids file, use hwdata instead. Copy the pci.ids
over so it can be gzipped.
---
 gnu/packages/pciutils.scm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

Comments

Maxim Cournoyer March 23, 2022, 1:57 a.m. UTC | #1
Hi Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

> * gnu/packages/pciutils.scm (pciutils):
> [inputs]: Add hwdata:pci for latest pci.ids file.
> [arguments]: Don't install update-pciids script or it's man page. Don't
> install bundled old pci.ids file, use hwdata instead. Copy the pci.ids
> over so it can be gzipped.

The GNU changelog idea is to stick to changes in the commit message; if
explanations are needed they can go in the code as comments.
Alternatively, you can also put explanations as a paragraph between the
commit summary (first line) and the changelog.

> ---
>  gnu/packages/pciutils.scm | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
> index 41ba10f1e1..648d1385e4 100644
> --- a/gnu/packages/pciutils.scm
> +++ b/gnu/packages/pciutils.scm
> @@ -93,8 +93,13 @@ (define-public pciutils
>      (arguments
>       `(#:phases
>         (modify-phases %standard-phases
> +         (add-after 'unpack 'unbundle-pci.ids
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
                                     ^ not needed
                                     
> +             (copy-file (string-append (assoc-ref inputs "hwdata:pci")
> +                                       "/share/hwdata/pci.ids")
> +                        "pci.ids")))

I used search-input-file, making sure to use (or native-inputs inputs)
as its first argument, so that it works even when cross-compiling.

>           (replace 'configure
> -           (lambda* (#:key outputs #:allow-other-keys)
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
                              ^ not needed
                              
>               ;; There's no 'configure' script, just a raw makefile.
>               (substitute* "Makefile"
>                 ,@(if (%current-target-system)
> @@ -124,13 +129,19 @@ (define-public pciutils
>                 (("^SHARED=.*$")
>                  ;; Build libpciutils.so.
>                  "SHARED := yes\n")
> +
>                 (("^ZLIB=.*$")
>                  ;; Ask for zlib support, for 'pci.ids.gz' decompression.
>                  "ZLIB := yes\n")
>  
>                 (("^IDSDIR=.*$")
>                  ;; Installation directory of 'pci.ids.gz'.
> -                "IDSDIR = $(SHAREDIR)/hwdata\n"))))
> +                "IDSDIR = $(SHAREDIR)/hwdata\n")
> +               ;; Don't install update script or its man page,
> +               ((".*INSTALL.*update-pciids .*") "")
> +               (("update-pciids update-pciids.8 ") "")
> +               (("(.*INSTALL.*)(update-pciids.8)(.*)" _ a _ b)
> +                (string-append a b)))))
>           (replace 'install
>             (lambda* (#:key outputs #:allow-other-keys)
>               ;; Install the commands, library, and .pc files.
> @@ -159,7 +170,8 @@ (define-public pciutils
>         ,@(if (hurd-target?)
>               `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
>               '())
> -       ("zlib" ,zlib)))
> +       ("zlib" ,zlib)
> +       ("hwdata:pci" ,hwdata "pci")))

I moved hwdata to native-inputs,

And pushed as 387a9772c2571d4375d6c3682c7572d12e7ec5b2 to the
core-updates branch.

Thank you!

Maxim
diff mbox series

Patch

diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index 41ba10f1e1..648d1385e4 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -93,8 +93,13 @@  (define-public pciutils
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'unbundle-pci.ids
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (copy-file (string-append (assoc-ref inputs "hwdata:pci")
+                                       "/share/hwdata/pci.ids")
+                        "pci.ids")))
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              ;; There's no 'configure' script, just a raw makefile.
              (substitute* "Makefile"
                ,@(if (%current-target-system)
@@ -124,13 +129,19 @@  (define-public pciutils
                (("^SHARED=.*$")
                 ;; Build libpciutils.so.
                 "SHARED := yes\n")
+
                (("^ZLIB=.*$")
                 ;; Ask for zlib support, for 'pci.ids.gz' decompression.
                 "ZLIB := yes\n")
 
                (("^IDSDIR=.*$")
                 ;; Installation directory of 'pci.ids.gz'.
-                "IDSDIR = $(SHAREDIR)/hwdata\n"))))
+                "IDSDIR = $(SHAREDIR)/hwdata\n")
+               ;; Don't install update script or its man page,
+               ((".*INSTALL.*update-pciids .*") "")
+               (("update-pciids update-pciids.8 ") "")
+               (("(.*INSTALL.*)(update-pciids.8)(.*)" _ a _ b)
+                (string-append a b)))))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the commands, library, and .pc files.
@@ -159,7 +170,8 @@  (define-public pciutils
        ,@(if (hurd-target?)
              `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
              '())
-       ("zlib" ,zlib)))
+       ("zlib" ,zlib)
+       ("hwdata:pci" ,hwdata "pci")))
     (home-page "https://mj.ucw.cz/sw/pciutils/")
     (synopsis "Programs for inspecting and manipulating PCI devices")
     (description