]> git.donarmstrong.com Git - debbugs.git/blobdiff - bin/debbugs-updatesqlcache
allow specifying the dist in source_to_binary (for DB actions)
[debbugs.git] / bin / debbugs-updatesqlcache
index 743e5fcef1d243874e96c0c7781193949f94716b..b361b258facc3768e56fc3bd4cd5896508294973 100755 (executable)
@@ -96,7 +96,7 @@ use Debbugs::Status qw(bug_presence read_bug);
 use Debbugs::DB;
 use DateTime;
 use File::stat;
-use List::MoreUtils qw(natatime uniq);
+use List::AllUtils qw(natatime uniq);
 use POSIX qw(ceil);
 
 my %options =
@@ -131,6 +131,8 @@ $DEBUG = $options{debug};
 
 my %subcommands =
     ('update' => {function => \&update_cache,
+                 arguments => {'suites|suite=s@' => 0,
+                              },
                },
      'help' => {function => sub {pod2usage({verbose => 2});}}
     );
@@ -193,12 +195,25 @@ sub update_cache {
     # get all of the possible architectures that we might care about
     # select distinct s.codename,a.arch from bin_associations ba join bin_ver bv on ba.bin=bv.id join suite s on ba.suite=s.id join arch a on bv.arch=a.id;
 
-    my @suites =
-       $s->resultset('Suite')->
-       search_rs({active => 1,
-                 },
-                {result_class => 'DBIx::Class::ResultClass::HashRefInflator'}
-                )->all();
+    my @suites;
+    if (exists $opts->{suites}) {
+       @suites =
+           $s->resultset('Suite')->
+           search_rs({active => 1,
+                      -or => {codename => [make_list($opts->{suites})],
+                              suite_name => [make_list($opts->{suites})],
+                             },
+                     },
+                    {result_class => 'DBIx::Class::ResultClass::HashRefInflator'}
+                    )->all();
+     } else {
+       @suites = 
+           $s->resultset('Suite')->
+           search_rs({active => 1,
+                     },
+                    {result_class => 'DBIx::Class::ResultClass::HashRefInflator'}
+                    )->all();
+    }
     my @bugs;
     my $bugs;
     if ($options->{quick}) {
@@ -222,7 +237,7 @@ sub update_cache {
        # select all bugs which are in packages which have had a binary
        # association modified
        push @bugs,
-           map {$_->{bug_binpackages}{bug}}}
+           map {$_->{bug_binpackages}{bug}}
            $s->resultset('BinAssociation')->
            search_rs({'me.modified' => {'>=',$last_query_time},
                      },