Package name if the package is not known
+=head2 unknown_affects
+
+ data_type: 'text'
+ default_value: (empty string)
+ is_nullable: 0
+
+Package name if the affected package is not known
+
=cut
__PACKAGE__->add_columns(
{ data_type => "text", default_value => "", is_nullable => 0 },
"unknown_packages",
{ data_type => "text", default_value => "", is_nullable => 0 },
+ "unknown_affects",
+ { data_type => "text", default_value => "", is_nullable => 0 },
);
=head1 PRIMARY KEY
);
-# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-09-24 14:51:07
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iaipVETTaokcFNrICfIEAw
+# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-04-11 13:06:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qxkLXbv8JGoV9reebbOUEw
use Carp;
-use List::MoreUtils qw(uniq);
+use List::AllUtils qw(uniq);
__PACKAGE__->many_to_many(tags => 'bug_tags','tag');
__PACKAGE__->many_to_many(user_tags => 'bug_user_tags','user_tag');
}
}
+=head1 Utility Functions
+
+=cut
+
+=head2 set_related_packages
+
+ $b->set_related_packages($relationship,
+ \@packages,
+ $package_cache ,
+ );
+
+Set bug-related packages.
+
+=cut
+
sub set_related_packages {
my ($self,$relationship,$pkgs,$pkg_cache) = @_;
+ my @unset_packages;
my @pkg_ids;
if ($relationship =~ /binpackages/) {
for my $pkg (@{$pkgs}) {
- push @pkg_ids,
+ my $pkg_id =
$self->result_source->schema->resultset('BinPkg')->
get_bin_pkg_id($pkg);
+ if (not defined $pkg_id) {
+ push @unset_packages,$pkg;
+ } else {
+ push @pkg_ids, $pkg_id;
+ }
}
} elsif ($relationship =~ /srcpackages/) {
for my $pkg (@{$pkgs}) {
- push @pkg_ids,
+ my $pkg_id =
$self->result_source->schema->resultset('SrcPkg')->
get_src_pkg_id($pkg);
+ if (not defined $pkg_id) {
+ push @unset_packages,$pkg;
+ } else {
+ push @pkg_ids,$pkg_id;
+ }
}
} else {
croak "Unsupported relationship $relationship";
} else {
croak "Unsupported relationship $relationship";
}
+ return @unset_packages
}
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;