--- /dev/null
+#!/usr/bin/perl
+# Convert pci.ids to format used by the database.
+
+sub id {
+ $_ = shift @_;
+ tr/A-F/a-f/;
+ return $_;
+}
+
+$last = "????"; $lastd = "????????"; $cmt = "";
+while (<>) {
+ chomp;
+ s/ +$//;
+ s/([^\t])\t+/$1 /g;
+ if (/^$/) { $cmt=""; next; }
+ if (/^#/) { s/^#//; $cmt="$cmt $_"; next; }
+ /^C/ && last;
+ $cmt =~ s/ +/ /g;
+ $cmt =~ s/^ +//;
+ if (/^\t\t([0-9a-fA-F]{4}) ([0-9a-fA-F]{4})\s+([^\t]*)$/) {
+ print "s\t",id("$lastd$1$2"),"\t$3\t0\t$cmt\n";
+ } elsif (/^\t([0-9a-fA-F]{4})\s+([^\t]*)$/) {
+ $lastd="$last$1";
+ print "d\t",id($lastd),"\t$2\t0\t$cmt\n";
+ } elsif (/^([0-9a-fA-F]{4})\s+([^\t]*)$/) {
+ $last=$1; $lastd="$1????";
+ print "v\t",id($1),"\t$2\t0\t$cmt\n";
+ } else {
+ die "Syntax error: $_";
+ }
+ $cmt="";
+}
}
$home = "$ENV{HOME}/";
+my $scripts = "$home/ids/perl/scripts";
$tprefix = "${home}tmp/mbot-$$";
# Little hack to stop spam: ignore everything from people not already in database
$hasAuth->execute( $author );
} else {
print LOG "Patch succeeded.\n";
print LOG "Parsing patched file.\n";
- print LOG `$home/bin/ids_to_dbdump <$orig 2>&1 >orig.db.unsorted`;
+ print LOG `$scripts/ids_to_dbdump <$orig 2>&1 >orig.db.unsorted`;
$? && error("Error parsing original ID database");
print LOG `sort -k1 <orig.db.unsorted >orig.db`;
$? && error("Error sorting original ID database");
- print LOG `$home/bin/ids_to_dbdump <pci.ids 2>&1 >new.db.unsorted`;
+ print LOG `$scripts/ids_to_dbdump <pci.ids 2>&1 >new.db.unsorted`;
$? && error("Error parsing the patched pci.ids file");
print LOG `sort -k1 <new.db.unsorted >new.db`;
$? && error("Error sorting the patched pci.ids file");