From 7b28ef64c2b0221583f0283a44d9a80307faa994a705ed72767c8eaa5d0623c9 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Wed, 6 Jan 2021 08:14:45 +0000 Subject: [PATCH 1/3] - Update to version 0.343: + Updated pci, usb and vendor ids. OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/hwdata?expand=0&rev=87 --- hwdata-0.342.tar.gz | 3 --- hwdata-0.343.tar.gz | 3 +++ hwdata.changes | 6 ++++++ hwdata.spec | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) delete mode 100644 hwdata-0.342.tar.gz create mode 100644 hwdata-0.343.tar.gz diff --git a/hwdata-0.342.tar.gz b/hwdata-0.342.tar.gz deleted file mode 100644 index ff33bad..0000000 --- a/hwdata-0.342.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f1e79131c870dce4a3b4b75edeefc5c9aef416d488a131c66cb6893be743be63 -size 2116474 diff --git a/hwdata-0.343.tar.gz b/hwdata-0.343.tar.gz new file mode 100644 index 0000000..141b65d --- /dev/null +++ b/hwdata-0.343.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccb4d21337b3773cc02654b360e91feb44c9258728d2f027b72013bd5628113b +size 2129000 diff --git a/hwdata.changes b/hwdata.changes index 248340e..57d4c82 100644 --- a/hwdata.changes +++ b/hwdata.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 6 08:13:18 UTC 2021 - Martin Pluskal + +- Update to version 0.343: + + Updated pci, usb and vendor ids. + ------------------------------------------------------------------- Mon Dec 7 08:49:16 UTC 2020 - Martin Pluskal diff --git a/hwdata.spec b/hwdata.spec index cad5b22..289e456 100644 --- a/hwdata.spec +++ b/hwdata.spec @@ -1,7 +1,7 @@ # # spec file for package hwdata # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: hwdata -Version: 0.342 +Version: 0.343 Release: 0 Summary: Hardware identification and configuration data License: GPL-2.0-or-later From 5d140aa34b220d8b628a53c6099b832138ea06f6617a3e2b98c278b189ba6641 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 7 Jan 2021 14:32:56 +0000 Subject: [PATCH 2/3] - Add merge-pciids.pl to fully duplicate behavior of pciutils-ids * Helps resolve SLE issue bsc#1180422 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/hwdata?expand=0&rev=88 --- hwdata.changes | 6 +++ hwdata.spec | 26 +++++++++++- merge-pciids.pl | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 merge-pciids.pl diff --git a/hwdata.changes b/hwdata.changes index 57d4c82..ffb469c 100644 --- a/hwdata.changes +++ b/hwdata.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 7 14:28:17 UTC 2021 - Martin Pluskal + +- Add merge-pciids.pl to fully duplicate behavior of pciutils-ids + * Helps resolve SLE issue bsc#1180422 + ------------------------------------------------------------------- Wed Jan 6 08:13:18 UTC 2021 - Martin Pluskal diff --git a/hwdata.spec b/hwdata.spec index 289e456..58ab6fe 100644 --- a/hwdata.spec +++ b/hwdata.spec @@ -22,7 +22,11 @@ Release: 0 Summary: Hardware identification and configuration data License: GPL-2.0-or-later URL: https://github.com/vcrhonek/hwdata -Source: https://github.com/vcrhonek/hwdata/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: https://github.com/vcrhonek/hwdata/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: merge-pciids.pl +Requires(post): coreutils +Requires(post): perl +Conflicts: pciutils-ids Provides: pciutils-ids = 20200529 Obsoletes: pciutils-ids < 20200529 BuildArch: noarch @@ -42,20 +46,38 @@ such as the pci.ids and usb.ids databases. %make_install # create symlink for smooth transition from pciutils-ids package +mkdir %{buildroot}%{_datadir}/pci.ids.d ln -s %{_datadir}/hwdata/pci.ids \ + %{buildroot}%{_datadir}/pci.ids.d/pci.ids.dist + +install -Dpm 0755 %{SOURCE1} \ + %{buildroot}%{_bindir}/merge-pciids +install -Dpm 0644 /dev/null \ %{buildroot}%{_datadir}/pci.ids # not needed at all rm -rf %{buildroot}/%{_libdir}/modprobe.d +%post +if [ -x %{_bindir}/merge-pciids -a -x %{_bindir}/perl ]; then + %{_bindir}/merge-pciids +else + # This should only happen in autobuild + echo "WARNING: merge-pciids or perl not found" + cp -p %{_datadir}/pci.ids.d/pci.ids.dist %{_datadir}/pci.ids +fi + %files %license LICENSE COPYING +%{_bindir}/merge-pciids %dir %{_datadir}/%{name} %{_datadir}/hwdata/iab.txt %{_datadir}/hwdata/oui.txt %{_datadir}/hwdata/pci.ids %{_datadir}/hwdata/pnp.ids %{_datadir}/hwdata/usb.ids -%{_datadir}/pci.ids +%dir %{_datadir}/pci.ids.d +%{_datadir}/pci.ids.d/pci.ids.dist +%ghost %{_datadir}/pci.ids %changelog diff --git a/merge-pciids.pl b/merge-pciids.pl new file mode 100644 index 0000000..85ba615 --- /dev/null +++ b/merge-pciids.pl @@ -0,0 +1,111 @@ +#!/usr/bin/perl -w +# Merge several PCI ID lists to a single one. This script tries to be as agnostic +# of the details of the ID list as possible, so it should not break with future +# changes of the ID list format as long as they follow the same block structure. +# +# Options: +# -v: Verbose mode. Warn if multiple files provide different definitions for +# the same device. +# +# (c) 2007 Martin Mares , GPLv2 +# (c) 2013, 2015 Jean Delvare + +use strict; +use Getopt::Std; +use File::Copy; +use vars qw($IDSD_PATH $MASTER_IDS $PCI_IDS @idsd_files $output); + +$IDSD_PATH = "/usr/share/pci.ids.d"; +$MASTER_IDS = "/usr/share/pci.ids.d/pci.ids.dist"; +$PCI_IDS = "/usr/share/pci.ids"; + +our $opt_v; +getopts('v'); + +if (! -f $MASTER_IDS) { + print STDERR "ERROR: $MASTER_IDS not found, giving up\n"; + exit 1; +} + +sub collect_files($) +{ + my ($dir) = @_; + my ($file, @files); + + opendir(my $dh, $dir) || die "Could not open directory $dir: $!"; + # Ignore non-files and hidden files + while (defined ($file = readdir($dh))) { + push @files, "$dir/$file" if $file !~ m/^\./ && -f "$dir/$file"; + } + closedir($dh); + + return @files; +} + +my %ids = (); +my %comments = (); +@idsd_files = collect_files($IDSD_PATH); +foreach our $file (@idsd_files) { + my $fn = ($file =~ /\.gz$/) ? "zcat $file |" : ($file =~ /\.bz2$/) ? "bzcat $file |" : $file; + open F, $fn or die "Unable to open $file: $!"; + my @id = (); + my $comm = ""; + my $class = 0; + sub err($) { + print STDERR "Error in $file, line $.: @_\n"; + # If merging fails for whatever reason, fallback to master file copy + print STDERR "WARNING: Merge not successful, using master pci.ids file\n"; + copy($MASTER_IDS, $PCI_IDS) || die "Could not copy $MASTER_IDS to $PCI_IDS: $!"; + chmod(0644, "$PCI_IDS"); + exit 1; + } + while () { + if (/^(#.*|\s*$)/) { + $comm .= $_; + next; + } + chomp; + if (/^(\t|C\s+|)([0-9a-fA-F]+)\s+(.*)$/ || + (!$class && /^(\t\t)([0-9a-fA-F]+\s+[0-9a-fA-F]+)\s+(.*)$/) || + ($class && /^(\t\t)([0-9a-fA-F]+)\s+(.*)$/)) { + my $indent = $1; + my $id = lc($2); + my $name = $3; + if ($indent =~ /^C\s+$/) { + $indent = ""; + $id = "C $id"; + } + my $depth = length $indent; + $depth <= @id or err "Mismatched indentation"; + @id = (@id[0..$depth-1], $id); + $class = ($id =~ /^C\s/) if !$depth; # Remember if we are in a vendor or a class section + my $i = join(":", @id); + my $j = $class ? "~$i" : $i; # We want to sort special entries last + if ($opt_v && exists $ids{$j} && $ids{$j} ne $name) { + print STDERR "Warning: ID $i has two different definitions, using the one from $file\n"; + } + $ids{$j} = $name; + $comments{$j} = $comm if $comm; + } else { + err "Parse error"; + } + $comm = ""; + } + close F; +} + +# Write to a temporary file to avoid a race condition with lspci +open($output, ">", "$PCI_IDS.part") || die "Could not write to $PCI_IDS.part: $!"; +print $output "# This file has been merged automatically from the following files:\n#\t", join("\n#\t", @idsd_files), "\n\n"; +foreach my $id (sort keys %ids) { + my ($i, $j) = ($id, $id); + $i =~ s/[^:]//g; + $i =~ tr/:/\t/; + $j =~ s/.*://g; + $j =~ s/^~//; + print $output $comments{$id} if $comments{$id}; + print $output "$i$j $ids{$id}\n"; +} +close($output); +rename("$PCI_IDS.part", "$PCI_IDS") || die "Could not rename $PCI_IDS.part to $PCI_IDS: $!"; +chmod(0644, "$PCI_IDS"); From 980ddf1ab99f22b57fd1d52d376bff58b5aacc14779d5e3f0821e262307cecc3 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Fri, 8 Jan 2021 07:04:38 +0000 Subject: [PATCH 3/3] * Resolves SLE issue bsc#1180422 bsc#1180482 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/hwdata?expand=0&rev=89 --- hwdata.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwdata.changes b/hwdata.changes index ffb469c..d43817d 100644 --- a/hwdata.changes +++ b/hwdata.changes @@ -2,7 +2,7 @@ Thu Jan 7 14:28:17 UTC 2021 - Martin Pluskal - Add merge-pciids.pl to fully duplicate behavior of pciutils-ids - * Helps resolve SLE issue bsc#1180422 + * Resolves SLE issue bsc#1180422 bsc#1180482 ------------------------------------------------------------------- Wed Jan 6 08:13:18 UTC 2021 - Martin Pluskal