]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge changes from don source
authorDebian BTS <debbugs@rietz>
Mon, 8 Feb 2010 10:40:57 +0000 (10:40 +0000)
committerDebian BTS <debbugs@rietz>
Mon, 8 Feb 2010 10:40:57 +0000 (10:40 +0000)
14 files changed:
Debbugs/Bugs.pm
Debbugs/CGI.pm
Debbugs/CGI/Bugreport.pm
Debbugs/CGI/Pkgreport.pm
Debbugs/Common.pm
Debbugs/Config.pm
Debbugs/Control.pm
Debbugs/MIME.pm
Debbugs/Packages.pm
Debbugs/Status.pm
cgi/pkgreport.cgi
debian/changelog
scripts/process
t/lib/DebbugsTest.pm

index eff1593640e87c2c6f41ae5d9eb70b1d55bed7e1..573bf51756c6d28b4d01876fe6e895566e33f7d2 100644 (file)
@@ -55,7 +55,7 @@ use Params::Validate qw(validate_with :types);
 use IO::File;
 use Debbugs::Status qw(splitpackages get_bug_status);
 use Debbugs::Packages qw(getsrcpkgs getpkgsrc);
-use Debbugs::Common qw(getparsedaddrs getmaintainers getmaintainers_reverse make_list);
+use Debbugs::Common qw(getparsedaddrs package_maintainer getmaintainers make_list);
 use Fcntl qw(O_RDONLY);
 use MLDBM qw(DB_File Storable);
 use List::Util qw(first);
@@ -623,7 +623,7 @@ sub get_bugs_flatfile{
      }
      my @bugs;
      BUG: while (<$flatfile>) {
-         next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/;
+         next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*(.*)\s*\]\s+(\w+)\s+(.*)$/;
          my ($pkg,$bug,$time,$status,$submitter,$severity,$tags) = ($1,$2,$3,$4,$5,$6,$7);
          next if $grep_bugs and not exists $bugs{$bug};
          if (exists $param{package}) {
@@ -742,10 +742,8 @@ sub __handle_pkg_src_and_maint{
      }
      if (exists $param{maint}) {
          my $key_inc = 0;
-         my $maint_rev = getmaintainers_reverse();
          my %_temp_p = ();
-         for my $package (map { exists $maint_rev->{$_}?@{$maint_rev->{$_}}:()}
-                          make_list($param{maint})) {
+         for my $package (package_maintainer(maintainer=>$param{maint})) {
               $packages{$package}++ unless exists $_temp_p{$package};
               $_temp_p{$package} = 1;
               $key_inc = 1;
index 53f0b5d27487de0018dacc1f7ec4aaa1015e2ec3..d51b9be0a469c5503f4e3648964c36bb2bb31e27 100644 (file)
@@ -400,11 +400,15 @@ sub package_links {
      }
      my @links = ();
      for my $type (qw(src package)) {
-         push @links, map {(munge_url('pkgreport.cgi?',
+         push @links, map {my $t_type = $type;
+                           if ($_ =~ s/^src://) {
+                               $t_type = 'src';
+                           }
+                           (munge_url('pkgreport.cgi?',
                                       %options,
-                                      $type => $_,
+                                      $t_type => $_,
                                      ),
-                            ($type eq 'src'?'src:':'').$_);
+                            ($t_type eq 'src'?'src:':'').$_);
                       } make_list($param{$type}) if exists $param{$type};
      }
      for my $type (qw(maint owner submitter correspondent)) {
index c9103ba470bdc8cb6797a9da1f59d90c9ae78b9d..ba4c7a4f30ee3185b9eb5dc377a177bc914b18da 100644 (file)
@@ -251,7 +251,13 @@ sub display_entity {
                    $temp =~ s{(\d+)}
                              {bug_links(bug=>$1)}ge;
                    $temp;]gxie;
-
+        if (defined $config{cve_tracker} and
+            length $config{cve_tracker}
+           ) {
+            # Add links to CVE vulnerabilities (closes #568464)
+            $body =~ s{(CVE-\d{4}-\d{4,})}
+                      {<a href="http://$config{cve_tracker}$1">$1</a>}gx;
+        }
         if (not exists $param{att}) {
              print {$param{output}} qq(<pre class="message">$body</pre>\n);
         }
index 84663ed8fcc27b17aa0562282c5d734b69eef730..d047affb1d262827d204552b3fc4c52ece4e9b63 100644 (file)
@@ -51,13 +51,9 @@ BEGIN{
 
      @EXPORT = ();
      %EXPORT_TAGS = (html => [qw(short_bug_status_html pkg_htmlizebugs),
-                             qw(pkg_javascript),
-                             qw(pkg_htmlselectyesno pkg_htmlselectsuite),
-                             qw(buglinklist pkg_htmlselectarch)
                             ],
-                    misc => [qw(generate_package_info make_order_list),
-                             qw(myurl),
-                             qw(get_bug_order_index determine_ordering),
+                    misc => [qw(generate_package_info),
+                             qw(determine_ordering),
                             ],
                    );
      @EXPORT_OK = (qw());
@@ -78,7 +74,7 @@ sub generate_package_info{
                               spec  => {binary => {type => BOOLEAN,
                                                    default => 1,
                                                   },
-                                        package => {type => SCALAR|ARRAYREF,
+                                        package => {type => SCALAR,#|ARRAYREF,
                                                    },
                                         options => {type => HASHREF,
                                                    },
@@ -146,6 +142,8 @@ sub generate_package_info{
          if (defined $config{subscription_domain} and
              length $config{subscription_domain}) {
               my $ptslink = $param{binary} ? $srcforpkg : $package;
+              # the pts only wants the source, and doesn't care about src: (#566089)
+              $ptslink =~ s/^src://;
               push @references, q(to the <a href="http://).html_escape("$config{subscription_domain}/$ptslink").q(">Package Tracking System</a>);
          }
          # Only output this if the source listing is non-trivial.
@@ -233,7 +231,7 @@ sub short_bug_status_html {
      if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) {
          for my $b (@blocks) {
               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{blocks_array}}, {bug_num => $b, subject => $s{subject}, status => \%s};
          }
      }
@@ -457,74 +455,6 @@ sub pkg_htmlizebugs {
      return $result;
 }
 
-sub pkg_javascript {
-     return fill_in_template(template=>'cgi/pkgreport_javascript',
-                           );
-}
-
-sub pkg_htmlselectyesno {
-     my ($name, $n, $y, $default) = @_;
-     return sprintf('<select name="%s"><option value=no%s>%s</option><option value=yes%s>%s</option></select>', $name, ($default ? "" : " selected"), $n, ($default ? " selected" : ""), $y);
-}
-
-sub pkg_htmlselectsuite {
-     my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
-     my @suites = ("stable", "testing", "unstable", "experimental");
-     my %suiteaka = ("stable", "etch", "testing", "lenny", "unstable", "sid");
-     my $defaultsuite = "unstable";
-
-     my $result = sprintf '<select name=dist id="%s">', $id;
-     for my $s (@suites) {
-         $result .= sprintf '<option value="%s"%s>%s%s</option>',
-              $s, ($defaultsuite eq $s ? " selected" : ""),
-                   $s, (defined $suiteaka{$s} ? " (" . $suiteaka{$s} . ")" : "");
-     }
-     $result .= '</select>';
-     return $result;
-}
-
-sub pkg_htmlselectarch {
-     my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
-     my @arches = qw(alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc);
-
-     my $result = sprintf '<select name=arch id="%s">', $id;
-     $result .= '<option value="any">any architecture</option>';
-     for my $a (@arches) {
-         $result .= sprintf '<option value="%s">%s</option>', $a, $a;
-     }
-     $result .= '</select>';
-     return $result;
-}
-
-sub myurl {
-     my %param = @_;
-     return html_escape(pkg_url(map {exists $param{$_}?($_,$param{$_}):()}
-                               qw(archive repeatmerged mindays maxdays),
-                               qw(version dist arch package src tag maint submitter)
-                              )
-                      );
-}
-
-sub make_order_list {
-     my $vfull = shift;
-     my @x = ();
-
-     if ($vfull =~ m/^([^:]+):(.*)$/) {
-         my $v = $1;
-         for my $vv (split /,/, $2) {
-              push @x, "$v=$vv";
-         }
-     }
-     else {
-         for my $v (split /,/, $vfull) {
-              next unless $v =~ m/.=./;
-              push @x, $v;
-         }
-     }
-     push @x, "";              # catch all
-     return @x;
-}
-
 sub get_bug_order_index {
      my $order = shift;
      my $status = shift;
@@ -556,13 +486,6 @@ sub get_bug_order_index {
      return $pos + 1;
 }
 
-sub buglinklist {
-     my ($prefix, $infix, @els) = @_;
-     return '' if not @els;
-     return $prefix . bug_linklist($infix,'submitter',@els);
-}
-
-
 # sets: my @names; my @prior; my @title; my @order;
 
 sub determine_ordering {
index e519c82e88a09a3e5c4815da3de5fa51ad254523..9760912a6445e1a2e0c848e7b0509cab790e0c0e 100644 (file)
@@ -306,6 +306,9 @@ sub package_maintainer {
                                         binary => {type => SCALAR|ARRAYREF,
                                                    default => [],
                                                   },
+                                        maintainer => {type => SCALAR|ARRAYREF,
+                                                       default => [],
+                                                      },
                                         rehash => {type => BOOLEAN,
                                                    default => 0,
                                                   },
@@ -314,6 +317,12 @@ sub package_maintainer {
                                                    },
                                        },
                             );
+    my @binary = make_list($param{binary});
+    my @source = make_list($param{source});
+    my @maintainers = make_list($param{maintainer});
+    if ((@binary or @source) and @maintainers) {
+       croak "It is nonsensical to pass both maintainers and source or binary";
+    }
     if ($param{rehash}) {
        $_source_maintainer = undef;
        $_source_maintainer_rev = undef;
@@ -326,7 +335,7 @@ sub package_maintainer {
        $_source_maintainer_rev = {};
        for my $fn (@config{('source_maintainer_file',
                             'source_maintainer_file_override',
-                            'pseduo_maint_file')}) {
+                            'pseudo_maint_file')}) {
            next unless defined $fn;
            if (not -e $fn) {
                warn "Missing source maintainer file '$fn'";
@@ -342,7 +351,7 @@ sub package_maintainer {
        $_maintainer_rev = {};
        for my $fn (@config{('maintainer_file',
                             'maintainer_file_override',
-                            'pseduo_maint_file')}) {
+                            'pseudo_maint_file')}) {
            next unless defined $fn;
            if (not -e $fn) {
                warn "Missing maintainer file '$fn'";
@@ -353,19 +362,23 @@ sub package_maintainer {
        }
     }
     my @return;
-    my @extra_source;
-    my $b = $param{reverse}?$_maintainer_rev:$_maintainer;
-    for my $binary (make_list($param{binary})) {
+    for my $binary (@binary) {
        if (not $param{reverse} and $binary =~ /^src:/) {
-           push @extra_source,$binary;
+           push @source,$binary;
            next;
        }
-       push @return,grep {defined $_} make_list($b->{$binary});
+       push @return,grep {defined $_} make_list($_maintainer->{$binary});
     }
-    my $s = $param{reverse}?$_source_maintainer_rev:$_source_maintainer;
-    for my $source (make_list($param{source},@extra_source)) {
+    for my $source (@source) {
        $source =~ s/^src://;
-       push @return,grep {defined $_} make_list($s->{$source});
+       push @return,grep {defined $_} make_list($_source_maintainer->{$source});
+    }
+    for my $maintainer (grep {defined $_} @maintainers) {
+       push @return,grep {defined $_}
+           make_list($_maintainer_rev->{$maintainer});
+       push @return,map {$_ !~ /^src:/?'src:'.$_:$_} 
+           grep {defined $_}
+               make_list($_source_maintainer_rev->{$maintainer});
     }
     return @return;
 }
index 56c79580230a40a5b30fa622f0811b290b83583a..9e538e1ccb4f067eb94d4a5cfe4b8c048f2de949 100644 (file)
@@ -60,6 +60,7 @@ BEGIN {
                                 qw($gVersionPackagesDir $gVersionIndex $gBinarySourceMap $gSourceBinaryMap),
                                 qw($gVersionTimeIndex),
                                 qw($gSimpleVersioning),
+                                qw($gCVETracker),
                                 qw($gSendmail $gLibPath $gSpamScan @gExcludeFromControl),
                                 qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
                                 qw(%gTagsSingleLetter),
@@ -205,9 +206,21 @@ Domain where subscriptions to package lists happen
 
 =cut
 
-
 set_default(\%config,'subscription_domain',undef);
 
+
+=item cve_tracker $gCVETracker
+
+URI to CVE security tracker; in bugreport.cgi, CVE-2001-0002 becomes
+linked to http://$config{cve_tracker}CVE-2001-002
+
+Default: security-tracker.debian.org/tracker/
+
+=cut
+
+set_default(\%config,'cve_tracker','security-tracker.debian.org/tracker/');
+
+
 =back
 
 =cut
@@ -1064,7 +1077,7 @@ sub __convert_name{
      $hash_name =~ s/^([\$\%\@])g//;
      my $glob_type = $1;
      my $glob_name = 'g'.$hash_name;
-     $hash_name =~ s/(HTML|CGI)/ucfirst(lc($1))/ge;
+     $hash_name =~ s/(HTML|CGI|CVE)/ucfirst(lc($1))/ge;
      $hash_name =~ s/^([A-Z]+)/lc($1)/e;
      $hash_name =~ s/([A-Z]+)/'_'.lc($1)/ge;
      return $hash_name unless wantarray;
index 5a2a849c50e3497521a202fd9e9e364fd4ebe669..d994170bb0f24fa6c5f72cd525ebb505556f64a2 100644 (file)
@@ -2829,9 +2829,9 @@ LIMIT:        for my $limit (make_list($param{limit}{$field})) {
            }
            if (not $match) {
                $going_to_fail = 1;
-               print {$transcript} "$field: '".join(', ',make_list($data->{$field})).
+               print {$transcript} qq($field: ).join(', ',map{qq("$_")} make_list($data->{$field})).
                    "' does not match at least one of ".
-                   join(', ',map {ref($_)?'(regex)':$_} make_list($param{limit}{$field}))."\n";
+                   join(', ',map {ref($_)?'(regex)':qq("$_")} make_list($param{limit}{$field}))."\n";
            }
        }
     }
index 2e1d611c94a8085524633d3aaa37d78cf194246d..95dafb8dc5075ed9a515143c00dd8e584e653bb0 100644 (file)
@@ -58,7 +58,7 @@ sub getmailbody
     my $entity = shift;
     my $type = $entity->effective_type;
     if ($type eq 'text/plain' or
-           ($type =~ m#text/# and $type ne 'text/html') or
+           ($type =~ m#text/?# and $type ne 'text/html') or
            $type eq 'application/pgp') {
        return $entity->bodyhandle;
     } elsif ($type eq 'multipart/alternative') {
@@ -120,7 +120,12 @@ sub parse
 
     # Strip off RFC2440-style PGP clearsigning.
     if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
-       shift @bodylines while @bodylines and length $bodylines[0];
+       shift @bodylines while @bodylines and
+           length $bodylines[0] and
+               # we currently don't strip \r; handle this for the
+               # time being, though eventually it should be stripped
+               # too, I think. [See #565981]
+               $bodylines[0] ne "\r";
        shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
        for my $findsig (0 .. $#bodylines) {
            if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) {
index 482938da9310a672ddf36dc37fce57768789f64f..f43e8b54e20cf9b00ad3948527ad7f7dbabeb74d 100644 (file)
@@ -444,6 +444,10 @@ sub get_versions{
      }
      my %versions;
      for my $package (make_list($param{package})) {
+         my $source_only = 0;
+         if ($package =~ s/^src://) {
+              $source_only = 1;
+         }
          my $version = $versions->{$package};
          next unless defined $version;
          for my $dist (make_list($param{dist})) {
@@ -451,7 +455,7 @@ sub get_versions{
                             make_list($param{arch}):
                             (grep {not $param{no_source_arch} or
                                        $_ ne 'source'
-                                   } keys %{$version->{$dist}})) {
+                                   } $source_only?'source':keys %{$version->{$dist}})) {
                    next unless defined $version->{$dist}{$arch};
                    for my $ver (ref $version->{$dist}{$arch} ?
                                 keys %{$version->{$dist}{$arch}} :
index 5b6e9dcf9963ddd141453909cee26e2fe5d1dac7..8b4b9b045164363d14371e5336223ac20f373663 100644 (file)
@@ -619,7 +619,7 @@ The following functions are exported with the :versions tag
 
      addfoundversions($status,$package,$version,$isbinary);
 
-
+All use of this should be phased out in favor of Debbugs::Control::fixed/found
 
 =cut
 
@@ -632,6 +632,10 @@ sub addfoundversions {
     return unless defined $version;
     undef $package if $package =~ m[(?:\s|/)];
     my $source = $package;
+    if ($package =~ s/^src://) {
+       $isbinary = 0;
+       $source = $package;
+    }
 
     if (defined $package and $isbinary) {
         my @srcinfo = binary_to_source(binary => $package,
index 8b733497728f8cd921fdc882dd60d96d4a16e5cb..b7fc845a510e50a8c21958c52a42fa236d5e386b 100755 (executable)
@@ -77,7 +77,8 @@ if (exists $param{form_options} and defined $param{form_options}) {
      }
      for my $incexc (qw(include exclude)) {
          next unless exists $param{$incexc};
-         $param{$incexc} = [grep /\S\:\S/, make_list($param{$incexc})];
+         # normalize tag to tags
+         $param{$incexc} = [map {s/^tag:/tags:/} grep /\S\:\S/, make_list($param{$incexc})];
      }
      for my $key (keys %package_search_keys) {
          next unless exists $param{key};
@@ -93,6 +94,16 @@ if (exists $param{form_options} and defined $param{form_options}) {
      exit 0;
 }
 
+# normalize innclude/exclude keys; currently this is in two locations,
+# which is suboptimal. Closes: #567407
+for my $incexc (qw(include exclude)) {
+    next unless exists $param{$incexc};
+    # normalize tag to tags
+    $param{$incexc} = [map {s/^tag:/tags:/} make_list($param{$incexc})];
+}
+
+
+
 # map from yes|no to 1|0
 for my $key (qw(repeatmerged bug-rev pend-rev sev-rev)) {
      if (exists $param{$key}){
@@ -363,16 +374,20 @@ my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
 # shove in bugs which affect this package if there is a package or a
 # source given (by default), but no affects options given
 if (not exists $param{affects} and not exists $param{noaffects} and
-    (exists $param{source} or
+    (exists $param{src} or
      exists $param{package})) {
-    push @bugs, get_bugs((map {exists $param{$_}?($_ =~ /^(?:package|source)$/?'affects':$_,
-                                                 ($_ eq 'source'?'src:'.$param{$_}:$param{$_})):()}
+    push @bugs, get_bugs((map {my $key = $_;
+                              exists $param{$key}?($key =~ /^(?:package|src)$/?'affects':$key,
+                                                 ($key eq 'src'?[map {"src:$_"}make_list($param{$key})]:$param{$_})):()}
                          grep {$_ ne 'newest'}
                          keys %package_search_keys, 'archive'),
                         usertags => \%ut,
                        );
 }
 
+# filter out included or excluded bugs
+
+
 if (defined $param{version}) {
      $title .= " at version $param{version}";
 }
@@ -467,7 +482,7 @@ if (exists $param{submitter}) {
 
 print $result;
 
-print pkg_javascript() . "\n";
+print fill_in_template(template=>'cgi/pkgreport_javascript');
 
 print qq(<h2 class="outstanding"><!--<a class="options" href="javascript:toggle(1)">-->Options<!--</a>--></h2>\n);
 
index 8dc1bf31bd1a18953a6ccf06636fd2e07d367cf7..4b03178d5eeee08a93b5bf02177a12dc660728f2 100644 (file)
@@ -4,6 +4,24 @@ debbugs (2.4.2~exp1) experimental; urgency=low
     #497144)
   * Fix problem with non-existant /etc/debbugs/config
   * Ditch \r and \n in status fields (closes: #545895)
+  * Properly handle source packages when searching by maintainer; use
+    package_maintainer instead of the hashes (closes: #556863)
+  * Handle \r properly in Debbugs::MIME for PGP signatures
+    (closes: #565981). Thanks to Mike Hommey
+  * Allow type to be text as well as text/(something not html)
+    (closes: #566068). Thanks to Mike Hommey.
+  * Fix links to PTS pages for src packages (closes: #566089). Thanks to
+    Sandro Tosi.
+  * Fix affects for source packages (closes: #563470). Thanks to Charles
+    Plessy.
+  * Allow tag instead of tags; silently normalize it (closes: #567407).
+    Thanks to Martin Krafft.
+  * Properly handle Forwarded: at submit@ time (closes: #568020). Thanks
+    to Martin Krafft.
+  * Fix source package src: urls
+  * Use package_maintainer to search for packages maintained by a
+    maintainer (closes: #556863). Thanks to Yves-Alexis Perez.
+  * Linkify CVE reports (closes: #568464). Thanks to Martin Zobel-Helas.
 
  -- Don Armstrong <don@debian.org>  Wed, 26 Aug 2009 21:32:53 -0700
 
index a3ea9b4a08ff0a21d8ea07dfc8d58bca59ae20de..b8efcc5f5c0fb118b05d9d583dee5d05d3c0be06 100755 (executable)
@@ -587,7 +587,7 @@ if ($ref<0) { # new bug report
         $data->{owner}= $pheader{owner};
     }
     if (defined($pheader{forwarded})) {
-       $data->{'forwarded-to'} = $pheader{forwarded};
+       $data->{forwarded} = $pheader{forwarded};
     }
     &filelock("nextnumber.lock");
     open(N,"nextnumber") || die "nextnumber: read: $!";
index 167174f877435c850a87341267d671b4e5878fdc..e45d7db1e996f7832b8373777fb245918781e44f 100644 (file)
@@ -93,6 +93,7 @@ END
 foo main foo
 END
                            "$config_dir/pseudo-packages.description" => '',
+                           "$config_dir/pseudo-packages.maint" => '',
                           );
      while (my ($file,$contents) = each %files_to_create) {
          system('mkdir','-p',dirname($file));