]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Add make_list utility function to Debbugs::Common
authorDon Armstrong <don@archimedes>
Sat, 10 Mar 2007 03:12:24 +0000 (19:12 -0800)
committerDon Armstrong <don@archimedes>
Sat, 10 Mar 2007 03:12:24 +0000 (19:12 -0800)
 * Support taking an arrayref for dist and arch in get_bug_status
 * Fix small error in the single message "view rfc822" link

Debbugs/Common.pm
Debbugs/Status.pm
cgi/bugreport.cgi

index 86f9abc8344599c8180920d2fd2291b07b598942..7a06f88ff2fc879c6f09f8ec815be00efbca9244 100644 (file)
@@ -34,11 +34,12 @@ BEGIN{
                                qw(appendfile buglog getparsedaddrs getmaintainers),
                                qw(getmaintainers_reverse)
                               ],
+                    misc   => [qw(make_list)],
                     quit   => [qw(quit)],
                     lock   => [qw(filelock unfilelock @cleanups)],
                    );
      @EXPORT_OK = ();
-     Exporter::export_ok_tags(qw(lock quit util));
+     Exporter::export_ok_tags(qw(lock quit util misc));
      $EXPORT_TAGS{all} = [@EXPORT_OK];
 }
 
@@ -329,6 +330,25 @@ sub quit {
     die "*** $_[0]\n";
 }
 
+=head1 MISC
+
+These functions are exported with the :misc tag
+
+=head2 make_list
+
+     LIST = make_list(@_);
+
+Turns a scalar or an arrayref into a list; expands a list of arrayrefs
+into a list.
+
+That is, make_list([qw(a b c)]); returns qw(a b c); make_list([qw(a
+b)],[qw(c d)] returns qw(a b c d);
+
+=cut
+
+sub make_list {
+     return map {(ref($_) eq 'ARRAY')?@{$_}:$_} @_;
+}
 
 
 
index d8afb573f456e3dec8ea706d81ece2702ec7e645..605d2e1fce7a67df9cb6c6055639cdb67cd85818 100644 (file)
@@ -28,7 +28,7 @@ use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT);
 use base qw(Exporter);
 
 use Params::Validate qw(validate_with :types);
-use Debbugs::Common qw(:util :lock :quit);
+use Debbugs::Common qw(:util :lock :quit :misc);
 use Debbugs::Config qw(:config);
 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
 use Debbugs::Packages qw(makesourceversions getversions binarytosource);
@@ -650,11 +650,11 @@ sub bug_archiveable{
 =item bug_index -- optional tied index of bug status infomration;
 currently not correctly implemented.
 
-=item version -- optional version to check package status at
+=item version -- optional version(s) to check package status at
 
-=item dist -- optional distribution to check package status at
+=item dist -- optional distribution(s) to check package status at
 
-=item arch -- optional architecture to check package status at
+=item arch -- optional architecture(s) to check package status at
 
 =item usertags -- optional hashref of usertags
 
@@ -683,13 +683,13 @@ sub get_bug_status {
                                          bug_index => {type => OBJECT,
                                                        optional => 1,
                                                       },
-                                         version   => {type => SCALAR,
+                                         version   => {type => SCALAR|ARRAYREF,
                                                        optional => 1,
                                                       },
-                                         dist       => {type => SCALAR,
+                                         dist       => {type => SCALAR|ARRAYREF,
                                                         optional => 1,
                                                        },
-                                         arch       => {type => SCALAR,
+                                         arch       => {type => SCALAR|ARRAYREF,
                                                         optional => 1,
                                                        },
                                          usertags   => {type => HASHREF,
@@ -796,13 +796,13 @@ sub bug_presence {
                                          status    => {type => HASHREF,
                                                        optional => 1,
                                                       },
-                                         version   => {type => SCALAR,
+                                         version   => {type => SCALAR|ARRAYREF,
                                                        optional => 1,
                                                       },
-                                         dist       => {type => SCALAR,
+                                         dist       => {type => SCALAR|ARRAYREF,
                                                         optional => 1,
                                                        },
-                                         arch       => {type => SCALAR,
+                                         arch       => {type => SCALAR|ARRAYREF,
                                                         optional => 1,
                                                        },
                                          sourceversions => {type => ARRAYREF,
@@ -822,18 +822,32 @@ sub bug_presence {
 
      my @sourceversions;
      if (not exists $param{sourceversions}) {
-         my @versions;
+         my %sourceversions;
          if (defined $param{version}) {
-              @versions = ($param{version});
+              foreach my $arch (make_list($param{arch})) {
+                   my @temp = makesourceversions($status{package},
+                                                 $arch,
+                                                 make_list($param{version})
+                                                );
+                   @sourceversions{@temp} = (1) x @temp;
+              }
          } elsif (defined $param{dist}) {
-              @versions = getversions($status{package}, $param{dist}, $param{arch});
+              foreach my $arch (make_list($param{arch})) {
+                   my @versions;
+                   foreach my $dist (make_list($param{dist})) {
+                        push @versions, getversions($status{package}, $dist, $arch);
+                   }
+                   my @temp = makesourceversions($status{package},
+                                                 $arch,
+                                                 @versions
+                                                );
+                   @sourceversions{@temp} = (1) x @temp;
+              }
          }
 
          # TODO: This should probably be handled further out for efficiency and
          # for more ease of distinguishing between pkg= and src= queries.
-         @sourceversions = makesourceversions($status{package},
-                                              $param{arch},
-                                              @versions);
+         @sourceversions = keys %sourceversions;
      }
      else {
          @sourceversions = @{$param{sourceversions}};
index 0d8e31e56cde45dcae4aa2f73784bfc1e6ad8699..88e251f14a6ec11700aa5bc4aec5af070a3c33ba 100755 (executable)
@@ -445,8 +445,8 @@ sub handle_record{
          elsif (defined $msg_id) {
               $$seen_msg_ids{$msg_id} = 1;
          }
-         $output .= qq(<hr><a name="$msg_number"></a>\n);
-         $output .= 'View this message in <a href="' . bug_url($ref, "msg=$msg_number", "mbox") . '">rfc822 format</a>';
+         $output .= qq(<hr><p class="msgreceived"><a name="$msg_number"></a>\n);
+         $output .= 'View this message in <a href="' . bug_url($ref, msg=>$msg_number, mbox=>'yes') . '">rfc822 format</a></p>';
          $output .= handle_email_message($record->{text},
                                    ref        => $bug_number,
                                    msg_number => $msg_number,