[virt-tools-list] [PATCH libosinfo] Remove obsolete scripts for PCI/USB id conversion

Daniel P. Berrange berrange at redhat.com
Wed Mar 14 11:35:16 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

The osinfo-pciids-convert and osinfo-usbids-convert scripts
are no longer required, since we can load the data files
natively. Remove them to avoid a runtime dep on Perl.
---
 Makefile.am                   |    2 +-
 configure.ac                  |    1 -
 libosinfo.spec.in             |    2 -
 mingw32-libosinfo.spec.in     |    2 -
 scripts/Makefile.am           |    4 --
 scripts/osinfo-pciids-convert |   88 -----------------------------------------
 scripts/osinfo-usbids-convert |   64 -----------------------------
 7 files changed, 1 insertions(+), 162 deletions(-)
 delete mode 100644 scripts/Makefile.am
 delete mode 100755 scripts/osinfo-pciids-convert
 delete mode 100755 scripts/osinfo-usbids-convert

diff --git a/Makefile.am b/Makefile.am
index b93402e..4b9ff49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 
-SUBDIRS = osinfo test data tools docs examples scripts
+SUBDIRS = osinfo test data tools docs examples
 
 EXTRA_DIST = \
   COPYING.LIB \
diff --git a/configure.ac b/configure.ac
index 462d5e1..33ea6b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,7 +172,6 @@ AC_CONFIG_FILES([
 	data/oses/Makefile
 	data/schemas/Makefile
 	tools/Makefile
-	scripts/Makefile
 	test/Makefile
 	docs/Makefile
 	docs/reference/Makefile
diff --git a/libosinfo.spec.in b/libosinfo.spec.in
index 9bfeff8..c48f73c 100644
--- a/libosinfo.spec.in
+++ b/libosinfo.spec.in
@@ -96,8 +96,6 @@ rm -fr %{buildroot}
 %files
 %defattr(-, root, root)
 %doc AUTHORS ChangeLog COPYING.LIB NEWS README
-%{_bindir}/osinfo-pciids-convert
-%{_bindir}/osinfo-usbids-convert
 %{_bindir}/osinfo-detect
 %{_bindir}/osinfo-db-validate
 %{_bindir}/osinfo-query
diff --git a/mingw32-libosinfo.spec.in b/mingw32-libosinfo.spec.in
index 7da0736..323cd85 100644
--- a/mingw32-libosinfo.spec.in
+++ b/mingw32-libosinfo.spec.in
@@ -59,8 +59,6 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root)
 %doc AUTHORS ChangeLog COPYING.LIB NEWS README
-%{_mingw32_bindir}/osinfo-pciids-convert
-%{_mingw32_bindir}/osinfo-usbids-convert
 %{_mingw32_bindir}/osinfo-detect.exe
 %{_mingw32_bindir}/osinfo-db-validate.exe
 %{_mingw32_bindir}/osinfo-query.exe
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index 4cb89f1..0000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-
-bin_SCRIPTS = osinfo-pciids-convert osinfo-usbids-convert
-
-EXTRA_DIST = $(bin_SCRIPTS)
diff --git a/scripts/osinfo-pciids-convert b/scripts/osinfo-pciids-convert
deleted file mode 100755
index 050d34f..0000000
--- a/scripts/osinfo-pciids-convert
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use warnings;
-
-my $vendor;
-my $vendor_id;
-my $device;
-my $device_id;
-my $subsystem;
-my $subvendor_id;
-my $subdevice_id;
-
-use encoding 'utf8', STDIN => 'iso88591';
-
-print "<libosinfo version='1.0'>\n";
-while (<>) {
-
-    next if /^#/;
-    next if /^\s*$/;
-
-    if (/^([0-9a-f]{4})\s+(.*?)\s*$/) {
-	$vendor = $2;
-	$vendor_id = $1;
-    } elsif (/^\t([0-9a-f]{4})\s+(.*?)\s*$/) {
-	$device = $2;
-	$device_id = $1;
-
-	&one_device($vendor, $vendor_id, $device, $device_id);
-    } elsif (/^\t\t([0-9a-f]{4})\s+([0-9a-f]{4})\s+(.*?)\s*$/) {
-	$subsystem = $3;
-	$subvendor_id = $1;
-	$subdevice_id = $2;
-
-	&one_device($vendor, $vendor_id, $device, $device_id,
-		    $subsystem, $subvendor_id, $subdevice_id);
-    } else {
-	#warn $_;
-    }
-}
-print "</libosinfo>\n";
-
-sub escape {
-    my $data = shift;
-
-    $data =~ s/&/&/g;
-    $data =~ s/</</g;
-    $data =~ s/>/>/g;
-
-    return $data;
-}
-
-sub one_device {
-    my $vendor = shift;
-    my $vendor_id = shift;
-    my $device = shift;
-    my $device_id = shift;
-    my $subsystem = shift;
-    my $subvendor_id = shift;
-    my $subdevice_id = shift;
-
-    $vendor = &escape($vendor);
-    $device = &escape($device);
-    $subsystem = &escape($subsystem) if defined $subsystem;
-
-    my $id = "http://pciids.sourceforge.net/v2.2/pci.ids";
-    $id .= "/$vendor_id/$device_id";
-    $id .= "/$subvendor_id/$subdevice_id" if $subsystem;
-
-    print <<EOF;
-  <device id="$id">
-    <bus-type>pci</bus-type>
-    <vendor>$vendor</vendor>
-    <vendor-id>$vendor_id</vendor-id>
-    <device>$device</device>
-    <device-id>$device_id</device-id>
-EOF
-    if ($subsystem) {
-	print <<EOF;
-    <subsystem>$subsystem</subsystem>
-    <subvendor-id>$subvendor_id</subvendor-id>
-    <subdevice-id>$subdevice_id</subdevice-id>
-EOF
-    }
-    print <<EOF;
-  </device>
-EOF
-}
diff --git a/scripts/osinfo-usbids-convert b/scripts/osinfo-usbids-convert
deleted file mode 100755
index c4a12a2..0000000
--- a/scripts/osinfo-usbids-convert
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use warnings;
-
-my $vendor;
-my $vendor_id;
-my $device;
-my $device_id;
-
-use encoding 'utf8', STDIN => 'iso88591';
-
-print "<libosinfo version='1.0'>\n";
-while (<>) {
-
-    next if /^#/;
-    next if /^\s*$/;
-
-    if (/^([0-9a-f]{4})\s+(.*?)\s*$/) {
-	$vendor = $2;
-	$vendor_id = $1;
-    } elsif (/^\t([0-9a-f]{4})\s+(.*?)\s*$/) {
-	$device = $2;
-	$device_id = $1;
-
-	&one_device($vendor, $vendor_id, $device, $device_id);
-    } else {
-	#warn $_;
-    }
-}
-print "</libosinfo>\n";
-
-sub escape {
-    my $data = shift;
-
-    $data =~ s/&/&/g;
-    $data =~ s/</</g;
-    $data =~ s/>/>/g;
-
-    return $data;
-}
-
-sub one_device {
-    my $vendor = shift;
-    my $vendor_id = shift;
-    my $device = shift;
-    my $device_id = shift;
-
-    $vendor = &escape($vendor);
-    $device = &escape($device);
-
-    my $id = "http://www.linux-usb.org/usb.ids";
-    $id .= "/$vendor_id/$device_id";
-
-    print <<EOF;
-  <device id="$id">
-    <bus-type>usb</bus-type>
-    <vendor>$vendor</vendor>
-    <vendor-id>$vendor_id</vendor-id>
-    <device>$device</device>
-    <device-id>$device_id</device-id>
-  </device>
-EOF
-}
-- 
1.7.7.6




More information about the virt-tools-list mailing list