]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge changes from dla source tree
authorDebian BTS <debbugs@rietz>
Thu, 14 Jun 2007 14:20:17 +0000 (14:20 +0000)
committerDebian BTS <debbugs@rietz>
Thu, 14 Jun 2007 14:20:17 +0000 (14:20 +0000)
Debbugs/Common.pm
Debbugs/Estraier.pm
Debbugs/Mail.pm
Debbugs/Status.pm
cgi/pkgreport.cgi
debian/changelog

index 9776392eef2c7fc307f4fc442a18c233d46a4f15..f88a2f475091a174c8a0d3d8de0591b55e5ba5a2 100644 (file)
@@ -43,11 +43,12 @@ BEGIN{
                                qw(getmaintainers_reverse)
                               ],
                     misc   => [qw(make_list)],
+                    date   => [qw(secs_to_english)],
                     quit   => [qw(quit)],
                     lock   => [qw(filelock unfilelock @cleanups)],
                    );
      @EXPORT_OK = ();
-     Exporter::export_ok_tags(qw(lock quit util misc));
+     Exporter::export_ok_tags(qw(lock quit date util misc));
      $EXPORT_TAGS{all} = [@EXPORT_OK];
 }
 
@@ -239,6 +240,32 @@ sub getmaintainers_reverse{
      return $_maintainer_rev;
 }
 
+=head1 DATE
+
+    my $english = secs_to_english($seconds);
+    my ($days,$english) = secs_to_english($seconds);
+
+XXX This should probably be changed to use Date::Calc
+
+=cut
+
+sub secs_to_english{
+     my ($seconds) = @_;
+
+     my $days = int($seconds / 86400);
+     my $years = int($days / 365);
+     $days %= 365;
+     my $result;
+     my @age;
+     push @age, "1 year" if ($years == 1);
+     push @age, "$years years" if ($years > 1);
+     push @age, "1 day" if ($days == 1);
+     push @age, "$days days" if ($days > 1);
+     $result .= join(" and ", @age);
+
+     return wantarray?(int($seconds/86400),$result):$result;
+}
+
 
 =head1 LOCK
 
index 47457f25871c09ab07c915149b3dd25ddaea649e..f1699263972f587d3ddebe1569bf513b09ed9a9c 100644 (file)
@@ -33,7 +33,7 @@ use Debbugs::Log;
 #use Params::Validate;
 use Search::Estraier;
 use Date::Manip;
-use Debbugs::Common qw(getbuglocation getbugcomponent);
+use Debbugs::Common qw(getbuglocation getbugcomponent make_list);
 use Debbugs::Status qw(readbug);
 use Debbugs::MIME qw(parse);
 
@@ -121,7 +121,7 @@ sub add_bug_message{
      $doc = new Search::Estraier::Document if not defined $doc;
 
      my $message = parse($bug_message);
-     $doc->add_text(join('',values %{$message}));
+     $doc->add_text(join('',make_list(values %{$message})));
 
      # * @id : the ID number determined automatically when the document is registered.
      # * @uri : the location of a document which any document should have.
@@ -140,17 +140,17 @@ sub add_bug_message{
      my @attr = qw(status subject date submitter package tags severity);
      # parse the date
      my ($date) = $bug_message =~ /^Date:\s+(.+?)\s*$/mi;
-     $doc->add_attr('@cdate' => $date);
+     $doc->add_attr('@cdate' => $date) if defined $date;
      # parse the title
      my ($subject) = $bug_message =~ /^Subject:\s+(.+?)\s*$/mi;
-     $doc->add_attr('@title' => $subject);
+     $doc->add_attr('@title' => $subject) if defined $subject;
      # parse the author
      my ($author) = $bug_message =~ /^From:\s+(.+?)\s*$/mi;
-     $doc->add_attr('@author' => $author);
+     $doc->add_attr('@author' => $author) if defined $author;
      # create the uri
      $doc->add_attr('@uri' => $uri);
      foreach my $attr (@attr) {
-         $doc->add_attr($attr => $status->{$attr});
+         $doc->add_attr($attr => $status->{$attr}) if defined $status->{$attr};
      }
      print STDERR "adding $uri\n" if $DEBUG;
      # Try a bit harder if estraier is returning timeouts
index 54e52f5dc6d852a7dc161932f449fcdc6adb9431..8ee984a373ec0dbc1d7e54e5eaea6d481f31bda0 100644 (file)
@@ -135,6 +135,9 @@ sub send_mail_message{
      my @recipients;
      @recipients = @{$param{recipients}} if defined $param{recipients} and
          ref($param{recipients}) eq 'ARRAY';
+     my %recipients;
+     @recipients{@recipients} = (1) x @recipients;
+     @recipients = keys %recipients;
      # If there are no recipients, use -t to parse the message
      if (@recipients == 0) {
          $param{parse_for_recipients} = 1 unless exists $param{parse_for_recipients};
index 5fb5413dcdb3fb1a1e3323ec29a9b45d77da6a4c..bda64abdeef4d9aeca2b0e6de1382ec116f56b73 100644 (file)
@@ -159,6 +159,7 @@ sub read_bug{
     die "One of bug or summary must be passed to read_bug"
         if not exists $param{bug} and not exists $param{summary};
     my $status;
+    my $log;
     if (not defined $param{summary}) {
         my ($lref, $location) = @param{qw(bug location)};
         if (not defined $location) {
@@ -166,6 +167,7 @@ sub read_bug{
              return undef if not defined $location;
         }
         $status = getbugcomponent($lref, 'summary', $location);
+        $log    = getbugcomponent($lref, 'log'    , $location);
         return undef unless defined $status;
     }
     else {
@@ -216,6 +218,8 @@ sub read_bug{
            $data{$field} = decode_rfc1522($data{$field});
        }
     }
+    # Add log last modified time
+    $data{log_modified} = (stat($log))[9];
 
     return \%data;
 }
index 7f16855b704c739b1cfabac536a6f02f45897f36..ad4d2883b1b60f05a2d715ef7eeb385cf6646317 100755 (executable)
@@ -10,7 +10,7 @@ require './common.pl';
 use Debbugs::Config qw(:globals :text);
 use Debbugs::User;
 use Debbugs::CGI qw(version_url);
-use Debbugs::Common qw(getparsedaddrs);
+use Debbugs::Common qw(getparsedaddrs :date);
 use Debbugs::Bugs qw(get_bugs);
 
 use vars qw($gPackagePages $gWebDomain %gSeverityDisplay @gSeverityList);
@@ -647,27 +647,30 @@ sub pkg_htmlindexentrystatus {
                              split /[,\s]+/,$status{forwarded}
                             );
         }
-        my $daysold = int((time - $status{date}) / 86400);   # seconds to days
-        if ($daysold >= 7) {
+       # Check the age of the logfile
+       my ($days_last,$eng_last) = secs_to_english(time - $status{log_modified});
+        my ($days,$eng) = secs_to_english(time - $status{date});
+       
+        if ($days >= 7) {
             my $font = "";
             my $efont = "";
-            $font = "em" if ($daysold > 30);
-            $font = "strong" if ($daysold > 60);
+            $font = "em" if ($days > 30);
+            $font = "strong" if ($days > 60);
             $efont = "</$font>" if ($font);
             $font = "<$font>" if ($font);
 
-            my $yearsold = int($daysold / 365);
-            $daysold -= $yearsold * 365;
-
-            $result .= ";\n $font";
-            my @age;
-            push @age, "1 year" if ($yearsold == 1);
-            push @age, "$yearsold years" if ($yearsold > 1);
-            push @age, "1 day" if ($daysold == 1);
-            push @age, "$daysold days" if ($daysold > 1);
-            $result .= join(" and ", @age);
-            $result .= " old$efont";
+            $result .= ";\n ${font}$eng old$efont";
         }
+       if ($days_last > 7) {
+           my $font = "";
+            my $efont = "";
+            $font = "em" if ($days_last > 30);
+            $font = "strong" if ($days_last > 60);
+            $efont = "</$font>" if ($font);
+            $font = "<$font>" if ($font);
+
+            $result .= ";\n ${font}Modified $eng_last ago$efont";
+       }
     }
 
     $result .= ".";
index 9334559a2e7873cb52091f3968808e3134629fbc..5dbf1f45026543abb26eaa4561d0eea4769d6d1e 100644 (file)
@@ -180,9 +180,12 @@ debbugs (2.4.2) UNRELEASED; urgency=low
     - Fix double leading spaces of format=flowed messages
       (closes: #428056)
     - Don't doubly select users
-    - Implement versioning aware archiving support (closes: #419693)
+    - Implement versioning aware archiving support (closes: #339141)
     - Split out packages so that you don't have to install the mail stuff
       unless you want it.
+    - Only mail duplicated recipients once (closes: #172635)
+    - Indicate date of last activity (closes: #207065)
+    - Reorder title (closes: #265267)
 
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100