]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge changes from dla source tree
authorDebian BTS <debbugs@busoni>
Tue, 4 May 2010 20:52:38 +0000 (20:52 +0000)
committerDebian BTS <debbugs@busoni>
Tue, 4 May 2010 20:52:38 +0000 (20:52 +0000)
Debbugs/CGI/Pkgreport.pm
Debbugs/Common.pm
Debbugs/Control.pm
Debbugs/Packages.pm
debian/changelog
scripts/service
t/07_control_limit.t

index e87125c0ca4b247f5c37a73de2cea0df722cc53f..8c217d7e1271c367b6e171d9776470b6540a8a2a 100644 (file)
@@ -224,7 +224,7 @@ sub short_bug_status_html {
      if (@blockedby && $status{"pending"} ne 'fixed' && ! length($status{done})) {
          for my $b (@blockedby) {
               my %s = %{get_bug_status($b)};
-              next if $s{"pending"} eq 'fixed' || length $s{done};
+              next if (defined $s{pending} and $s{pending} eq 'fixed') or (defined $s{done} and length $s{done});
               push @{$status{blockedby_array}},{bug_num => $b, subject => $s{subject}, status => \%s};
          }
      }
index 9760912a6445e1a2e0c848e7b0509cab790e0c0e..ef1b8bbe96cb75e746ed00be5fd52b0b620a97f1 100644 (file)
@@ -44,6 +44,7 @@ BEGIN{
                                qw(getmaintainers_reverse),
                                qw(getpseudodesc),
                                qw(package_maintainer),
+                               qw(sort_versions),
                               ],
                     misc   => [qw(make_list globify_scalar english_join checkpid),
                                qw(cleanup_eval_fail),
@@ -446,6 +447,33 @@ sub getpseudodesc {
     return $_pseudodesc;
 }
 
+=head2 sort_versions
+
+     sort_versions('1.0-2','1.1-2');
+
+Sorts versions using AptPkg::Versions::compare if it is available, or
+Debbugs::Versions::Dpkg::vercmp if it isn't.
+
+=cut
+
+our $vercmp;
+BEGIN{
+    use Debbugs::Versions::Dpkg;
+    $vercmp=\&Debbugs::Versions::Dpkg::vercmp;
+
+# eventually we'll use AptPkg:::Version or similar, but the current
+# implementation makes this *super* difficult.
+
+#     eval {
+#      use AptPkg::Version;
+#      $vercmp=\&AptPkg::Version::compare;
+#     };
+}
+
+sub sort_versions{
+    return sort {$vercmp->($a,$b)} @_;
+}
+
 
 =head1 DATE
 
index d994170bb0f24fa6c5f72cd525ebb505556f64a2..4ec2a101ae878272f90646d489acbfeb5e7ecd15 100644 (file)
@@ -106,7 +106,7 @@ BEGIN{
 }
 
 use Debbugs::Config qw(:config);
-use Debbugs::Common qw(:lock buglog :misc get_hashname);
+use Debbugs::Common qw(:lock buglog :misc get_hashname sort_versions);
 use Debbugs::Status qw(bug_archiveable :read :hook writebug splitpackages split_status_fields get_bug_status);
 use Debbugs::CGI qw(html_escape);
 use Debbugs::Log qw(:misc);
@@ -1422,11 +1422,11 @@ sub set_found {
                # We only care about reopening the bug if the bug is
                # not done
                if (defined $data->{done} and length $data->{done}) {
-                   my @svers_order = sort {Debbugs::Versions::Dpkg::vercmp($a,$b);}
-                       map {m{([^/]+)$}; $1;} @svers;
+                   my @svers_order = sort_versions(map {m{([^/]+)$}; $1;}
+                                                   @svers);
                    # determine if we need to reopen
-                   my @fixed_order = sort {Debbugs::Versions::Dpkg::vercmp($a,$b);}
-                       map {m{([^/]+)$}; $1;} keys %fixed_versions;
+                   my @fixed_order = sort_versions(map {m{([^/]+)$}; $1;}
+                                                   keys %fixed_versions);
                    if (not @fixed_order or
                        (Debbugs::Versions::Dpkg::vercmp($svers_order[-1],$fixed_order[-1]) >= 0)) {
                        $reopened = 1;
index b4b5ef7411fa18e821a4c5244a2a246506e1249d..5c4d22367d78a7eb66f0156109b9d54969fe0478 100644 (file)
@@ -37,7 +37,7 @@ use Fcntl qw(O_RDONLY);
 use MLDBM qw(DB_File Storable);
 use Storable qw(dclone);
 use Params::Validate qw(validate_with :types);
-use Debbugs::Common qw(make_list globify_scalar);
+use Debbugs::Common qw(make_list globify_scalar sort_versions);
 
 use List::Util qw(min max);
 
@@ -393,6 +393,11 @@ may change in the future, so if you care, please code accordingly.)
 =item return_archs -- returns a version=>[archs] hash indicating which
 architectures are at which versions.
 
+=item largest_source_version_only -- if there is more than one source
+version in a particular distribution, discards all versions but the
+largest in that distribution. Defaults to 1, as this used to be the
+way that the Debian archive worked.
+
 =back
 
 When called in scalar context, this function will return hashrefs or
@@ -426,6 +431,9 @@ sub get_versions{
                                           return_archs => {type => BOOLEAN,
                                                            default => 0,
                                                           },
+                                          largest_source_version_only => {type => BOOLEAN,
+                                                                      default => 1,
+                                                                         },
                                          },
                               );
      my $versions;
@@ -460,10 +468,16 @@ sub get_versions{
                                        $_ ne 'source'
                                    } $source_only?'source':keys %{$version->{$dist}})) {
                    next unless defined $version->{$dist}{$arch};
-                   for my $ver (ref $version->{$dist}{$arch} ?
-                                keys %{$version->{$dist}{$arch}} :
-                                $version->{$dist}{$arch}
-                               ) {
+                   my @vers = ref $version->{$dist}{$arch} eq 'HASH' ?
+                       keys %{$version->{$dist}{$arch}} :
+                           make_list($version->{$dist}{$arch});
+                   if ($param{largest_source_version_only} and
+                       $arch eq 'source' and @vers > 1) {
+                       # order the versions, then pick the biggest version number
+                       @vers = sort_versions(@vers);
+                       @vers = $vers[-1];
+                   }
+                   for my $ver (@vers) {
                         my $f_ver = $ver;
                         if ($param{source}) {
                              ($f_ver) = make_source_versions(package => $package,
index 6e0d97a3be56651cedfd4a17bc8202ba375e62ba..c32e56512866facbdfe26c71109c8902bfd0fb10 100644 (file)
@@ -25,6 +25,8 @@ debbugs (2.4.2~exp1) experimental; urgency=low
   * Fix noaffects option
   * Allow the default sendmail options to be specified in the config file;
     don't use -obq by default anymore.
+  * Add urls to control@ mail footer (Closes: #578822). Thanks to Lars
+    Wirzenius
 
  -- Don Armstrong <don@debian.org>  Wed, 26 Aug 2009 21:32:53 -0700
 
index 0abe271d383d2c8fad0eb96eafb224220601287d..89ff785c4152234c72c62f02fb30ac9e17a755c1 100755 (executable)
@@ -1301,13 +1301,12 @@ References: $header{'message-id'}
 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
 Precedence: bulk
 ${packagepr}X-$gProject-PR-Message: transcript
-
-${transcript_scalar}Please contact me if you need assistance.
-
-$gMaintainer
-(administrator, $gProject $gBugs database)
 END
 
+$reply .= fill_template('mail/message_body',
+                         {body => "${transcript_scalar}Please contact me if you need assistance."},
+                       );
+
 my $repliedshow= join(', ',$replyto,
                      determine_recipients(recipients => \%recipients,
                                           cc => 1,
@@ -1354,12 +1353,15 @@ sub fill_template{
      my $variables = {config => \%config,
                      defined($ref)?(ref    => $ref):(),
                      defined($data)?(data  => $data):(),
+                     refs => [keys %bug_affected],
                      %{$extra_var},
                     };
      my $hole_var = {'&bugurl' =>
                     sub{"$_[0]: ".
                              'http://'.$config{cgi_domain}.'/'.
-                                  Debbugs::CGI::bug_url($_[0]);
+                                  Debbugs::CGI::bug_links(bug=>$_[0],
+                                                          links_only => 1,
+                                                         );
                    }
                    };
      return fill_in_template(template => $template,
index 630cc8d68b060b83b69c2287eed082a6989c5918..f4f600ba5409f64af63d562b3d7532f2f349c959 100644 (file)
@@ -1,6 +1,6 @@
 # -*- mode: cperl; -*-
 
-use Test::More tests => 4;
+use Test::More tests => 8;
 
 use warnings;
 use strict;
@@ -102,3 +102,58 @@ $SD_SIZE =
 ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with limit_package_foo")) == 0,
    'control@bugs.something'. "limit message succeeded with no errors");
 
+send_message(to=>'submit@bugs.something',
+            headers => [To   => 'submit@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => 'Submiting a bug',
+                       ],
+            body => <<EOF) or fail('Unable to send message');
+Package: foo, bar
+Severity: normal
+
+This is a silly bug
+EOF
+$SD_SIZE = dirsize($sendmail_dir);
+
+
+send_message(to => 'control@bugs.something',
+            headers => [To   => 'control@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => "Munging a bug with limit_package_bar",
+                       ],
+            body => <<EOF) or fail 'message to control@bugs.something failed';
+debug 10
+limit package baz
+severity 2 wishlist
+thanks
+EOF
+
+$SD_SIZE =
+    num_messages_sent($SD_SIZE,1,
+                          $sendmail_dir,
+                     'control@bugs.something messages appear to have been sent out properly');
+
+# make sure this fails
+ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0,
+   'control@bugs.something'. "limit message failed with 1 error");
+
+send_message(to => 'control@bugs.something',
+            headers => [To   => 'control@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => "Munging a bug with limit_package_foo",
+                       ],
+            body => <<EOF) or fail 'message to control@bugs.something failed';
+debug 10
+limit package foo
+severity 2 wishlist
+thanks
+EOF
+
+$SD_SIZE =
+    num_messages_sent($SD_SIZE,1,
+                          $sendmail_dir,
+                     'control@bugs.something messages appear to have been sent out properly');
+
+# make sure this fails
+ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with limit_package_foo")) == 0,
+   'control@bugs.something'. "limit message succeeded with no errors");