]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/DB/Load.pm
fix POD failures in DB::Load
[debbugs.git] / Debbugs / DB / Load.pm
index bad48b5e6a2971791275a8925e61d6bf8e11e032..6f300f96f6690c07beb4764cb4c311141f181607 100644 (file)
@@ -101,6 +101,10 @@ sub load_bug {
                                                      },
                                        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}) {
@@ -119,8 +123,8 @@ sub load_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
@@ -162,14 +166,42 @@ sub load_bug {
          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,
                                                                      });
@@ -425,7 +457,7 @@ sub load_debinfo {
 
 =back
 
-=head Packages
+=head2 Packages
 
 =over
 
@@ -617,7 +649,7 @@ sub load_packages {
 
 =cut
 
-=head Suites
+=head2 Suites
 
 =over