Subject: [bug#54069] [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 22 Mar 2022 21:57:45 -0400

Hi Brendan,

Brendan Tildesley <[email-masked]> 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