]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
more work
authorIan Campbell <ijc@hellion.org.uk>
Sat, 20 Oct 2012 20:52:40 +0000 (21:52 +0100)
committerIan Campbell <ijc@hellion.org.uk>
Sat, 20 Oct 2012 20:52:40 +0000 (21:52 +0100)
Bugs/Message.pm
createdb.sql
injectbugs.pl [new file with mode: 0755]
insertbugs.pl [deleted file]

index 308fa2b028f1bf8ad4a51e807ec989061f7f3444..ddafc702e4f716ff6c4e39704bfa3b9cc6da9e37 100644 (file)
@@ -83,11 +83,20 @@ sub update {
     my $sth = $self->{dbh}->prepare(q{UPDATE messages SET present="true",subject=?2 WHERE id = ?1});
     $sth->execute($self->{id},$subj) or die "execute insert";
     $sth->finish or die "finish insert";
-           
+    
+    my $irt = $header->get('in-reply-to');
+    if ( defined $irt ) {
+       chomp($irt);
+       $irt =~ s/ (.*)$//;
+       my $refto = Bugs::Message->lookup_msgid($self->{dbh}, $irt, Insert => 1);
+       $sth = $self->{dbh}->prepare(q{INSERT INTO refs (parentid,childid) VALUES (?1,?2)});
+       $sth->execute($refto->{id},$self->{id});
+    }
+
     foreach ( $header->get('references') ) {
        foreach our $r ( split(/\s/) ) {
            my $refto = Bugs::Message->lookup_msgid($self->{dbh}, $r, Insert => 1);
-           $sth = $self->{dbh}->prepare(q{INSERT INTO refs (srcid,dstid) VALUES (?1,?2)});
+           $sth = $self->{dbh}->prepare(q{INSERT INTO refs (parentid,childid) VALUES (?1,?2)});
            $sth->execute($refto->{id},$self->{id});
        }
     }
@@ -116,7 +125,7 @@ sub id {
 sub _subthread {
     my ($self,$refs) = @_;
 
-    my $sth = $self->{dbh}->prepare(q{SELECT dstid FROM refs WHERE srcid = ?});
+    my $sth = $self->{dbh}->prepare(q{SELECT childid FROM refs WHERE parentid = ?});
 
     $sth->execute($self->{id});
     my $r;
index 648ea90daf5a42f0211b2eb9b4d079fb6cae76d5..dd655668cfe32e2fa3669cf7d5cd3c33ead460d9 100644 (file)
@@ -14,8 +14,8 @@ create table messages (
 -- 
 create table refs (
        id integer primary key autoincrement,
-       srcid integer references messages ( id ),
-       dstid integer references messages ( id )
+       parentid integer references messages ( id ),
+       childid integer references messages ( id )
 );
 
 create table bugs ( 
diff --git a/injectbugs.pl b/injectbugs.pl
new file mode 100755 (executable)
index 0000000..1905922
--- /dev/null
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use DBI;
+use Bugs::Message;
+
+our ($dbh, $m, $msgid, $sth, $bugid);
+
+$dbh = DBI->connect("dbi:SQLite:dbname=/tmp/bugs.sqlite","","");
+$dbh->{AutoCommit} = 1;
+
+$msgid = qw(<6035A0D088A63A46850C3988ED045A4B299F74F8@BITCOM1.int.sbss.com.au>);
+
+print $msgid . "\n";
+$m = Bugs::Message->lookup_msgid($dbh, $msgid);
+print "Subject: ". $m->{subject} . "\n";
+
+$sth = $dbh->prepare(q{INSERT INTO bugs (title) VALUES (?)});
+$sth->execute($m->{subject});
+$bugid = $dbh->sqlite_last_insert_rowid();
+
+$sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"true")});
+$sth->execute($bugid, $m->{id});
+
+#####################
+
+$sth = $dbh->prepare(q{INSERT INTO bugs (title) VALUES (?)});
+$sth->execute("Time skew problems");
+$bugid = $dbh->sqlite_last_insert_rowid();
+
+foreach $msgid (qw(<20120608141857.GG11695@bitfolk.com>
+                   <CAE17a0UQocJjZc38c2805uYvdwR7e447UGH9ywcxMw1Ge3imfg@mail.gmail.com>
+                   <CCA4983E.4FEA0%keir@xen.org> ) ) {
+    print $msgid . "\n";
+    $m = Bugs::Message->lookup_msgid($dbh, $msgid);
+    print "Subject: ". $m->{subject} . "\n";
+
+    $sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"true")});
+    $sth->execute($bugid, $m->{id});
+};
+
+
+#######################
+
+$sth = $dbh->prepare(q{INSERT INTO bugs (title) VALUES (?)});
+$sth->execute("PV spinlock lockups under postgresql");
+$bugid = $dbh->sqlite_last_insert_rowid();
+
+foreach $msgid (qw(<1350479456-4007-1-git-send-email-stefan.bader@canonical.com>) ) {
+    print $msgid . "\n";
+    $m = Bugs::Message->lookup_msgid($dbh, $msgid);
+    print "Subject: ". $m->{subject} . "\n";
+
+    $sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"true")});
+    $sth->execute($bugid, $m->{id});
+};
+
+########################
+
+$sth = $dbh->prepare(q{INSERT INTO bugs (title) VALUES (?)});
+$sth->execute("Kernel BUG() on PV domU boot");
+$bugid = $dbh->sqlite_last_insert_rowid();
+
+foreach $msgid (qw(<4FE46366.8010104@invisiblethingslab.com>) ) {
+    print $msgid . "\n";
+    $m = Bugs::Message->lookup_msgid($dbh, $msgid);
+    print "Subject: ". $m->{subject} . "\n";
+
+    $sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"true")});
+    $sth->execute($bugid, $m->{id});
+};
+
+foreach $msgid (qw(<4FE46ABE.9010104@invisiblethingslab.com>) ) {
+    print $msgid . "\n";
+    $m = Bugs::Message->lookup_msgid($dbh, $msgid);
+    print "Subject: ". $m->{subject} . "\n";
+
+    $sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"false")});
+    $sth->execute($bugid, $m->{id});
+};
+
diff --git a/insertbugs.pl b/insertbugs.pl
deleted file mode 100755 (executable)
index 339da85..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl
-
-use warnings;
-use strict;
-
-use DBI;
-use Bugs::Message;
-
-our $dbh = DBI->connect("dbi:SQLite:dbname=/tmp/bugs.sqlite","","");
-$dbh->{AutoCommit} = 1;
-
-for our $msgid ( qw(<6035A0D088A63A46850C3988ED045A4B299F74F8@BITCOM1.int.sbss.com.au>) ) {
-    print $msgid . "\n";
-    our $m = Bugs::Message->lookup_msgid($dbh, $msgid);
-    print "Subject: ". $m->{subject} . "\n";
-
-    our $sth = $dbh->prepare(q{INSERT INTO bugs (title) VALUES (?)});
-    $sth->execute($m->{subject});
-    my $id = $dbh->sqlite_last_insert_rowid();
-
-    $sth = $dbh->prepare(q{INSERT INTO bug2message (bugid, messageid, include) VALUES (?,?,"true")});
-    $sth->execute($id, $m->{id});
-}