]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge fix for soap bug
authorDon Armstrong <don@donarmstrong.com>
Mon, 23 Feb 2009 06:42:01 +0000 (22:42 -0800)
committerDon Armstrong <don@donarmstrong.com>
Mon, 23 Feb 2009 06:42:01 +0000 (22:42 -0800)
16 files changed:
Debbugs/CGI.pm
Debbugs/CGI/Bugreport.pm
Debbugs/Common.pm
Debbugs/Config.pm
Debbugs/Log.pm
Debbugs/Packages.pm
Debbugs/Status.pm
Makefile
cgi/bugreport.cgi
debian/changelog
debian/control
scripts/process
t/01_pod.t [new file with mode: 0644]
t/06_mail_handling.t
templates/en_US/cgi/bugreport.tmpl
templates/en_US/mail/process_ack.tmpl

index 980a71d0b963e23d81a71a750c2592a8998ca954..3285d52620a686882fc8915f77c02c96ce599019 100644 (file)
@@ -297,7 +297,7 @@ sub quitcgi {
 }
 
 
-=head HTML
+=head1 HTML
 
 =head2 htmlize_packagelinks
 
index 90cf5272e1d7f5d73f20a005ac57d46759b21eb7..57f8d8fe647838babaaf7859a284e64466b663a3 100644 (file)
@@ -292,6 +292,7 @@ sub handle_email_message{
                    terse       => $param{terse},
                    exists $param{msg}?(msg=>$param{msg}):(),
                    exists $param{att}?(att=>$param{att}):(),
+                   exists $param{trim_headers}?(trim_headers=>$param{trim_headers}):(),
                   );
      return $output;
 
index 4f85a8f7bb5dadcabb95fe63d8bc7a31d69651c3..2044304f9a6a0e8b003ae561034ec5e3172a123d 100644 (file)
@@ -40,6 +40,7 @@ BEGIN{
      @EXPORT = ();
      %EXPORT_TAGS = (util   => [qw(getbugcomponent getbuglocation getlocationpath get_hashname),
                                qw(appendfile buglog getparsedaddrs getmaintainers),
+                               qw(bug_status),
                                qw(getmaintainers_reverse),
                                qw(getpseudodesc),
                               ],
@@ -177,6 +178,23 @@ sub buglog {
     return undef;
 }
 
+=head2 bug_status
+
+     bug_status($bugnum)
+
+
+Returns the path to the summary file corresponding to the bug.
+
+Returns undef if the bug does not exist.
+
+=cut
+
+sub bug_status{
+    my ($bugnum) = @_;
+    my $location = getbuglocation($bugnum, 'summary');
+    return getbugcomponent($bugnum, 'summary', $location) if ($location);
+    return undef;
+}
 
 =head2 appendfile
 
@@ -533,9 +551,9 @@ element, returns that element.
 
 sub english_join {
     if (ref $_[0] eq 'ARRAY') {
-       english_join(list=>$_[0]);
+       return english_join(list=>$_[0]);
     }
-    my %param = validate_with(param => \@_,
+    my %param = validate_with(params => \@_,
                              spec  => {normal => {type => SCALAR,
                                                   default => ', ',
                                                  },
index c936a4dd505a9d99a64483a2317dd09ce19e42a2..69dc6b4503442796dabf997b708bba6708742d0e 100644 (file)
@@ -272,8 +272,6 @@ Email address where packages with an unknown maintainer will be sent
 
 Default: $config{maintainer_email}
 
-=back
-
 =cut
 
 set_default(\%config,'unknown_maintainer_email',$config{maintainer_email});
index 5e7635147470ffc7137454fa4906d8ddc981618c..268958e61a8e95ca3c8e0ca641275ae20e771069 100644 (file)
@@ -340,6 +340,8 @@ sub read_log_records
 Takes a filehandle and a list of records as input, and prints the .log
 format representation of those records to that filehandle.
 
+=back
+
 =cut
 
 sub write_log_records (*@)
@@ -392,8 +394,6 @@ sub escape_log {
 }
 
 
-=back
-
 =head1 CAVEATS
 
 This module does none of the formatting that bugreport.cgi et al do. It's
index da01c70070560f7f586e985fb50a855edb6ea579..307e1f98005042c17b5ee4a793cfa3b369e617b5 100644 (file)
@@ -60,9 +60,7 @@ may not make sense in other contexts.)
 
 =head1 METHODS
 
-=over 8
-
-=item getpkgsrc
+=head2 getpkgsrc
 
 Returns a reference to a hash of binary package names to their corresponding
 source package names.
@@ -96,7 +94,7 @@ sub getpkgsrc {
     return $_pkgsrc;
 }
 
-=item getpkgcomponent
+=head2 getpkgcomponent
 
 Returns a reference to a hash of binary package names to the component of
 the archive containing those binary packages (e.g. "main", "contrib",
@@ -110,7 +108,7 @@ sub getpkgcomponent {
     return $_pkgcomponent;
 }
 
-=item getsrcpkgs
+=head2 getsrcpkgs
 
 Returns a list of the binary packages produced by a given source package.
 
@@ -123,7 +121,7 @@ sub getsrcpkgs {
     return @{$_srcpkg->{$src}};
 }
 
-=item binarytosource
+=head2 binarytosource
 
 Returns a reference to the source package name and version pair
 corresponding to a given binary package name, version, and architecture.
@@ -196,7 +194,7 @@ sub binarytosource {
     return ();
 }
 
-=item sourcetobinary
+=head2 sourcetobinary
 
 Returns a list of references to triplets of binary package names, versions,
 and architectures corresponding to a given source package name and version.
@@ -233,7 +231,7 @@ sub sourcetobinary {
     return map [$_, $srcver], @srcpkgs;
 }
 
-=item getversions
+=head2 getversions
 
 Returns versions of the package in a distribution at a specific
 architecture
@@ -373,7 +371,7 @@ sub get_versions{
 }
 
 
-=item makesourceversions
+=head2 makesourceversions
 
      @{$cgi_var{found}} = makesourceversions($cgi_var{package},undef,@{$cgi_var{found}});
 
@@ -528,8 +526,4 @@ sub make_source_versions {
 
 
 
-=back
-
-=cut
-
 1;
index 3e211b677ed7238f28df999c3532a0ec79be6c98..57c63570a33bace203ef8e8fe949429435a0a74d 100644 (file)
@@ -64,9 +64,10 @@ BEGIN{
                                  qw(removefoundversions removefixedversions)
                                 ],
                     hook     => [qw(bughook bughook_archive)],
+                    fields   => [qw(%fields)],
                    );
      @EXPORT_OK = ();
-     Exporter::export_ok_tags(qw(status read write versions hook));
+     Exporter::export_ok_tags(qw(status read write versions hook fields));
      $EXPORT_TAGS{all} = [@EXPORT_OK];
 }
 
@@ -81,8 +82,9 @@ location. Valid locations are those understood by L</getbugcomponent>
 
 =cut
 
-
-my %fields = (originator     => 'submitter',
+# these probably shouldn't be imported by most people, but
+# Debbugs::Control needs them, so they're now exportable
+our %fields = (originator     => 'submitter',
               date           => 'date',
               subject        => 'subject',
               msgid          => 'message-id',
@@ -251,8 +253,10 @@ sub read_bug{
            $data{$field} = decode_rfc1522($data{$field});
        }
     }
+    my $status_modified = (stat($status))[9];
     # Add log last modified time
     $data{log_modified} = (stat($log))[9];
+    $data{last_modified} = max($status_modified,$data{log_modified});
     $data{location} = $location;
     $data{archived} = (defined($location) and ($location eq 'archive'))?1:0;
     $data{bug_num} = $param{bug};
index 152e75099ce994e117c0b2e9ac5e9e8f44a2d1de..1bb7ef88a0c51f09d3146665277bc27a83436ca2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,8 +23,21 @@ cgis         := $(wildcard cgi/*.cgi cgi/*.pl)
 install_exec   := install -m755 -p
 install_data   := install -m644 -p
 
-test:
-       perl -MTest::Harness -I. -e 'runtests(glob(q(t/*.t)))'
+PERL ?= /usr/bin/perl
+
+all: build test
+
+build:
+       $(PERL) Makefile.PL
+       $(MAKE) -f Makefile.perl
+
+test: build
+       $(PERL) -MTest::Harness -I. -e 'runtests(glob(q(t/*.t)))'
+
+clean:
+       if [ -e Makefile.perl ]; then \
+               $(MAKE) -f Makefile.perl clean; \
+       fi;
 
 install: install_mostfiles
        # install basic debbugs documentation
@@ -90,4 +103,4 @@ $(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
        $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(exec $(install_data) $(tmpl) $(template_dir)/$(patsubst templates/%,%,$(tmpl))))
 
 
-.PHONY: test
\ No newline at end of file
+.PHONY: test build
\ No newline at end of file
index c50d58604722280f86924e3333ae30b8ed4193bf..a151b219478d8f93f1e0087e33cc2704f7ebb5ea 100755 (executable)
@@ -15,7 +15,7 @@ use Debbugs::Config qw(:globals :text);
 use Debbugs::Log qw(read_log_records);
 use Debbugs::CGI qw(:url :html :util);
 use Debbugs::CGI::Bugreport qw(:all);
-use Debbugs::Common qw(buglog getmaintainers make_list);
+use Debbugs::Common qw(buglog getmaintainers make_list bug_status);
 use Debbugs::Packages qw(getpkgsrc);
 use Debbugs::Status qw(splitpackages get_bug_status isstrongseverity);
 
@@ -23,6 +23,8 @@ use Scalar::Util qw(looks_like_number);
 
 use Debbugs::Text qw(:templates);
 
+use List::Util qw(max);
+
 
 use CGI::Simple;
 my $q = new CGI::Simple;
@@ -63,6 +65,34 @@ my %bugusertags;
 my %ut;
 my %seen_users;
 
+my $buglog = buglog($ref);
+my $bug_status = bug_status($ref);
+if (not defined $buglog or not defined $bug_status) {
+     print $q->header(-status => "404 No such bug",
+                     -type => "text/html",
+                     -charset => 'utf-8',
+                    );
+     print fill_in_template(template=>'cgi/no_such_bug',
+                           variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime),
+                                         bug_num     => $ref,
+                                        },
+                          );
+     exit 0;
+}
+
+# the log should almost always be newer, but just in case
+my $log_mtime = +(stat $buglog)[9] || time;
+my $status_mtime = +(stat $bug_status)[9] || time;
+my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime(max($status_mtime,$log_mtime));
+
+if ($q->request_method() eq 'HEAD' and not defined($att) and not $mbox) {
+     print $q->header(-type => "text/html",
+                     -charset => 'utf-8',
+                     (length $mtime)?(-last_modified => $mtime):(),
+                    );
+     exit 0;
+}
+
 for my $user (map {split /[\s*,\s*]+/} make_list($param{users}||[])) {
     next unless length($user);
     add_user($user,\%ut,\%bugusertags,\%seen_users);
@@ -94,33 +124,6 @@ $mbox = 1 if $mbox_status_message or $mbox_maint;
 my $archive = $param{'archive'} eq 'yes';
 my $repeatmerged = $param{'repeatmerged'} eq 'yes';
 
-my $buglog = buglog($ref);
-if (not defined $buglog) {
-     print $q->header(-status => "404 No such bug",
-                     -type => "text/html",
-                     -charset => 'utf-8',
-                    );
-     print fill_in_template(template=>'cgi/no_such_bug',
-                           variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime),
-                                         bug_num     => $ref,
-                                        },
-                          );
-     exit 0;
-}
-
-my @stat = stat $buglog;
-my $mtime = '';
-if (@stat) {
-     $mtime = strftime '%a, %d %b %Y %T GMT', gmtime($stat[9]);
-}
-
-if ($q->request_method() eq 'HEAD' and not defined($att) and not $mbox) {
-     print $q->header(-type => "text/html",
-                     -charset => 'utf-8',
-                     (length $mtime)?(-last_modified => $mtime):(),
-                    );
-     exit 0;
-}
 
 
 my $buglogfh;
@@ -237,6 +240,7 @@ else {
                                     msg_num => $msg_num,
                                     att => $att,
                                     msg => $msg,
+                                    trim_headers => $trim_headers,
                                    );
          exit 0;
      }
index 5dcd5d649b6f2048817a8b0ca292baca3d74d3e7..3b111f10ef5c00de61d21a3b8b7265a340d1fe0e 100644 (file)
@@ -240,6 +240,11 @@ debbugs (2.4.2) UNRELEASED; urgency=low
   * Add Date headers if missing (closes: #458757)
   * Indicate what machine has built webpages (closes: #507022)
   * Indicate the update location of source (closes: #512306)
+  * Use get_addresses to parse X-Debbugs-Cc: to allow multiple Cc:'s
+    (closes: #514183)
+  * Calculate last modified using summary as well as log (closes: #515063)
+  * Ditch 'as before' (closes: #514677)
+  * Don't have reply/subscribe links for archived bugs (closes: #511864)
 
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100
index 075eee73f9792d231914d46f05f240d9ecd25068..a55506ba2660a765e187c8a239a9ee114c8a5420 100644 (file)
@@ -9,7 +9,7 @@ Build-Depends-Indep: debhelper, libparams-validate-perl,
  liburi-perl, libsoap-lite-perl, libcgi-simple-perl,
  libhttp-server-simple-perl, libtest-www-mechanize-perl,
  libmail-rfc822-address-perl, libsafe-hole-perl, libuser-perl,
- libconfig-simple-perl
+ libconfig-simple-perl, libtest-pod-perl
 
 Package: debbugs
 Architecture: all
index 11c692ed6524cd731c118f36f5731b03b4ae7720..e3243caa3c60093babf8ecd4729e983d5e7ffe12 100755 (executable)
@@ -13,7 +13,7 @@ use IO::File;
 
 use MIME::Parser;
 use Debbugs::MIME qw(decode_rfc1522 create_mime_message getmailbody);
-use Debbugs::Mail qw(send_mail_message encode_headers);
+use Debbugs::Mail qw(send_mail_message encode_headers get_addresses);
 use Debbugs::Packages qw(getpkgsrc);
 use Debbugs::User qw(read_usertags write_usertags);
 use Debbugs::Common qw(:lock get_hashname);
@@ -634,7 +634,7 @@ my $newsubject= $subject;  $newsubject =~ s/^$gBug#$ref:*\s*//;
 
 my $xcchdr= $header{ 'x-debbugs-cc' } || '';
 if ($xcchdr =~ m/\S/) {
-    push(@resentccs,$xcchdr);
+    push(@resentccs,get_addresses($xcchdr));
     $resentccexplain.= fill_template('mail/xdebbugscc',
                                     {xcchdr => $xcchdr},
                                    );
diff --git a/t/01_pod.t b/t/01_pod.t
new file mode 100644 (file)
index 0000000..1d7c422
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: cperl; -*-
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
index eb4f65699a3b9fa68465e0c06bea80bd990fb245..0c43aaa2f839cda4c6bbedad000735c040cc21be 100644 (file)
@@ -125,11 +125,11 @@ my @control_commands =
                            status_key => 'severity',
                            status_value => 'wishlist',
                           },
-      reassign_bar => {command => 'reassign',
-                      value   => 'bar',
-                      status_key => 'package',
-                      status_value => 'bar',
-                     },
+      reassign_bar_baz => {command => 'reassign',
+                          value   => 'bar,baz',
+                          status_key => 'package',
+                          status_value => 'bar,baz',
+                         },
       reassign_foo => {command => 'reassign',
                       value   => 'foo',
                       status_key => 'package',
index cc8d57ddd5282c71fab93b91cb3ccec7e8b293b4..070005abdd1e40517e1449e4269ff029054c993b 100644 (file)
@@ -27,9 +27,11 @@ function toggle_infmessages()
      $output .= sprintf qq(<p><a href="%s">Full log</a></p>),html_escape(bug_links(bug=>$bug_num,links_only=>1));
   }
   else {
-     $output .=  qq(<p><a href="mailto:$bug_num\@$config{email_domain}">Reply</a> ).
-         qq(or <a href="mailto:$bug_num-subscribe\@$config{email_domain}">subscribe</a> ).
+     if (not $status{archived}) {
+       $output .=  qq(<p><a href="mailto:$bug_num\@$config{email_domain}">Reply</a> ).
+          qq(or <a href="mailto:$bug_num-subscribe\@$config{email_domain}">subscribe</a> ).
               qq(to this bug.</p>\n);
+     }
      $output .=  qq(<p><a href="javascript:toggle_infmessages();">Toggle useless messages</a></p>);
      $output .= sprintf qq(<div class="msgreceived"><p>View this report as an <a href="%s">mbox folder</a>, ).
          qq(<a href="%s">status mbox</a>, <a href="%s">maintainer mbox</a></p></div>\n),
index eca577523e8746afd34900bbb0aae9108adf7457..a7394de7429f924850e0a2292790b1c6d102e064 100644 (file)
@@ -3,7 +3,7 @@ This is an automatically generated reply to let you know your message
 has been received.
 { $forwardexplain }{ $resentccexplain }
 If you wish to submit further information on this problem, please
-send it to { $refreplyto }, as before.
+send it to { $refreplyto }.
 
 Please do not send mail to {$config{maintainer_email}} unless you wish
 to report a problem with the {ucfirst($config{bug})}-tracking system.