},
queue => {type => HASHREF,
optional => 1},
+ packages => {type => HASHREF,
+ default => sub {return {}},
+ optional => 1,
+ },
});
my $s = $param{db};
if (not exists $param{data} and not exists $param{bug}) {
$queue = {};
}
my %tags;
- my $s_data = split_status_fields($data);
- for my $tag (make_list($s_data->{keywords})) {
+ $data = split_status_fields($data);
+ for my $tag (make_list($data->{keywords})) {
next unless defined $tag and length $tag;
# this allows for invalid tags. But we'll use this to try to
# find those bugs and clean them up
submitter => 'originator',
);
for my $addr_type (keys %addr_map) {
+ $bug->{$addr_type} = undef;
+ next unless defined $data->{$addr_map{$addr_type}} and
+ length($data->{$addr_map{$addr_type}});
$bug->{$addr_type} =
$s->resultset('Correspondent')->
get_correspondent_id($data->{$addr_map{$addr_type}})
}
my $b = $s->resultset('Bug')->update_or_create($bug) or
die "Unable to update or create bug $bug->{id}";
- $s->txn_do(sub {
- for my $ff (qw(found fixed)) {
+ $s->txn_do(sub {
+ $b->set_related_packages('binpackages',
+ [grep {defined $_ and
+ length $_ and $_ !~ /^src:/}
+ make_list($data->{package})],
+ $param{packages},
+ );
+ $b->set_related_packages('srcpackages',
+ [grep {defined $_ and
+ $_ =~ /^src:/}
+ make_list($data->{package})],
+ $param{packages},
+ );
+ $b->set_related_packages('affects_binpackages',
+ [grep {defined $_ and
+ length $_ and $_ !~ /^src:/}
+ make_list($data->{affects})
+ ],
+ $param{packages},
+ );
+ $b->set_related_packages('affects_srcpackages',
+ [grep {defined $_ and
+ $_ =~ /^src:/}
+ make_list($data->{affects})],
+ $param{packages},
+ );
+ for my $ff (qw(found fixed)) {
my @elements = $s->resultset('BugVer')->search({bug => $data->{bug_num},
found => $ff eq 'found'?1:0,
});
=back
-=head Packages
+=head2 Packages
=over
}
# remove associations for packages not in this suite
if (@sa_to_del) {
- $schema->resultset('SrcAssociation')->
- search_rs({id => \@sa_to_del})->delete();
+ $it = natatime 1000, @sa_to_del;
+ while (my @v = $it->()) {
+ $schema->
+ txn_do(sub {
+ $schema->resultset('SrcAssociation')->
+ search_rs({id => \@v})->
+ delete();
+ });
+ }
}
# update packages in this suite to have a modification time of now
$schema->resultset('SrcAssociation')->
scalar @v) if defined $p;
}
if (@bin_to_del) {
- $schema->resultset('BinAssociation')->
- search_rs({id => \@bin_to_del})->delete();
+ $it = natatime 1000, @bin_to_del;
+ while (my @v = $it->()) {
+ $schema->
+ txn_do(sub {
+ $schema->resultset('BinAssociation')->
+ search_rs({id => \@v})->
+ delete();
+ });
+ }
}
$schema->resultset('BinAssociation')->
search_rs({suite => $suite_id})->
=cut
-=head Suites
+=head2 Suites
=over
__END__
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End: