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

DoneSubmitted by Brendan Tildesley.
Details
5 participants
  • John Kehayias
  • Ludovic Courtès
  • Brendan Tildesley
  • Maxim Cournoyer
  • Maxime Devos
Owner
unassigned
Severity
normal
B
B
Brendan Tildesley wrote on 20 Feb 10:53 +0100
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
635599986.289572.1645350831631@office.mailbox.org
Completely untested but I needed pci.ids for something and discovered pciutils bundles an old version so I made this patch as something of a suggestion. Looks like it would be a core-updates change.
B
B
Brendan Tildesley wrote on 20 Feb 10:55 +0100
[PATCH 2/2] gnu: pciutils: Unbundle pci.ids and use latest.
(address . 54069@debbugs.gnu.org)
20220220095557.1497-2-mail@brendan.scot
* 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(-)

Toggle diff (50 lines)
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
-- 
2.34.0
B
B
Brendan Tildesley wrote on 20 Feb 10:55 +0100
[PATCH 1/2] gnu: Add hwdata.
(address . 54069@debbugs.gnu.org)
20220220095557.1497-1-mail@brendan.scot
* gnu/packages/pciutils.scm (hwdata): New variable.
---
gnu/packages/pciutils.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

Toggle diff (57 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index b6b1e3ad85..416328bda2 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,7 +26,9 @@ (define-module (gnu packages pciutils)
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages pkg-config)
@@ -33,6 +36,32 @@ (define-module (gnu packages pciutils)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages base))
 
+(define-public hwdata
+  (package
+    (name "hwdata")
+    (version "0.356")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/vcrhonek/hwdata")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("pci.ids" "share/hwdata/pci.ids")
+                        ("pnp.ids" "share/hwdata/pnp.ids")
+                        ("usb.ids" "share/hwdata/usb.ids"))))
+    (home-page "https://pci-ids.ucw.cz")
+    (synopsis "Hardware identification databases")
+    (description "Hardware databases pci.ids, pnp.ids, and usb.ids including
+all known ID's used in PCI devices: ID's of vendors, devices, subsystems and
+device classes.")
+    (license (list license:gpl2+
+                   license:expat)))) ;; XFree86 1.0
+;;
 (define-public pciutils
   (package
     (name "pciutils")
-- 
2.34.0
J
J
John Kehayias wrote on 21 Feb 17:19 +0100
Re: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)
oC8HwWQM_Kdxh3vWTLp1WQhetFLarEv1oyoDdJJKMClnQz_mGq87G8VNz-ZaF7TXnDsR44GtZ82djpdksUddHYMX0AVG__uUuSutcG8hGFU=@protonmail.com
Hi Brendan,

Toggle quote (2 lines)
> Completely untested but I needed pci.ids for something and discovered pciutils bundles an old version so I made this patch as something of a suggestion. Looks like it would be a core-updates change.

Thanks for this possibility, I've actually had to address something similar in https://issues.guix.gnu.org/53015where I made a pciutils variant for this purpose. The patch is unmerged currently though.

I think that would work short term for our packaging needs and, as you say, make this bigger change for core updates (or wherever it will best fit). I haven't reviewed this patch, but in this way I think any updates to hwdata will cause pciutils to rebuild, which has many dependents. I'm not sure what is best, maybe: have pciutils use a frozen version of the hwdata with the separate package being a standalone more up to date data?

By the way, I do see in pciutils that share/hwdata/pci.ids.gz though admittedly I never checked to see if that really is gziped. Packages that want a plain pci.ids did not like it though (maybe just from file name?).

Would be great to have others chime in on what the longer term fix would be, in the short term a pciutils variant and/or hwdata standalone package would be helpful.

John
M
M
Maxim Cournoyer wrote on 21 Feb 20:40 +0100
Re: bug#54069: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . Brendan Tildesley)(address . mail@brendan.scot)(address . 54069@debbugs.gnu.org)
87r17wnh3d.fsf_-_@gmail.com
Hi,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (20 lines)
> * 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
B
B
Brendan Tildesley wrote on 22 Feb 09:40 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 54069@debbugs.gnu.org)
1283228187.20109.1645519225656@office.mailbox.org
Toggle quote (6 lines)
> On 02/21/2022 8:40 PM Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>
> Hi,
>
> Brendan Tildesley <mail@brendan.scot> writes:
...
Toggle quote (6 lines)
> 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?

Toggle quote (6 lines)
> 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.

Toggle quote (3 lines)
> What do others think?
>
> Maxim
J
J
John Kehayias wrote on 22 Feb 20:34 +0100
Re: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
8uXKUPs7X8nEsyxB7xZHJMEG1553-m9uZKlIht98yyMaoaKhVeQs5dJCWKtsvvLdUKVYFVay6GYodkE9WmKxlG7Es9_fRhdS0aOwdqJIOVs=@protonmail.com
Hi Brendan and Maxim,

I'm aware of a couple of programs that want to use the plain pci.ids. True, they could use pciutils for that, but pci.ids is very simple, just a list of hardware ids paired with manufacturer/device names. While we can see if upstream for these programs will move to using pciutils, I could see reasons for not wanting the dependency or wanting more current info (especially in Guix where we would only update pciutils on core-updates).

So I would find the separate hwdata package useful for a few packages I have, like mangohud (pending review) and corectrl (not submitted yet). I have to check, but they might only want pci.ids and not anything in pciutils anyway. Also, hwdata provides more data than just pci.ids, which we don't have packaged for Guix as far as I know.

As for pciutils itself, I don't have any strong feelings on its pci.ids. Unbundling the included (old) info and using a hwdata package as input makes sense to me and is more flexible. On core-updates we can make that change for pciutils, where at some point we'd want to freeze what hwdata version it uses. Meanwhile, hwdata can be updated regularly (looks like monthly releases) for up-to-date data.

I think this would keep pciutils small (zipped pci.ids), unbundled/more up to date, and give us the hwdata as a useful package to use.

WDYT?
M
M
Maxim Cournoyer wrote on 22 Feb 22:00 +0100
(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)
875yp6obvw.fsf@gmail.com
Hi John,

John Kehayias <john.kehayias@protonmail.com> writes:

Toggle quote (27 lines)
> Hi Brendan and Maxim,
>
> I'm aware of a couple of programs that want to use the plain
> pci.ids. True, they could use pciutils for that, but pci.ids is very
> simple, just a list of hardware ids paired with manufacturer/device
> names. While we can see if upstream for these programs will move to
> using pciutils, I could see reasons for not wanting the dependency or
> wanting more current info (especially in Guix where we would only
> update pciutils on core-updates).
>
> So I would find the separate hwdata package useful for a few packages
> I have, like mangohud (pending review) and corectrl (not submitted
> yet). I have to check, but they might only want pci.ids and not
> anything in pciutils anyway. Also, hwdata provides more data than just
> pci.ids, which we don't have packaged for Guix as far as I know.
>
> As for pciutils itself, I don't have any strong feelings on its
> pci.ids. Unbundling the included (old) info and using a hwdata package
> as input makes sense to me and is more flexible. On core-updates we
> can make that change for pciutils, where at some point we'd want to
> freeze what hwdata version it uses. Meanwhile, hwdata can be updated
> regularly (looks like monthly releases) for up-to-date data.
>
> I think this would keep pciutils small (zipped pci.ids),
> unbundled/more up to date, and give us the hwdata as a useful package
> to use.

I think your proposition makes a lot of sense; the handful of
applications wanting raw pci.ids can have it via hwdata, while our
pciutils package can take (a frozen/fixed variant of hwdata) as an input
to a get a newer yet compressed pci.ids.gz file.

Seems a win/win solution to me!

Thank you,

Maxim
J
J
John Kehayias wrote on 22 Feb 22:22 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)
rw4gXcOT7xn5PzE0ZLYUM22DuO8cgCLuSbQpfGQeJwCNheVjOLGtno72s5ahtud1IbL9a7tBCDNUyAL8uqEyRev4J67jyE0qr808Uz07EzI=@protonmail.com
Hi Maxim,

------- Original Message -------

On Tuesday, February 22nd, 2022 at 4:00 PM, Maxim Cournoyer wrote:

Toggle quote (8 lines)
> I think your proposition makes a lot of sense; the handful of
> applications wanting raw pci.ids can have it via hwdata, while our
> pciutils package can take (a frozen/fixed variant of hwdata) as an input
> to a get a newer yet compressed pci.ids.gz file.
>
> Seems a win/win solution to me!
>

Great! Brendan do you want to update your patches if you agree with this approach? I will test hwdata later for my mangohud patch, but since it is a simple copy install, I don't anticipate any problems.

Oh, and if I understand correctly, keeping pciutils with a pci.ids.gz would avoid a profile collision with hwdata's pci.ids (so you can have both pciutils and the extra data of hwdata), right? Which would also be good.

Thanks everyone,
John
M
M
Maxim Cournoyer wrote on 23 Feb 02:08 +0100
(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)
87tucqmltk.fsf@gmail.com
Hi,

John Kehayias <john.kehayias@protonmail.com> writes:

Toggle quote (23 lines)
> Hi Maxim,
>
> ------- Original Message -------
>
> On Tuesday, February 22nd, 2022 at 4:00 PM, Maxim Cournoyer wrote:
>
>> I think your proposition makes a lot of sense; the handful of
>> applications wanting raw pci.ids can have it via hwdata, while our
>> pciutils package can take (a frozen/fixed variant of hwdata) as an input
>> to a get a newer yet compressed pci.ids.gz file.
>>
>> Seems a win/win solution to me!
>>
>
> Great! Brendan do you want to update your patches if you agree with
> this approach? I will test hwdata later for my mangohud patch, but
> since it is a simple copy install, I don't anticipate any problems.
>
> Oh, and if I understand correctly, keeping pciutils with a pci.ids.gz
> would avoid a profile collision with hwdata's pci.ids (so you can have
> both pciutils and the extra data of hwdata), right? Which would also
> be good.

Indeed, I hadn't thought about this but it seems a nice property.

Maxim
J
J
John Kehayias wrote on 23 Feb 07:16 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . 54069@debbugs.gnu.org)(address . 54069@debbugs.gnu.org)
KojODF97h1XBGDCMJaQHg4ukfeIoVs5tXMho16yFMuZM6Hkj3iI2vuM8hmvhKbUn97WWI6nWEd41R3PSR91vBZ0YEhwrB0ueheJE-XwWwj0=@protonmail.com
I can report that the hwdata package installs for me, and a pending package (mangohud) that wanted the pci.ids file is happy with just hwdata; pciutils is no longer needed.

I did not do a review of the package definition other than this testing, but it worked and was useful for me.
M
M
Maxim Cournoyer wrote on 24 Feb 04:32 +0100
Re: bug#54069: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . Brendan Tildesley)(address . mail@brendan.scot)(address . 54069@debbugs.gnu.org)
87tucpkkhf.fsf_-_@gmail.com
Hello,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (50 lines)
> * gnu/packages/pciutils.scm (hwdata): New variable.
> ---
> gnu/packages/pciutils.scm | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
> index b6b1e3ad85..416328bda2 100644
> --- a/gnu/packages/pciutils.scm
> +++ b/gnu/packages/pciutils.scm
> @@ -4,6 +4,7 @@
> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
> +;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -25,7 +26,9 @@ (define-module (gnu packages pciutils)
> #:use-module (guix download)
> #:use-module ((guix licenses) #:prefix license:)
> #:use-module (guix utils)
> + #:use-module (guix git-download)
> #:use-module (guix build-system gnu)
> + #:use-module (guix build-system copy)
> #:use-module (gnu packages)
> #:use-module (gnu packages compression)
> #:use-module (gnu packages pkg-config)
> @@ -33,6 +36,32 @@ (define-module (gnu packages pciutils)
> #:use-module (gnu packages linux)
> #:use-module (gnu packages base))
>
> +(define-public hwdata
> + (package
> + (name "hwdata")
> + (version "0.356")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/vcrhonek/hwdata")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
> + (build-system copy-build-system)
> + (arguments
> + `(#:install-plan '(("pci.ids" "share/hwdata/pci.ids")
> + ("pnp.ids" "share/hwdata/pnp.ids")
> + ("usb.ids" "share/hwdata/usb.ids"))))

A Makefile is provided and has an install target; we should use it. It
installs the following files:

Toggle snippet (4 lines)
IDFILES = pci.ids usb.ids oui.txt iab.txt pnp.ids


Toggle quote (2 lines)
> + (home-page "https://pci-ids.ucw.cz")

The home page should rather be "https://github.com/vcrhonek/hwdata";
this project aggregates various databases that are sourced not only from
the pciutils project (see:

Toggle quote (5 lines)
> + (synopsis "Hardware identification databases")
> + (description "Hardware databases pci.ids, pnp.ids, and usb.ids including
> +all known ID's used in PCI devices: ID's of vendors, devices, subsystems and
> +device classes.")

I'd take the summary and description from Fedora, which reads better to
me [0]:

synopsis: "Hardware identification and configuration data"
description: "@code{hwdata} contains various hardware identification and
configuration data, such as the @file{pci.ids} and @file{usb.ids}
databases."


Toggle quote (4 lines)
> + (license (list license:gpl2+
> + license:expat)))) ;; XFree86 1.0
> +;;

Nit-pick: inline comments should be ";some comment" (typically no
capitalization although XFree86 is OK and no space between the single
semicolon and first comment word).

Also some trailing ';;' was added by mistake.

Could you make the changes along those lines and resend a v2 for the
first patch?

Thanks,

Maxim
B
B
Brendan Tildesley wrote on 25 Feb 05:44 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 54069@debbugs.gnu.org)
1186105933.49973.1645764264219@office.mailbox.org
Toggle quote (10 lines)
> On 02/24/2022 4:32 AM Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
> ...
>
> A Makefile is provided and has an install target; we should use it. It
> installs the following files:
>
> --8<---------------cut here---------------start------------->8---
> IDFILES = pci.ids usb.ids oui.txt iab.txt pnp.ids
> --8<---------------cut here---------------end--------------->8---
>
Note that it doesn't gzip them, and oui.txt is 8.4MB. Dependencies only tend
to need one or two of these files, lke usb.ids or pci.ids. Also the hwdata project
only updates these every couple months. We could define a package for each individual
file, then if for some reason all are needed in a directory, a "hwdata" union package
could be created.
Also, this hwdata project is not fully up to date either but have 1-2 month old versions.
It also installs dist-blacklist.conf. Do we need that?
B
B
Brendan Tildesley wrote on 26 Feb 05:32 +0100
[PATCH v2 1/4] gnu: Add hwdata.
(address . 54069@debbugs.gnu.org)
20220226043238.2657-1-mail@brendan.scot
* gnu/packages/pciutils.scm (hwdata): New variable.
---
gnu/packages/pciutils.scm | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

Toggle diff (73 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index b6b1e3ad85..f16f420ec2 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages pciutils)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages pkg-config)
@@ -33,6 +37,43 @@ (define-module (gnu packages pciutils)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages base))
 
+(define-public hwdata
+  (package
+    (name "hwdata")
+    (version "0.356")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/vcrhonek/hwdata")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
+    (build-system gnu-build-system)
+    (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
+    (native-inputs (list gzip))
+    (arguments
+     ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
+     (list
+      #:tests? #f
+      #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            (lambda _
+              (install-file "iab.txt" (string-append #$output:iab "/share/hwdata"))
+              (install-file "oui.txt" (string-append #$output:oui "/share/hwdata"))
+              (install-file "pci.ids" (string-append #$output:pci "/share/hwdata"))
+              (install-file "pnp.ids" (string-append #$output:pnp "/share/hwdata"))
+              (install-file "usb.ids" (string-append #$output:usb "/share/hwdata")))))))
+    (home-page "https://github.com/vcrhonek/hwdata")
+    (synopsis "Hardware identification and configuration data")
+    (description "@code{hwdata} contains various hardware identification and
+ configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.")
+    (license (list license:gpl2+
+                   license:expat)))) ;XFree86 1.0
+
 (define-public pciutils
   (package
     (name "pciutils")
-- 
2.34.0
B
B
Brendan Tildesley wrote on 26 Feb 05:32 +0100
[PATCH v2 2/4] gnu: pciutils: Unbundle pci.ids and use latest.
(address . 54069@debbugs.gnu.org)
20220226043238.2657-2-mail@brendan.scot
* gnu/packages/pciutils.scm (pciutils):
[inputs]: Add hwdata:pci for latest pci.ids file. Remove zlib since the ids
files aren't gzipped.
[arguments]: Don't install update-pciids script or it's man page. Don't
install bundled old pci.ids file, use hwdata instead.
---
gnu/packages/pciutils.scm | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index f16f420ec2..f7969e0c4d 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -92,7 +92,7 @@ (define-public pciutils
      `(#:phases
        (modify-phases %standard-phases
          (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)
@@ -122,13 +122,16 @@ (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"))))
+                (string-append "IDSDIR = " (assoc-ref inputs "hwdata:pci") "share/hwdata\n"))
+               ;; Don't install update script, its man page, or old bundled pci.ids file.
+               ((".*INSTALL.*update-pciids .*") "")
+               (("update-pciids update-pciids.8 ") "")
+               (("(.*INSTALL.*)(update-pciids.8)(.*)" _ a _ b)
+                (string-append a b))
+               ((".*INSTALL.*PCI_IDS.*") ""))))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the commands, library, and .pc files.
@@ -157,7 +160,7 @@ (define-public pciutils
        ,@(if (hurd-target?)
              `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
              '())
-       ("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
B
B
Brendan Tildesley wrote on 26 Feb 05:32 +0100
[PATCH v2 3/4] gnu: libosinfo: Unbundle usb.ids, pci.ids.
(address . 54069@debbugs.gnu.org)
20220226043238.2657-3-mail@brendan.scot
* gnu/packages/virtualization.scm (libosinfo):
[arguments]: Use Gexp style. Use hwdata package for latest usb.ids and
pci.ids.
[inputs]: Add hwdata:pci, hwdata:usb. remove pci.ids, usb.ids origins.
Use new input style.
---
gnu/packages/virtualization.scm | 64 ++++++++++++++-------------------
1 file changed, 26 insertions(+), 38 deletions(-)

Toggle diff (93 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 506ebe4bc2..c890b43a3e 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -98,6 +99,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages polkit)
@@ -1027,46 +1029,32 @@ (define-public libosinfo
          "0nd360c9ampw8hb6xh5g45q858df2r4jj9q88bcl6gzgaj0l3wxl"))))
     (build-system meson-build-system)
     (arguments
-     `(#:configure-flags
-       (list (string-append "-Dwith-usb-ids-path="
-                            (assoc-ref %build-inputs "usb.ids"))
-             (string-append "-Dwith-pci-ids-path="
-                            (assoc-ref %build-inputs "pci.ids")))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-osinfo-path
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "osinfo/osinfo_loader.c"
-               (("path = DATA_DIR.*")
-                (string-append "path = \"" (assoc-ref inputs "osinfo-db")
-                               "/share/osinfo\";"))))))))
+     (list
+      #:configure-flags
+      #~(list
+         (string-append "-Dwith-usb-ids-path=" #$hwdata:usb "/share/hwdata/usb.ids")
+         (string-append "-Dwith-pci-ids-path=" #$hwdata:pci "/share/hwdata/pci.ids"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-osinfo-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "osinfo/osinfo_loader.c"
+                (("path = DATA_DIR.*")
+                 (string-append "path = \"" #$osinfo-db "/share/osinfo\";"))))))))
     (inputs
-     `(("libsoup" ,libsoup-minimal-2)
-       ("libxml2" ,libxml2)
-       ("libxslt" ,libxslt)
-       ("osinfo-db" ,osinfo-db)))
+     (list libsoup-minimal-2
+           libxml2
+           libxslt
+           osinfo-db))
     (native-inputs
-     `(("glib" ,glib "bin")  ; glib-mkenums, etc.
-       ("gobject-introspection" ,gobject-introspection)
-       ("gtk-doc" ,gtk-doc/stable)
-       ("vala" ,vala)
-       ("intltool" ,intltool)
-       ("pkg-config" ,pkg-config)
-       ("pci.ids"
-        ,(origin
-           (method url-fetch)
-           (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
-           (sha256
-            (base32
-             "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
-       ("usb.ids"
-        ,(origin
-           (method url-fetch)
-           (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
-           (file-name "usb.ids")
-           (sha256
-            (base32
-             "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
+     (list `(,glib "bin")  ; glib-mkenums, etc.
+           gobject-introspection
+           gtk-doc/stable
+           vala
+           intltool
+           pkg-config
+           `(,hwdata "pci")
+           `(,hwdata "usb")))
     (home-page "https://libosinfo.org/")
     (synopsis "Operating system information database")
     (description "libosinfo is a GObject based library API for managing
-- 
2.34.0
B
B
Brendan Tildesley wrote on 26 Feb 05:32 +0100
[PATCH v2 4/4] gnu: libpciaccess: Use hwdata for pci.ids.
(address . 54069@debbugs.gnu.org)
20220226043238.2657-4-mail@brendan.scot
* gnu/packages/xorg.scm (libpciaccess):
[arguments]: Remove zlib support since pci.ids isn't gzipped. Use Gexp.
[inputs]: Add hwdata:pci, remove zlib, pciutils.
[native-inputs]: Remove pkg-config since zlib isn't used.
---
gnu/packages/xorg.scm | 31 ++++++-------------------------
1 file changed, 6 insertions(+), 25 deletions(-)

Toggle diff (56 lines)
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 14e35d19ae..99ef114e9c 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
 ;;; Copyright © 2021 Lu Hui <luhux76@gmail.com>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1150,36 +1151,16 @@ (define-public libpciaccess
         (method url-fetch)
         (uri (string-append
                "mirror://xorg/individual/lib/libpciaccess-"
-               version
-               ".tar.bz2"))
+               version ".tar.bz2"))
         (sha256
           (base32
             "12glp4w1kgvmqn89lk19cgr6jccd3awxra4dxisp7pagi06rsk11"))))
     (build-system gnu-build-system)
     (arguments
-     '(;; Make sure libpciaccess can read compressed 'pci.ids' files as
-       ;; provided by pciutils.
-       #:configure-flags
-       (list "--with-zlib"
-             (string-append "--with-pciids-path="
-                            (assoc-ref %build-inputs "pciutils")
-                            "/share/hwdata"))
-
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'add-L-zlib
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Provide '-LZLIB/lib' next to '-lz' in the .la file.
-             (let ((zlib (assoc-ref inputs "zlib"))
-                   (out  (assoc-ref outputs "out")))
-               (substitute* (string-append out "/lib/libpciaccess.la")
-                 (("-lz")
-                  (string-append "-L" zlib "/lib -lz")))
-               #t))))))
-    (inputs
-     (list zlib pciutils))                   ;for 'pci.ids.gz'
-    (native-inputs
-       (list pkg-config))
+     (list
+      #:configure-flags
+      #~(list (string-append "--with-pciids-path=" #$hwdata:pci "/share/hwdata"))))
+    (inputs (list `(,hwdata "pci")))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg PCI access library")
     (description "Xorg Generic PCI access library.")
-- 
2.34.0
M
M
Maxim Cournoyer wrote on 26 Feb 06:00 +0100
Re: bug#54069: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . Brendan Tildesley)(address . mail@brendan.scot)(address . 54069@debbugs.gnu.org)
878rtyxlva.fsf@gmail.com
Hi Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (16 lines)
>> On 02/24/2022 4:32 AM Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>> ...
>>
>> A Makefile is provided and has an install target; we should use it. It
>> installs the following files:
>>
>> --8<---------------cut here---------------start------------->8---
>> IDFILES = pci.ids usb.ids oui.txt iab.txt pnp.ids
>> --8<---------------cut here---------------end--------------->8---
>>
> Note that it doesn't gzip them, and oui.txt is 8.4MB. Dependencies only tend
> to need one or two of these files, lke usb.ids or pci.ids. Also the hwdata project
> only updates these every couple months. We could define a package for each individual
> file, then if for some reason all are needed in a directory, a "hwdata" union package
> could be created.

Unless there's a good reason to split the package (which could be
multiple outputs instead of multiple packages), I'd leave it the way
upstream intended it; and there's no better place for inspiration than
[0] for that, as the Fedora package maintainer happens to also be the
maintainer of hwdata :-).


*If* we want to have our pciutils package use the hwdata pci.ids, we can
avoid depending on the bigger 'hwdata' package by copying hwdata's
pci.ids over its own, and then build as usual.

Does that make sense?

Thank you for looking into it!

Maxim
M
M
Maxime Devos wrote on 26 Feb 12:21 +0100
Re: [bug#54069] [PATCH v2 3/4] gnu: libosinfo: Unbundle usb.ids, pci.ids.
e9a32718adfd8feb2e9804b73c50953981cbaec0.camel@telenet.be
Brendan Tildesley schreef op za 26-02-2022 om 15:32 [+1100]:
Toggle quote (3 lines)
> +         (string-append "-Dwith-usb-ids-path=" #$hwdata:usb "/share/hwdata/usb.ids")
> +         (string-append "-Dwith-pci-ids-path=" #$hwdata:pci "/share/hwdata/pci.ids"))

To allow for package transformations, I recommend using
this-package-input or the like instead of hardcoding a particular
package:

#~(list
(string-append
"-Dwith-usb-ids-path="
#$(this-package-input "hwdata:usb") "/share/hwdata/usb.ids"))
[...])

it might also be possible to use 'search-input-file' instead, avoiding
input labels (untested):

#~(let* ((inputs #$(input-tuples->gexp (package-inputs this-package)))
(usb.ids (search-input-file inputs "/share/hwdata/usb.ids"))
(pci.ids (search-input-file inputs "/share/hwdata/pci.ids")))
(list (string-append "-Dwith-usb-ids-path=" usb.ids) [...]))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhoNHRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pLdAQCkZNcgN3MvSO3qBNGNectyRuvN
Wxy6xg7ds+JW9LMn0gEAuYlqPn4sb5ZgBxaLiuRWU8lR3VOSzy705Dm9bEj/Iw8=
=+HFP
-----END PGP SIGNATURE-----


M
M
Maxim Cournoyer wrote on 26 Feb 15:19 +0100
Re: [PATCH v2 2/4] gnu: pciutils: Unbundle pci.ids and use latest.
(name . Brendan Tildesley)(address . mail@brendan.scot)
874k4lww0f.fsf@gmail.com
Hi Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (53 lines)
> * gnu/packages/pciutils.scm (pciutils):
> [inputs]: Add hwdata:pci for latest pci.ids file. Remove zlib since the ids
> files aren't gzipped.
> [arguments]: Don't install update-pciids script or it's man page. Don't
> install bundled old pci.ids file, use hwdata instead.
> ---
> gnu/packages/pciutils.scm | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
> index f16f420ec2..f7969e0c4d 100644
> --- a/gnu/packages/pciutils.scm
> +++ b/gnu/packages/pciutils.scm
> @@ -92,7 +92,7 @@ (define-public pciutils
> `(#:phases
> (modify-phases %standard-phases
> (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)
> @@ -122,13 +122,16 @@ (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"))))
> + (string-append "IDSDIR = " (assoc-ref inputs "hwdata:pci") "share/hwdata\n"))
> + ;; Don't install update script, its man page, or old bundled pci.ids file.
> + ((".*INSTALL.*update-pciids .*") "")
> + (("update-pciids update-pciids.8 ") "")
> + (("(.*INSTALL.*)(update-pciids.8)(.*)" _ a _ b)
> + (string-append a b))
> + ((".*INSTALL.*PCI_IDS.*") ""))))
> (replace 'install
> (lambda* (#:key outputs #:allow-other-keys)
> ;; Install the commands, library, and .pc files.
> @@ -157,7 +160,7 @@ (define-public pciutils
> ,@(if (hurd-target?)
> `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
> '())
> - ("zlib" ,zlib)))
> + ("hwdata:pci" ,hwdata "pci")))
> (home-page "https://mj.ucw.cz/sw/pciutils/")
> (synopsis "Programs for inspecting and manipulating PCI devices")
> (description

Thank you for refreshing this series. It's starting to look good!

For pciutils though, what I had in mind was more like this:

1. copy hwdata's pci.ids *over* pciutils one after unpack. This means
hwdata can be a simple native-input and no run time reference gets
registered.

2. This would leave the rest of the build unaltered, so that our
pciutils package could still be smaller thanks to the gzip'd pci.ids.gz
(generated at build time from the version copied from hwdawa).

Does this makes sense?

Thanks again,

Maxim
M
M
Maxim Cournoyer wrote on 27 Feb 00:14 +0100
Re: [PATCH v2 1/4] gnu: Add hwdata.
(name . Brendan Tildesley)(address . mail@brendan.scot)
87zgmduso6.fsf@gmail.com
Hello Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (30 lines)
> * gnu/packages/pciutils.scm (hwdata): New variable.
> ---
> gnu/packages/pciutils.scm | 41 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
> index b6b1e3ad85..f16f420ec2 100644
> --- a/gnu/packages/pciutils.scm
> +++ b/gnu/packages/pciutils.scm
> @@ -4,6 +4,7 @@
> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
> +;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -21,11 +22,14 @@
> ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
>
> (define-module (gnu packages pciutils)
> + #:use-module (guix gexp)
> #:use-module (guix packages)
> #:use-module (guix download)
> #:use-module ((guix licenses) #:prefix license:)
> #:use-module (guix utils)
> + #:use-module (guix git-download)
> #:use-module (guix build-system gnu)
> + #:use-module (guix build-system trivial)

I've removed the above extraneous import,

Toggle quote (43 lines)
> #:use-module (gnu packages)
> #:use-module (gnu packages compression)
> #:use-module (gnu packages pkg-config)
> @@ -33,6 +37,43 @@ (define-module (gnu packages pciutils)
> #:use-module (gnu packages linux)
> #:use-module (gnu packages base))
>
> +(define-public hwdata
> + (package
> + (name "hwdata")
> + (version "0.356")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/vcrhonek/hwdata")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
> + (build-system gnu-build-system)
> + (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
> + (native-inputs (list gzip))
> + (arguments
> + ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
> + (list
> + #:tests? #f
> + #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
> + #:phases
> + #~(modify-phases %standard-phases
> + (replace 'install
> + (lambda _
> + (install-file "iab.txt" (string-append #$output:iab "/share/hwdata"))
> + (install-file "oui.txt" (string-append #$output:oui "/share/hwdata"))
> + (install-file "pci.ids" (string-append #$output:pci "/share/hwdata"))
> + (install-file "pnp.ids" (string-append #$output:pnp "/share/hwdata"))
> + (install-file "usb.ids" (string-append #$output:usb "/share/hwdata")))))))
> + (home-page "https://github.com/vcrhonek/hwdata")
> + (synopsis "Hardware identification and configuration data")
> + (description "@code{hwdata} contains various hardware identification and
> + configuration data, such as the @file{pci.ids} and @file{usb.ids}
> databases.")

expound the description a bit to provide guidance about output
usage, e.g.:

Toggle snippet (13 lines)
@@ -69,7 +69,10 @@ (define-public hwdata
(home-page "https://github.com/vcrhonek/hwdata")
(synopsis "Hardware identification and configuration data")
(description "@code{hwdata} contains various hardware identification and
- configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.")
+configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.
+Each database is contained in a specific package output, such as the
+@code{pci} output for @file{pci.ids}, the @code{usb} output for
+@file{usb.ids}, etc.")
(license (list license:gpl2+
license:expat)))) ;XFree86 1.0

and pushed this first commit as 7f8bc02fd8.

Thanks!

Maxim
B
B
Brendan Tildesley wrote on 27 Feb 02:37 +0100
Re: [bug#54069] [PATCH v2 3/4] gnu: libosinfo: Unbundle usb.ids, pci.ids.
190017101.145924.1645925822107@office.mailbox.org
Toggle quote (25 lines)
> On 02/26/2022 12:21 PM Maxime Devos <maximedevos@telenet.be> wrote:
>
>
> Brendan Tildesley schreef op za 26-02-2022 om 15:32 [+1100]:
> > +         (string-append "-Dwith-usb-ids-path=" #$hwdata:usb "/share/hwdata/usb.ids")
> > +         (string-append "-Dwith-pci-ids-path=" #$hwdata:pci "/share/hwdata/pci.ids"))
>
> To allow for package transformations, I recommend using
> this-package-input or the like instead of hardcoding a particular
> package:
>
> #~(list
> (string-append
> "-Dwith-usb-ids-path="
> #$(this-package-input "hwdata:usb") "/share/hwdata/usb.ids"))
> [...])
>
> it might also be possible to use 'search-input-file' instead, avoiding
> input labels (untested):
>
> #~(let* ((inputs #$(input-tuples->gexp (package-inputs this-package)))
> (usb.ids (search-input-file inputs "/share/hwdata/usb.ids"))
> (pci.ids (search-input-file inputs "/share/hwdata/pci.ids")))
> (list (string-append "-Dwith-usb-ids-path=" usb.ids) [...]))
>
I got strange errors trying that and couldn't figure out how to make it work.
There are no examples of input-tuples->gexp being used in a package definition.

This works:
#~(list
(string-append "-Dwith-usb-ids-path="
(search-input-file %build-inputs "/share/hwdata/usb.ids"))
(string-append "-Dwith-pci-ids-path="
(search-input-file %build-inputs "/share/hwdata/pci.ids")))

I thought %build-inputs was not a recommended thing to use though?
Toggle quote (6 lines)
> Greetings,
> Maxime.




Backtrace:
In guix/store.scm:
1385:9 19 (map/accumulate-builds #<store-connection 256.99 7f3a3…> …)
1320:8 18 (call-with-build-handler #<procedure 7f3a22f4b360 at g…> …)
In guix/scripts/build.scm:
582:16 17 (_ #<package libosinfo@1.9.0 /home/b/code/guix/gnu/pack…>)
571:24 16 (_ #<package libosinfo@1.9.0 /home/b/code/guix/gnu/pac…> …)
In guix/packages.scm:
1260:17 15 (supported-package? #<package libosinfo@1.9.0 /home/b/…> …)
In guix/memoization.scm:
101:0 14 (_ #<hash-table 7f3a2538e7a0 0/31> #<package libosinfo…> …)
In guix/packages.scm:
1238:37 13 (_)
1498:16 12 (package->bag _ _ _ #:graft? _)
1603:43 11 (thunk)
In ice-9/eval.scm:
191:35 10 (_ #(#(#<directory (gnu packages virtualization) 7f…>) …))
173:47 9 (_ #(#(#<directory (gnu packages virtualization) 7f…>) …))
213:29 8 (_ #(#(#<directory (gnu packages virtualization) 7f…>) …))
155:9 7 (_ #(#(#<directory (gnu packages virtualization) 7f…>) …))
202:35 6 (_ #(#(#<directory (gnu packages virtualization) 7f…>) …))
In guix/gexp.scm:
1886:4 5 (input-tuples->gexp (("glib" #<package glib@2.70…> …) …) …)
In srfi/srfi-1.scm:
586:17 4 (map1 (("glib" #<package glib@2.70.2 gnu/packages…> …) …))
In guix/gexp.scm:
1886:9 3 (_ _)
In ice-9/boot-9.scm:
1685:16 2 (raise-exception _ #:continuable? _)
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" ("glib" #<package glib@2.70.2 gnu/packages/glib.scm:180 7f3a24fdbdc0> "bin"))'.
M
M
Maxime Devos wrote on 27 Feb 11:46 +0100
f69a120d877a440a4a0054c41ee8a59cf90ae175.camel@telenet.be
Brendan Tildesley schreef op zo 27-02-2022 om 02:37 [+0100]:
Toggle quote (12 lines)
> I got strange errors trying that and couldn't figure out how to make it work.
> There are no examples of input-tuples->gexp being used in a package definition.
>
> This works:
>  #~(list
>          (string-append "-Dwith-usb-ids-path="
>                         (search-input-file %build-inputs "/share/hwdata/usb.ids"))
>          (string-append "-Dwith-pci-ids-path="
>                         (search-input-file %build-inputs "/share/hwdata/pci.ids")))
>
> I thought %build-inputs was not a recommended thing to use though?

It is. Anyway, I found a solution, see attachement.

Maybe the 'gexp-input-compiler' could be moved into (guix gexp)
and 'this-package-input-list'/'this-package-native-input-list' could
be moved into (guix packages) (+ documented in the manual)?

CC'ing ludo for the proposed new gexpology.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhtWoRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nVEAP9sDmzIo/6OVKZEldZeI64qXr4O
V0YkMCTDFGNSttmScAD8CraziR0fM9eoE5OWr2vfaPZ3Cf9rYJgiVzs8DnvwfQY=
=hrh0
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 27 Feb 11:56 +0100
58cd826af583022698ee91d0c2a25526ccb27756.camel@telenet.be
Maxime Devos schreef op zo 27-02-2022 om 11:46 [+0100]:
Toggle quote (3 lines)
>
> It is. Anyway, I found a solution, see attachement.

Oops forgot the attachement


Toggle quote (8 lines)
> Maybe the 'gexp-input-compiler' could be moved into (guix gexp)
> and 'this-package-input-list'/'this-package-native-input-list' could
> be moved into (guix packages) (+ documented in the manual)?
>
> CC'ing ludo for the proposed new gexpology.
>
> Greetings,
> Maxime.
(use-modules (guix packages) (gnu packages) (gnu packages gtk) (gnu packages glib) (guix gexp)
(gnu packages gnome) (gnu packages xml) (gnu packages virtualization)
(gnu packages pkg-config) (guix git-download) (guix build-system gnu)
(guix build-system meson) (gnu packages compression) (ice-9 match)
(guix monads) (guix store) (guix derivations)
((guix licenses) #:prefix license:))


(define <gexp-input> (@@ (guix gexp) <gexp-input>))
(define-gexp-compiler gexp-input-compiler <gexp-input>
compiler => (lambda (input system target)
(lower-object (gexp-input-thing input) system
#:target
(and (not (gexp-input-native? input)) target)))
expander => (lambda (object lowered output)
(derivation->output-path lowered (gexp-input-output object))))

(define-public hwdata
(package
(name "hwdata")
(version "0.356")
(source (origin
(method git-fetch)
(uri (git-reference
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
(build-system gnu-build-system)
(outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
(native-inputs (list gzip))
(arguments
;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
(list
#:tests? #f
#:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda _
(install-file "iab.txt" (string-append #$output:iab "/share/hwdata"))
(install-file "oui.txt" (string-append #$output:oui "/share/hwdata"))
(install-file "pci.ids" (string-append #$output:pci "/share/hwdata"))
(install-file "pnp.ids" (string-append #$output:pnp "/share/hwdata"))
(install-file "usb.ids" (string-append #$output:usb "/share/hwdata")))))))
(synopsis "Hardware identification and configuration data")
(description "@code{hwdata} contains various hardware identification and
configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.")
(license (list license:gpl2+
license:expat)))) ;XFree86 1.0


(define* (package-input-list->build-input-list inputs native?)
"Expand INPUTS, a list of input tuples, into a list of name/<gexp-input>
tulples."
#~'#$(map (match-lambda
((name object output)
#~(#$name . #$(gexp-input object output #:native? native?)))
((name object) #~(#$name . #$object)))
inputs))

(define-syntax this-package-input-list
(identifier-syntax
(package-input-list->build-input-list
(append (package-inputs this-package)
(package-propagated-inputs this-package))
#false)))

(define-syntax this-package-native-input-list
(identifier-syntax
(package-input-list->build-input-list
(package-native-inputs this-package) #true)))

(define libosinfo-new
(package
(inherit (specification->package "libosinfo"))
(arguments
(list #:configure-flags
#~(let* ((inputs #$this-package-native-input-list)
(usb.ids (search-input-file inputs "/share/hwdata/usb.ids"))
(pci.ids (search-input-file inputs "/share/hwdata/pci.ids")))
(list (string-append "-Dwith-usb-ids-path=" usb.ids)
(string-append "-Dwith-pci-ids-path=" pci.ids)))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-osinfo-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "osinfo/osinfo_loader.c"
(("path = DATA_DIR.*")
(string-append "path = \"" (search-input-directory inputs "/share/osinfo") "\";"))))))))
(inputs
(list libsoup-minimal-2 libxml2 libxslt osinfo-db))
(native-inputs
(list `(,glib "bin")
gobject-introspection
gtk-doc/stable
vala
intltool
pkg-config
`(,hwdata "pci")
`(,hwdata "usb")))))
libosinfo-new
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhtY3BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vllAP9abSmdy3eAk4tY0YJT//FM/Lg4
xYTopIsHO3IB63XjXgEAiD0GAOou9ffCnEG8b6btYdxs1oOL40nQM0cJVyr35AQ=
=oAI+
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 27 Feb 13:08 +0100
Re: [bug#54069] [PATCH v2 1/4] gnu: Add hwdata.
dd3b6faeaff0987f1747f9d43323a4efa63cb3f5.camel@telenet.be
Maxim Cournoyer schreef op za 26-02-2022 om 18:14 [-0500]:
Toggle quote (5 lines)
> > +(define-public hwdata
> > +  (package
> > +    (name "hwdata")
> > +    (version "0.356")

Given that this is pure data, WDYT of adding #:target #false to
'arguments', such that ‘cross-compiling’ hwdata is free, by
making the derivation for cross-compiling hwdata the same
as the derivation for compiling hwdata natively?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhtpvBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7oPXAQCSxDD8KLJFdAN3uIJeX8dzVZ9/
NXiaalnImJ4VbMrLwQD+MiT362v6VPYdW/7NEyGAH3mi8D4KdLMkpqHlLotBaw0=
=gN86
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 27 Feb 13:12 +0100
Re: [bug#54069] [PATCH v2 3/4] gnu: libosinfo: Unbundle usb.ids, pci.ids.
4015dac77070e12f823051104427bc02baefd720.camel@telenet.be
Brendan Tildesley schreef op za 26-02-2022 om 15:32 [+1100]:
Toggle quote (3 lines)
> +           `(,hwdata "pci")
> +           `(,hwdata "usb")))

I would put these in 'inputs', since they are kept in the closure,
and I'd like to eventually automatically implicitely set #:allowed-
references to make sure only (non-native) inputs make their way into
the references, to catch some cross-compilation bugs early.

It doesn't truly matter here though, since hwdata is architecture-
independent.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhtqvxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7o8cAQCq4lFC7e1qkpmvVjGHeDD9Leo0
ensy7ITjVnIdvx/7AwD/QRew6VqilZkX/1Usnia6ThXyrSQhqdTqGZZcTGH/4Qg=
=Npk+
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 27 Feb 22:23 +0100
(name . Maxime Devos)(address . maximedevos@telenet.be)
87r17ot35k.fsf@gnu.org
Hello!

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (11 lines)
> (define libosinfo-new
> (package
> (inherit (specification->package "libosinfo"))
> (arguments
> (list #:configure-flags
> #~(let* ((inputs #$this-package-native-input-list)
> (usb.ids (search-input-file inputs "/share/hwdata/usb.ids"))
> (pci.ids (search-input-file inputs "/share/hwdata/pci.ids")))
> (list (string-append "-Dwith-usb-ids-path=" usb.ids)
> (string-append "-Dwith-pci-ids-path=" pci.ids)))

I think this is equivalent to:

#~(let* ((inputs #$(input-tuples->gexp (package-inputs this-package)))
…)
…)

Am I right?

However, that looks a bit far-fetched to me.

Can’t we instead do:

#~(let* ((usb.ids (string-append #$hwdata:usb "/share/hwdata/usb.ids"))
(pci.ids (string-append #$hwdata:pci "/share/hwdata/pci.ids")))
…)

?

Ludo’.
M
M
Maxime Devos wrote on 27 Feb 23:17 +0100
(name . Ludovic Courtès)(address . ludo@gnu.org)
c25428e889d5f3d3b42a3b8016b7fba90895cb63.camel@telenet.be
Ludovic Courtès schreef op zo 27-02-2022 om 22:23 [+0100]:
Toggle quote (8 lines)
> Can’t we instead do:
>
>   #~(let* ((usb.ids (string-append #$hwdata:usb "/share/hwdata/usb.ids"))
>            (pci.ids (string-append #$hwdata:pci "/share/hwdata/pci.ids")))
>       …)
>
> ?

We could, and that's what the original v2 patch did.
However, this prevents package transformations:

(package
(inherit libosinfo)
(native-inputs
;; not sure about the syntax
(modify-inputs (package-inputs libosinfo)
(replace "hwdata:usb"
hwdata-with-some-new-fancy-hardware "usb"))))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhv4ihccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ghPAQCZya1aqHLA6nEXivZvbm7o/8zY
6ooPfqCstuvAVl+8TwD/erEQeL9eG2X+hATjvYg1YYnUeY0Wg+HFiVTvSNzr0QI=
=Wwzf
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 27 Feb 23:18 +0100
(name . Ludovic Courtès)(address . ludo@gnu.org)
6eb423c92273988a9c62acf6b49d744fe97fd035.camel@telenet.be
Ludovic Courtès schreef op zo 27-02-2022 om 22:23 [+0100]:
Toggle quote (8 lines)
> I think this is equivalent to:
>
>   #~(let* ((inputs #$(input-tuples->gexp (package-inputs this-package)))
>            …)
>       …)
>
> Am I right?

That's what I suggested initially:

Toggle quote (10 lines)
> > #~(let* ((inputs #$(input-tuples->gexp (package-inputs this-
> package)))
> > (usb.ids (search-input-file inputs
> "/share/hwdata/usb.ids"))
> > (pci.ids (search-input-file inputs
> "/share/hwdata/pci.ids")))
> > (list (string-append "-Dwith-usb-ids-path=" usb.ids) [...]))
> >
>

However, that lead to errors -- strings like #<package foo [...]>
appeared in the builder.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhv4nxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rjVAQC8ewHu7htrmSxQnLp91wg+Tw8q
0p1fkmKZt+nj02dxWAEAv5utcIBbeCmhG/E9RLCid5rdNBMS95b5Uf4a0OyY9gg=
=7000
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 28 Feb 12:48 +0100
(name . Maxime Devos)(address . maximedevos@telenet.be)
87sfs3dxes.fsf@gnu.org
Hi!

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (12 lines)
> Ludovic Courtès schreef op zo 27-02-2022 om 22:23 [+0100]:
>> Can’t we instead do:
>>
>>   #~(let* ((usb.ids (string-append #$hwdata:usb "/share/hwdata/usb.ids"))
>>            (pci.ids (string-append #$hwdata:pci "/share/hwdata/pci.ids")))
>>       …)
>>
>> ?
>
> We could, and that's what the original v2 patch did.
> However, this prevents package transformations:

Right, but maybe that’s good enough?…

Otherwise, we can do:

#~(let* ((usb.ids (string-append
(ungexp (this-package-inputs "hwdata") "usb")
…)))
…)


[...]

Toggle quote (24 lines)
> Ludovic Courtès schreef op zo 27-02-2022 om 22:23 [+0100]:
>> I think this is equivalent to:
>>
>>   #~(let* ((inputs #$(input-tuples->gexp (package-inputs this-package)))
>>            …)
>>       …)
>>
>> Am I right?
>
> That's what I suggested initially:
>
>> > #~(let* ((inputs #$(input-tuples->gexp (package-inputs this-
>> package)))
>> > (usb.ids (search-input-file inputs
>> "/share/hwdata/usb.ids"))
>> > (pci.ids (search-input-file inputs
>> "/share/hwdata/pci.ids")))
>> > (list (string-append "-Dwith-usb-ids-path=" usb.ids) [...]))
>> >
>>
>
> However, that lead to errors -- strings like #<package foo [...]>
> appeared in the builder.

Hmm weird.

Thanks,
Ludo’.
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCHES v3 0/7]: Update and make use of hwdata
(address . 54069@debbugs.gnu.org)
20220310093145.31649-1-mail@brendan.scot
I have used the ungexp suggestion Ludo made. I don't have any stance
on the gexp-ology business, so I just did that.
Feel free to change it however one wishes.

the hwata updates can go to master, but the rest should be considered for
core-updates i think?

I have fixed up the pciutils definiton a bit, where I had previously
removed the installation of a man page by mistake.

Implemented the #:target #f suggestion in hwdata, and fixed a small
mistake.

I was away from the computer for a week so I hope I haven't forgotten
to consider all feedback.

Updated hwdata to 357.
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 1/7] gnu: hwdata: Set #:target #f.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-2-mail@brendan.scot
* gnu/packages/pciutils.scm (hwdata): Set #:target #f to make
cross-compiling free, as explained by Maxime in bug#54069.
---
gnu/packages/pciutils.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index 34abfb3c2d..5c25e78ac9 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -56,6 +56,7 @@ (define-public hwdata
      ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
      (list
       #:tests? #f
+      #:target #f ; Make the derivation the same when cross-compiling, since it's just data.
       #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
       #:phases
       #~(modify-phases %standard-phases
-- 
2.34.0
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 2/7] gnu: hwdata: Remove unused gzip native-input.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-3-mail@brendan.scot
* gnu/packages/pciutils.scm (hwdata): I accidently left this gzip input
here which is unused. Remove it.
---
gnu/packages/pciutils.scm | 1 -
1 file changed, 1 deletion(-)

Toggle diff (14 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index 5c25e78ac9..bad42e238d 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -51,7 +51,6 @@ (define-public hwdata
                 "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
     (build-system gnu-build-system)
     (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
-    (native-inputs (list gzip))
     (arguments
      ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
      (list
-- 
2.34.0
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 3/7] gnu: hwdata: Update to 0.357.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-4-mail@brendan.scot
* gnu/packages/pciutils.scm (hwdata): Update to 0.357.
---
gnu/packages/pciutils.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index bad42e238d..41ba10f1e1 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -39,7 +39,7 @@ (define-module (gnu packages pciutils)
 (define-public hwdata
   (package
     (name "hwdata")
-    (version "0.356")
+    (version "0.357") ;hwdata is updated monthly
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -48,7 +48,7 @@ (define-public hwdata
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
+                "0kvxpdx14w2myqm3dikjvr2mr4j6767y4v5j8v7kffwvcv0ga9gv"))))
     (build-system gnu-build-system)
     (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
     (arguments
-- 
2.34.0
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 4/7] gnu: pciutils: Unbundle pci.ids and use latest.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-5-mail@brendan.scot
* 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(-)

Toggle diff (52 lines)
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
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 6/7] gnu: libosinfo: Use this-package-input.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-7-mail@brendan.scot
* gnu/packages/virtualization.scm (libosinfo): [arguments]: Use
this-package-input for osinfo-db to support package-transformations.
---
gnu/packages/virtualization.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 5756c49b07..10d9bd0de9 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -1048,7 +1048,9 @@ (define-public libosinfo
             (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "osinfo/osinfo_loader.c"
                 (("path = DATA_DIR.*")
-                 (string-append "path = \"" #$osinfo-db "/share/osinfo\";"))))))))
+                 (string-append "path = \""
+                                #$(this-package-input "osinfo-db")
+                                "/share/osinfo\";"))))))))
     (inputs
      (list libsoup-minimal-2
            libxml2
-- 
2.34.0
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 5/7] gnu: libosinfo: Unbundle usb.ids, pci.ids.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-6-mail@brendan.scot
* gnu/packages/virtualization.scm (libosinfo):
[arguments]: Use Gexp style. Use hwdata package for latest usb.ids and
pci.ids.
[inputs]: Add hwdata:pci, hwdata:usb. remove pci.ids, usb.ids origins.
Use new input style.
---
gnu/packages/virtualization.scm | 68 +++++++++++++++------------------
1 file changed, 30 insertions(+), 38 deletions(-)

Toggle diff (97 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 8098a0aec3..5756c49b07 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -25,6 +25,7 @@
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -98,6 +99,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages polkit)
@@ -1031,46 +1033,36 @@ (define-public libosinfo
          "0nd360c9ampw8hb6xh5g45q858df2r4jj9q88bcl6gzgaj0l3wxl"))))
     (build-system meson-build-system)
     (arguments
-     `(#:configure-flags
-       (list (string-append "-Dwith-usb-ids-path="
-                            (assoc-ref %build-inputs "usb.ids"))
-             (string-append "-Dwith-pci-ids-path="
-                            (assoc-ref %build-inputs "pci.ids")))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-osinfo-path
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "osinfo/osinfo_loader.c"
-               (("path = DATA_DIR.*")
-                (string-append "path = \"" (assoc-ref inputs "osinfo-db")
-                               "/share/osinfo\";"))))))))
+     (list
+      #:configure-flags
+      #~(list
+         (string-append "-Dwith-usb-ids-path="
+                        (ungexp (this-package-input "hwdata") "usb")
+                        "/share/hwdata/usb.ids")
+         (string-append "-Dwith-pci-ids-path="
+                        (ungexp (this-package-input "hwdata") "pci")
+                        "/share/hwdata/pci.ids"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-osinfo-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "osinfo/osinfo_loader.c"
+                (("path = DATA_DIR.*")
+                 (string-append "path = \"" #$osinfo-db "/share/osinfo\";"))))))))
     (inputs
-     `(("libsoup" ,libsoup-minimal-2)
-       ("libxml2" ,libxml2)
-       ("libxslt" ,libxslt)
-       ("osinfo-db" ,osinfo-db)))
+     (list libsoup-minimal-2
+           libxml2
+           libxslt
+           osinfo-db
+           `(,hwdata "pci")
+           `(,hwdata "usb")))
     (native-inputs
-     `(("glib" ,glib "bin")  ; glib-mkenums, etc.
-       ("gobject-introspection" ,gobject-introspection)
-       ("gtk-doc" ,gtk-doc/stable)
-       ("vala" ,vala)
-       ("intltool" ,intltool)
-       ("pkg-config" ,pkg-config)
-       ("pci.ids"
-        ,(origin
-           (method url-fetch)
-           (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
-           (sha256
-            (base32
-             "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
-       ("usb.ids"
-        ,(origin
-           (method url-fetch)
-           (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
-           (file-name "usb.ids")
-           (sha256
-            (base32
-             "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
+     (list `(,glib "bin")  ; glib-mkenums, etc.
+           gobject-introspection
+           gtk-doc/stable
+           vala
+           intltool
+           pkg-config))
     (home-page "https://libosinfo.org/")
     (synopsis "Operating system information database")
     (description "libosinfo is a GObject based library API for managing
-- 
2.34.0
B
B
Brendan Tildesley wrote on 10 Mar 10:31 +0100
[PATCH v3 7/7] gnu: libpciaccess: Use hwdata for pci.ids.
(address . 54069@debbugs.gnu.org)
20220310093145.31649-8-mail@brendan.scot
* gnu/packages/xorg.scm (libpciaccess):
[arguments]: Remove zlib support since pci.ids isn't gzipped. Use Gexp.
[inputs]: Add hwdata:pci, remove zlib, pciutils.
[native-inputs]: Remove pkg-config since zlib isn't used.
---
gnu/packages/xorg.scm | 34 +++++++++-------------------------
1 file changed, 9 insertions(+), 25 deletions(-)

Toggle diff (59 lines)
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 14cd3bc789..67ce0c9980 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
 ;;; Copyright © 2021 Lu Hui <luhux76@gmail.com>
+;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1150,36 +1151,19 @@ (define-public libpciaccess
         (method url-fetch)
         (uri (string-append
                "mirror://xorg/individual/lib/libpciaccess-"
-               version
-               ".tar.bz2"))
+               version ".tar.bz2"))
         (sha256
           (base32
             "12glp4w1kgvmqn89lk19cgr6jccd3awxra4dxisp7pagi06rsk11"))))
     (build-system gnu-build-system)
     (arguments
-     '(;; Make sure libpciaccess can read compressed 'pci.ids' files as
-       ;; provided by pciutils.
-       #:configure-flags
-       (list "--with-zlib"
-             (string-append "--with-pciids-path="
-                            (assoc-ref %build-inputs "pciutils")
-                            "/share/hwdata"))
-
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'add-L-zlib
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Provide '-LZLIB/lib' next to '-lz' in the .la file.
-             (let ((zlib (assoc-ref inputs "zlib"))
-                   (out  (assoc-ref outputs "out")))
-               (substitute* (string-append out "/lib/libpciaccess.la")
-                 (("-lz")
-                  (string-append "-L" zlib "/lib -lz")))
-               #t))))))
-    (inputs
-     (list zlib pciutils))                   ;for 'pci.ids.gz'
-    (native-inputs
-       (list pkg-config))
+     (list
+      #:configure-flags
+      #~(list (string-append
+               "--with-pciids-path="
+               (ungexp (this-package-input "hwdata") "pci")
+               "/share/hwdata/pci.ids"))))
+    (inputs (list `(,hwdata "pci")))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg PCI access library")
     (description "Xorg Generic PCI access library.")
-- 
2.34.0
M
M
Maxim Cournoyer wrote on 22 Mar 23:02 +0100
Re: bug#54069: [PATCH 0/2] gnu: pciutils: Unbundle pci.ids and use latest.
(name . Brendan Tildesley)(address . mail@brendan.scot)
87o81x1w8t.fsf_-_@gmail.com
Hi Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (5 lines)
> * gnu/packages/xorg.scm (libpciaccess):
> [arguments]: Remove zlib support since pci.ids isn't gzipped. Use Gexp.
> [inputs]: Add hwdata:pci, remove zlib, pciutils.
> [native-inputs]: Remove pkg-config since zlib isn't used.

While that simplify things a bit, it's not really required since the
pci.ids.gz from pciutils will now be generated from hwdata:pci, right?

I think I'd rather it stay that way for now.

Thanks,

Maxim
M
M
Maxim Cournoyer wrote on 23 Mar 02:57 +0100
(name . Brendan Tildesley)(address . mail@brendan.scot)
87mthh1ld2.fsf_-_@gmail.com
Hi Brendan,

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (6 lines)
> * 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.

Toggle quote (14 lines)
> ---
> 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
Toggle quote (4 lines)
> + (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.

Toggle quote (3 lines)
> (replace 'configure
> - (lambda* (#:key outputs #:allow-other-keys)
> + (lambda* (#:key inputs outputs #:allow-other-keys)
^ not needed
Toggle quote (32 lines)
> ;; 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
M
M
Maxim Cournoyer wrote on 23 Mar 03:14 +0100
(name . Brendan Tildesley)(address . mail@brendan.scot)
87ils51kln.fsf_-_@gmail.com
Hi!

Brendan Tildesley <mail@brendan.scot> writes:

Toggle quote (6 lines)
> * gnu/packages/virtualization.scm (libosinfo):
> [arguments]: Use Gexp style. Use hwdata package for latest usb.ids and
> pci.ids.
> [inputs]: Add hwdata:pci, hwdata:usb. remove pci.ids, usb.ids origins.
> Use new input style.

I've squashed the modified the libosinfo patches a little bit, updated
it to 1.10.0, and made some other small adjustments, and pushed the
hwdata and libosinfo patches as
4b3b873344eb78a4cd96742e4035b39cbec79577.

Thank you!

Closing.

Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 54069@debbugs.gnu.org