Subject: [PATCH v3 4/7] gnu: pciutils: Unbundle pci.ids and use latest.

From: Brendan Tildesley <[email-masked]>
Date: Thu, 10 Mar 2022 20:31:42 +1100

* 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(-)

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
-- 
2.34.0