hwinfo: use more up-to-date pci.ids / usb.ids

context: https://github.com/openSUSE/hwinfo/pull/144
This commit is contained in:
Jörg Thalheim 2024-09-03 12:00:08 +02:00
parent 61b0313191
commit 28f75f3278

View File

@ -14,6 +14,8 @@
runCommand,
validatePkgConfig,
gitUpdater,
buildPackages,
perlPackages,
}:
stdenv.mkDerivation (finalAttrs: {
@ -30,17 +32,21 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
flex
validatePkgConfig
perl
perlPackages.XMLWriter
perlPackages.XMLParser
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
buildInputs = [
libuuid
libx86emu
perl
];
postPatch = ''
# used by the build system
echo ${finalAttrs.version} > VERSION
# Replace /usr paths with Nix store paths
substituteInPlace Makefile \
--replace-fail "/sbin" "/bin" \
@ -58,12 +64,26 @@ stdenv.mkDerivation (finalAttrs: {
--replace-fail "/sbin/rmmod" "${kmod}/bin/rmmod" \
--replace-fail "/usr/bin/udevinfo" "${systemdMinimal}/bin/udevinfo" \
--replace-fail "/usr/bin/udevadm" "${systemdMinimal}/bin/udevadm"
'';
makeFlags = [
"LIBDIR=/lib"
];
# The pci/usb ids in hwinfo are ancient. We can get a more up-to-date list simply by copying from systemd
preBuild = ''
# since we don't have .git, we cannot run this.
rm git2log
pushd src/ids
cp ${systemdMinimal.src}/hwdb.d/pci.ids src/pci
cp ${systemdMinimal.src}/hwdb.d/usb.ids src/usb
# taken from https://github.com/openSUSE/hwinfo/blob/c87f449f1d4882c71b0a1e6dc80638224a5baeed/src/ids/update_pci_usb
perl -pi -e 'undef $_ if /^C\s/..1' src/usb
perl ./convert_hd src/pci
perl ./convert_hd src/usb
make check_hd CC=$CC_FOR_BUILD
popd
'';
makeFlags = [ "LIBDIR=/lib" ];
installFlags = [ "DESTDIR=$(out)" ];
passthru = {