]> git.donarmstrong.com Git - debbugs.git/blobdiff - bin/debbugs-loadsql
if the upload date is not defined, update it
[debbugs.git] / bin / debbugs-loadsql
index a7a90b986382d72bb5729152dfce4343652283a4..b1140794d08177390d60882b2527b2a1ec7a3e8f 100755 (executable)
@@ -147,6 +147,8 @@ my %subcommands =
                       },
      'configuration' => {function => \&add_configuration,
                         },
+     'suites' => {function => \&add_suites,
+                 },
      'logs' => {function => \&add_logs,
                },
      'help' => {function => sub {pod2usage({verbose => 2});}}
@@ -321,8 +323,19 @@ sub add_debinfo {
                 ($binarch) = $file =~ /_([^\.]+)\.debinfo/;
             }
             my $sp = $s->resultset('SrcPkg')->find_or_create({pkg => $srcname});
+            # update the creation date if the data we have is earlier
+            my $ct_date = DateTime->from_epoch(epoch => $f_stat->ctime);
+            if ($ct_date < $sp->creation) {
+                $sp->creation($ct_date);
+                $sp->last_modified(DateTime->now);
+                $sp->update;
+            }
             my $sv = $s->resultset('SrcVer')->find_or_create({src_pkg =>$sp->id(),
                                                               ver => $srcver});
+            if (not defined $sv->upload_date() or $ct_date < $sv->upload_date()) {
+                $sv->upload_date($ct_date);
+                $sv->update;
+            }
             my $arch;
             if (defined $arch{$binarch}) {
                 $arch = $arch{$binarch};
@@ -389,6 +402,40 @@ sub add_maintainers {
 
 sub add_configuration {
     my ($options,$opts,$p,$config,$argv) = @_;
+
+    my $s = db_connect($options);
+
+    # tags
+    # add all tags
+    # mark obsolete tags
+
+    # severities
+    my %sev_names;
+    my $order = 0;
+    for my $sev_name (@{$config{severities}}) {
+        # add all severitites
+        my $sev = $s->resultset('Severity')->find_or_create({severity => $sev_name});
+        # mark strong severities
+        if (grep {$_ eq $sev_name} @{$config{strong_severities}}) {
+            $sev->strong(1);
+        }
+        $sev->order($order);
+        $sev->update();
+        $order++;
+        $sev_names{$sev_name} = 1;
+    }
+    # mark obsolete severities
+    for my $sev ($s->resultset('Severity')->find()) {
+        next if exists $sev_names{$sev->severity()};
+        $sev->obsolete(1);
+        $sev->update();
+    }
+}
+
+sub add_suite {
+    my ($options,$opts,$p,$config,$argv) = @_;
+    # suites
+    die "add_suite is currently not implemented; modify suites manually using SQL."
 }
 
 sub add_logs {
@@ -424,6 +471,9 @@ sub add_logs {
                       die "failure while trying to load bug log $bug\n$@";
                   }
               });
+}
+
+sub add_packages {
 
 }