Author: neronus-guest
Date: 2008-07-27 12:53:57 +0000 (Sun, 27 Jul 2008)
New Revision: 945

Modified:
   udd/src/setup-db.sql
   udd/src/test.yaml
   udd/src/udd/bugs_gatherer.pl
Log:
Added possibility to import archived bugs
renamed bugs.affects_testings to bugs.affects_testing


Modified: udd/src/setup-db.sql
===================================================================
--- udd/src/setup-db.sql        2008-07-27 12:02:38 UTC (rev 944)
+++ udd/src/setup-db.sql        2008-07-27 12:53:57 UTC (rev 945)
@@ -28,7 +28,7 @@
   (id int, package text, source text, arrival timestamp, status text,
      severity text, tags text, submitter text, owner text, title text,
      last_modified timestamp, affects_stable boolean,
-    affects_testings boolean, affects_unstable boolean, UNIQUE (id));
+    affects_testing boolean, affects_unstable boolean, UNIQUE (id), 
is_archived boolean);
 
 CREATE TABLE bug_merged_with
   (bug int, merged_with int);

Modified: udd/src/test.yaml
===================================================================
--- udd/src/test.yaml   2008-07-27 12:02:38 UTC (rev 944)
+++ udd/src/test.yaml   2008-07-27 12:53:57 UTC (rev 945)
@@ -135,8 +135,15 @@
 upload-history:
   type: upload-history
   path: /tmp/upload-history
-  update-command: if [ ! -e /tmp/upload-history/ ]; then mkdir 
/tmp/upload-history/; fi; rm -rf /tmp/upload-history/*; wget -r --no-parent -nd 
-A debian-devel-* -P /tmp/upload-history http://qa.debian.org/~filippo/ddc/
+  #update-command: if [ ! -e /tmp/upload-history/ ]; then mkdir 
/tmp/upload-history/; fi; rm -rf /tmp/upload-history/*; wget -r --no-parent -nd 
-A debian-devel-* -P /tmp/upload-history http://qa.debian.org/~filippo/ddc/
+  update-command: if [ ! -e /tmp/upload-history/ ]; then mkdir 
/tmp/upload-history/; fi; rm -rf /tmp/upload-history/*; wget -r --no-parent -nd 
-A debian-devel-* -P /tmp/upload-history http://giunched.web.cs.unibo.it/nokeys/
 
 bugs:
   type: bugs
+  archived: false
   update-command: /org/udd.debian.org/mirrors/sync-bugs.debian.org
+
+bugs-archive:
+  type: bugs
+  archived: true
+  update-command: /org/udd.debian.org/mirrors/sync-bugs.debian.org

Modified: udd/src/udd/bugs_gatherer.pl
===================================================================
--- udd/src/udd/bugs_gatherer.pl        2008-07-27 12:02:38 UTC (rev 944)
+++ udd/src/udd/bugs_gatherer.pl        2008-07-27 12:53:57 UTC (rev 945)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# Last-Modified: <Sun Jul 27 11:36:21 2008>
+# Last-Modified: <Sun Jul 27 12:50:43 2008>
 
 use strict;
 use warnings;
@@ -38,6 +38,7 @@
 
        my $config = LoadFile($ARGV[0]) or die "Could not load configuration: 
$!";
        my $source = $ARGV[1];
+       my %src_config = %{$config->{$source}};
 
        my $dbname = $config->{general}->{dbname};
        # Connection to DB
@@ -53,21 +54,31 @@
 
        my %binarytosource = ();
 
+       my $location = $src_config{archived} ? 'archive' : 'db_h';
        # Read all bugs
-       foreach my $bug_nr (get_bugs()) {
-               #next unless $bug_nr =~ /0$/;
+       foreach my $bug_nr ($src_config{archived} ? get_bugs(archive => 1) : 
get_bugs()) {
+               next unless $bug_nr =~ /00$/;
                # Fetch bug using Debbugs
                # Yeah, great, why does get_bug_status not accept a location?
-               my %bug = %{get_bug_status(bug => $bug_nr, status => 
read_bug(bug => $bug_nr, location => 'db_h'))};
+               my $bug_ref = read_bug(bug => $bug_nr, location => $location) 
or (print STDERR "Could not read file for bug $bug_nr in $location; skipping\n" 
and next);
+               my %bug = %{get_bug_status(bug => $bug_nr, status => $bug_ref)};
                
                # Convert data where necessary
-               #my $date = strftime("%Y-%m-%d %T", localtime($bug{date}));
-               #my $log_modified = strftime("%Y-%m-%d %T", 
localtime($bug{log_modified}));
                map { $bug{$_} = $dbh->quote($bug{$_}) } qw(subject originator 
owner pending);
                my @found_versions = map { $dbh->quote($_) } 
@{$bug{found_versions}};
                my @fixed_versions = map { $dbh->quote($_) } 
@{$bug{fixed_versions}};
 
+               # log_modified and date are not necessarily set. If they are 
not available, they
+               # are assumed to be epoch (i.e. bug #4170)
+               map {
+                       if($bug{$_}) {
+                               $bug{$_} = "$bug{$_}::abstime";
+                       } else {
+                               $bug{$_} = '0::abstime';
+                       }
+               } qw{date log_modified};
 
+
                if(not exists $binarytosource{$bug{package}}) {
                        $binarytosource{$bug{package}} = 
binarytosource($bug{package});
                }
@@ -110,10 +121,10 @@
 
 
                # Insert data into bugs table
-               my $query = "INSERT INTO bugs VALUES ($bug_nr, '$bug{package}', 
$source, $bug{date}::abstime, \
+               my $query = "INSERT INTO bugs VALUES ($bug_nr, '$bug{package}', 
$source, $bug{date}, \
                             E$bug{pending}, '$bug{severity}', 
'$bug{keywords}', E$bug{originator}, E$bug{owner}, \
-                                        E$bug{subject}, 
$bug{log_modified}::abstime, $present_in_stable,
-                                        $present_in_testing, 
$present_in_unstable)";
+                                        E$bug{subject}, $bug{log_modified}, 
$present_in_stable,
+                                        $present_in_testing, 
$present_in_unstable, " . ($src_config{archived} ? 'True' : 'False') . ")";
                # Execute insertion
                my $sth = $dbh->prepare($query);
                $sth->execute() or die $!;


_______________________________________________
Collab-qa-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/collab-qa-commits

Reply via email to