X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fdebbugs-updatesqlcache;h=9422adfdab945a71e972b3033303a0f9941b99d8;hb=1aa5061f8033c49525c7a2d424c43900cee19771;hp=b2838463e5c0bb50dffd864171072e1a3b86964a;hpb=06a4071fd4b0ea3902310bebffcbbdba6651a165;p=debbugs.git diff --git a/bin/debbugs-updatesqlcache b/bin/debbugs-updatesqlcache index b283846..9422adf 100755 --- a/bin/debbugs-updatesqlcache +++ b/bin/debbugs-updatesqlcache @@ -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); +use List::AllUtils qw(natatime uniq); use POSIX qw(ceil); my %options = @@ -107,7 +107,7 @@ my %options = quiet => 0, quick => 0, archived => 0, - service => $config{debbugs_db}, + service => $config{database}, progress => 0, ); @@ -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}, }, @@ -236,7 +251,7 @@ sub update_cache { )->all(); # or a source association modified push @bugs, - map {$_->{'bug_srcpackages.bug'}} + map {$_->{bug_srcpackages}{bug}} $s->resultset('SrcAssociation')-> search_rs({'me.modified' => {'>=',$last_query_time}, },