]> git.donarmstrong.com Git - debbugs.git/blobdiff - bin/debbugs-loadsql
allow providing a directory of debinfo files to loadsql
[debbugs.git] / bin / debbugs-loadsql
index f452431d3bc8b34dc01f53dcd91dc1e8cc2029de..b718a05961c862565059a4c7d5c9e7efcd9ac924 100755 (executable)
@@ -142,6 +142,7 @@ use DateTime;
 use File::stat;
 use File::Basename;
 use File::Spec;
+use File::Find;
 use IO::Dir;
 use IO::File;
 use IO::Uncompress::AnyUncompress;
@@ -163,6 +164,7 @@ Getopt::Long::Configure('pass_through');
 GetOptions(\%options,
            'quick|q',
            'service|s=s',
+          'dsn=s',
            'sysconfdir|c=s',
            'progress!',
            'spool_dir|spool-dir=s',
@@ -183,7 +185,9 @@ my %subcommands =
      'versions' => {function => \&add_versions,
                    },
      'debinfo' => {function => \&add_debinfo,
-                   arguments => {'0|null' => 0},
+                   arguments => {'0|null' => 0,
+                                'debinfo_dir|debinfo-dir=s' => 0,
+                               },
                   },
      'maintainers' => {function => \&add_maintainers,
                       },
@@ -267,8 +271,6 @@ sub add_bugs {
     my $s = db_connect($options);
 
 
-    my $time = 0;
-    my $start_time = time;
     my %tags;
     my %severities;
     my %queue;
@@ -370,6 +372,15 @@ sub add_debinfo {
     my ($options,$opts,$p,$config,$argv) = @_;
 
     my @files = @{$argv};
+    if (exists $opts->{debinfo_dir} and not @files) {
+       find(sub {
+                if (-f $_ and /\.debinfo$/) {
+                    push @files, $File::Find::name;
+                }
+            },
+            $opts->{debinfo_dir}
+           );
+    }
     if (not @files) {
        {
           local $/ = "\n";
@@ -539,10 +550,6 @@ sub add_logs {
     }
     my $s = db_connect($options);
 
-
-    my $time = 0;
-    my $start_time = time;
-
     walk_bugs([(@{$argv}?@{$argv} : $initialdir)],
               $p,
               'log',
@@ -752,7 +759,8 @@ sub db_connect {
     my ($options) = @_;
     # connect to the database; figure out how to handle errors
     # properly here.
-    my $s = Debbugs::DB->connect($options->{service}) or
+    my $s = Debbugs::DB->connect($options->{dsn} //
+                                $options->{service}) or
         die "Unable to connect to database: ";
 }