forked from pool/hwdata
Accepting request 861531 from devel:openSUSE:Factory
- Add merge-pciids.pl to fully duplicate behavior of pciutils-ids * Resolves SLE issue bsc#1180422 bsc#1180482 - Update to version 0.343: + Updated pci, usb and vendor ids. OBS-URL: https://build.opensuse.org/request/show/861531 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hwdata?expand=0&rev=42
This commit is contained in:
commit
ddf8be60e7
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1e79131c870dce4a3b4b75edeefc5c9aef416d488a131c66cb6893be743be63
|
||||
size 2116474
|
3
hwdata-0.343.tar.gz
Normal file
3
hwdata-0.343.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ccb4d21337b3773cc02654b360e91feb44c9258728d2f027b72013bd5628113b
|
||||
size 2129000
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 7 14:28:17 UTC 2021 - Martin Pluskal <mpluskal@suse.com>
|
||||
|
||||
- Add merge-pciids.pl to fully duplicate behavior of pciutils-ids
|
||||
* Resolves SLE issue bsc#1180422 bsc#1180482
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 6 08:13:18 UTC 2021 - Martin Pluskal <mpluskal@suse.com>
|
||||
|
||||
- Update to version 0.343:
|
||||
+ Updated pci, usb and vendor ids.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 7 08:49:16 UTC 2020 - Martin Pluskal <mpluskal@suse.com>
|
||||
|
||||
|
30
hwdata.spec
30
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,12 +17,16 @@
|
||||
|
||||
|
||||
Name: hwdata
|
||||
Version: 0.342
|
||||
Version: 0.343
|
||||
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
|
||||
|
111
merge-pciids.pl
Normal file
111
merge-pciids.pl
Normal file
@ -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 <mj@ucw.cz>, GPLv2
|
||||
# (c) 2013, 2015 Jean Delvare <jdelvare@suse.de>
|
||||
|
||||
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 (<F>) {
|
||||
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");
|
Loading…
Reference in New Issue
Block a user