diff mbox series

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

Message ID 20220220095557.1497-2-mail@brendan.scot
State Accepted
Headers show
Series gnu: pciutils: Unbundle pci.ids and use latest. | 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 Feb. 20, 2022, 9:55 a.m. UTC
* gnu/packages/pciutils.scm (pciutils):
[inputs]: Remove zlib. Add hwdata. pci.ids was never gzip'd anyway.
[arguments]: Don't install update-pciids script or it's man page. Don't
install bundled old pci.ids file. Copy pci.ids file from latest hwdata package.
---
 gnu/packages/pciutils.scm | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

Comments

Maxim Cournoyer Feb. 21, 2022, 7:40 p.m. UTC | #1
Hi,

Brendan Tildesley <mail@brendan.scot> writes:

> * gnu/packages/pciutils.scm (pciutils):
> [inputs]: Remove zlib. Add hwdata. pci.ids was never gzip'd anyway.
> [arguments]: Don't install update-pciids script or it's man page. Don't
> install bundled old pci.ids file. Copy pci.ids file from latest hwdata package.
> ---
>  gnu/packages/pciutils.scm | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
> index 416328bda2..3975854f84 100644
> --- a/gnu/packages/pciutils.scm
> +++ b/gnu/packages/pciutils.scm
> @@ -110,17 +110,28 @@ (define-public pciutils
>                 (("^SHARED=.*$")
>                  ;; Build libpciutils.so.
>                  "SHARED := yes\n")
> -               (("^ZLIB=.*$")
> -                ;; Ask for zlib support, for 'pci.ids.gz' decompression.
> -                "ZLIB := yes\n")

It seems to me perhaps a more proper fix would be to have hwdata used as
an input, replacing the bundled copy of the pci.ids file file, and then
letting pciutils proceed as usual?  Disabling compression makes the
database about 4.3 times larger (1.2 MiB instead of 0.273 MiB).

I feel like applications parsing pci.ids themselves should probably rely
on the pciutils library API instead (libpci.so) to retrieve or filter
PCI identifiers without being concerned with the actual format of the
database.

What do others think?

Maxim
Brendan Tildesley Feb. 22, 2022, 8:40 a.m. UTC | #2
> On 02/21/2022 8:40 PM Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
> 
>  
> Hi,
> 
> Brendan Tildesley <mail@brendan.scot> writes:
...
> It seems to me perhaps a more proper fix would be to have hwdata used as
> an input, replacing the bundled copy of the pci.ids file file, and then
> letting pciutils proceed as usual?  Disabling compression makes the
> database about 4.3 times larger (1.2 MiB instead of 0.273 MiB).
> 

I mistakenly thought they were not gzip'd in the first place.
Should we have a separate output/package for each of the 3 files, and then 
embed their paths as needed?

> I feel like applications parsing pci.ids themselves should probably rely
> on the pciutils library API instead (libpci.so) to retrieve or filter
> PCI identifiers without being concerned with the actual format of the
> database.
> 

libosinfo also pulls in its own pci.ids. I searched nix and found there are
several more programs that refer to the files directly.

> What do others think?
> 
> Maxim
diff mbox series

Patch

diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index 416328bda2..3975854f84 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -110,17 +110,28 @@  (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, its man page, and empty man8 dir.
+               (("update-pciids update-pciids.8 ")
+                "")
+               ((".*update-pciids( |.8).*")
+                "")
+               (("[^ ]*/man8 ")
+                "")
+               ;; Down't install bundled pci.ids file.
+               ((".*INSTALL.*PCI_IDS.*")
+                ""))))
          (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              ;; Install the commands, library, and .pc files.
-             (invoke "make" "install" "install-lib")))
+             (invoke "make" "install" "install-lib")
+             ;; Install newer pci.ids file.
+             (copy-file
+              (string-append (assoc-ref inputs "hwdata") "/share/hwdata/pci.ids")
+              (string-append (assoc-ref outputs "out") "/share/hwdata/pci.ids"))))
 
          ,@(if (hurd-target?)
                '((add-after 'unpack 'apply-hurd-patch
@@ -145,7 +156,7 @@  (define-public pciutils
        ,@(if (hurd-target?)
              `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
              '())
-       ("zlib" ,zlib)))
+       ("hwdata" ,hwdata)))
     (home-page "https://mj.ucw.cz/sw/pciutils/")
     (synopsis "Programs for inspecting and manipulating PCI devices")
     (description