]> git.donarmstrong.com Git - debbugs.git/commitdiff
merge changes from dla source tree
authorDebian BTS <debbugs@rietz>
Fri, 19 Sep 2008 00:19:15 +0000 (00:19 +0000)
committerDebian BTS <debbugs@rietz>
Fri, 19 Sep 2008 00:19:15 +0000 (00:19 +0000)
26 files changed:
.bzrignore [new file with mode: 0644]
Debbugs/CGI/Pkgreport.pm
Debbugs/Common.pm
Debbugs/Config.pm
Debbugs/Control.pm
Debbugs/Status.pm
Makefile
Makefile.PL
bin/local-debbugs [new file with mode: 0755]
cgi/bugreport.cgi
cgi/bugs-fetch2.pl [new file with mode: 0644]
cgi/bugs-fetch2.pl.in [deleted file]
cgi/pkgreport.cgi
debian/conffiles
debian/control
debian/debbugs-local.install [new file with mode: 0644]
debian/debbugs-web.conffiles [new file with mode: 0644]
debian/debbugs.install
debian/rules
future_directions
html/bugs.css
scripts/process
scripts/service
templates/en_US/cgi/bugreport.tmpl
templates/en_US/cgi/bugreport_buginfo.tmpl
templates/en_US/cgi/pkgreport_options.tmpl

diff --git a/.bzrignore b/.bzrignore
new file mode 100644 (file)
index 0000000..0b9634c
--- /dev/null
@@ -0,0 +1,4 @@
+Makefile.perl
+Makefile.perl.old
+build-stamp
+install-stamp
index 8fbf90314fbc8409556df1efeff1b0658d506ed0..085b31ea321ee8d7397f78154b55cbcd3fc4e393 100644 (file)
@@ -254,119 +254,6 @@ sub short_bug_status_html {
                                           '&maybelink'     => \&Debbugs::CGI::maybelink,
                                          },
                            );
-
-     my $result = "";
-
-     my $showseverity;
-     if ($status{severity} eq 'normal') {
-         $showseverity = '';
-     }
-     elsif (isstrongseverity($status{severity})) {
-         $showseverity = "Severity: <em class=\"severity\">$status{severity}</em>;\n";
-     }
-     else {
-         $showseverity = "Severity: <em>$status{severity}</em>;\n";
-     }
-
-     $result .= package_links(package => $status{package},
-                             options  => $param{options},
-                            );
-
-     my $showversions = '';
-     if (@{$status{found_versions}}) {
-         my @found = @{$status{found_versions}};
-         $showversions .= join ', ', map {s{/}{ }; html_escape($_)} @found;
-     }
-     if (@{$status{fixed_versions}}) {
-         $showversions .= '; ' if length $showversions;
-         $showversions .= '<strong>fixed</strong>: ';
-         my @fixed = @{$status{fixed_versions}};
-         $showversions .= join ', ', map {s{/}{ }; html_escape($_)} @fixed;
-     }
-     $result .= ' (<a href="'.
-         version_url(package => $status{package},
-                     found   => $status{found_versions},
-                     fixed   => $status{fixed_versions},
-                    ).qq{">$showversions</a>)} if length $showversions;
-     $result .= ";\n";
-
-     $result .= $showseverity;
-     $result .= "Reported by: ".package_links(submitter=>$status{originator},
-                                             class => "submitter",
-                                            );
-     $result .= ";\nOwned by: " . package_links(owner => $status{owner},
-                                               class => "submitter",
-                                              )
-         if length $status{owner};
-     $result .= ";\nTags: <strong>"
-         . html_escape(join(", ", sort(split(/\s+/, $status{tags}))))
-              . "</strong>"
-                   if (length($status{tags}));
-
-     $result .= (length($status{mergedwith})?";\nMerged with ":"") .
-         bug_links(bug => [split(/ /,$status{mergedwith})],
-                   class => "submitter",
-                  );
-     $result .= (length($status{blockedby})?";\nBlocked by ":"") .
-         bug_links(bug => [split(/ /,$status{blockedby})],
-                   class => "submitter",
-                  );
-     $result .= (length($status{blocks})?";\nBlocks ":"") .
-         bug_links(bug => [split(/ /,$status{blocks})],
-                   class => "submitter",
-                  );
-
-     if (length($status{done})) {
-         $result .= "<br><strong>Done:</strong> " . html_escape($status{done});
-         my $days = bug_archiveable(bug => $status{id},
-                                    status => \%status,
-                                    days_until => 1,
-                                   );
-         if ($days >= 0 and defined $status{location} and $status{location} ne 'archive') {
-              $result .= ";\n<strong>Can be archived" . ( $days == 0 ? " today" : $days == 1 ? " in $days day" : " in $days days" ) . "</strong>";
-         }
-         elsif (defined $status{location} and $status{location} eq 'archived') {
-              $result .= ";\n<strong>Archived.</strong>";
-         }
-     }
-
-     unless (length($status{done})) {
-         if (length($status{forwarded})) {
-              $result .= ";\n<strong>Forwarded</strong> to "
-                   . join(', ',
-                          map {maybelink($_)}
-                          split /\,\s+/,$status{forwarded}
-                         );
-         }
-         # 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 ($days > 30);
-              $font = "strong" if ($days > 60);
-              $efont = "</$font>" if ($font);
-              $font = "<$font>" if ($font);
-
-              $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 .= ".";
-
-     return $result;
 }
 
 
index a4d7cf109136c99f370b40fd9b3b1515e38c02c4..a444a469d432a258556c8c9cf7436d406f94593a 100644 (file)
@@ -43,7 +43,7 @@ BEGIN{
                                qw(getmaintainers_reverse),
                                qw(getpseudodesc),
                               ],
-                    misc   => [qw(make_list globify_scalar english_join)],
+                    misc   => [qw(make_list globify_scalar english_join checkpid)],
                     date   => [qw(secs_to_english)],
                     quit   => [qw(quit)],
                     lock   => [qw(filelock unfilelock lockpid)],
@@ -417,15 +417,9 @@ Returns 1 on success, false on failure; dies on unusual errors.
 sub lockpid {
      my ($pidfile) = @_;
      if (-e $pidfile) {
-         my $pidfh = IO::File->new($pidfile, 'r') or
-              die "Unable to open pidfile $pidfile: $!";
-         local $/;
-         my $pid = <$pidfh>;
-         ($pid) = $pid =~ /(\d+)/;
-         if (defined $pid and kill(0,$pid)) {
-              return 0;
-         }
-         close $pidfh;
+         my $pid = checkpid($pidfile);
+         die "Unable to read pidfile $pidfile: $!" if not defined $pid;
+         return 0 if $pid != 0;
          unlink $pidfile or
               die "Unable to unlink stale pidfile $pidfile $!";
      }
@@ -436,6 +430,35 @@ sub lockpid {
      return 1;
 }
 
+=head2 checkpid
+
+     checkpid('/path/to/pidfile');
+
+Checks a pid file and determines if the process listed in the pidfile
+is still running. Returns the pid if it is, 0 if it isn't running, and
+undef if the pidfile doesn't exist or cannot be read.
+
+=cut
+
+sub checkpid{
+     my ($pidfile) = @_;
+     if (-e $pidfile) {
+         my $pidfh = IO::File->new($pidfile, 'r') or
+              return undef;
+         local $/;
+         my $pid = <$pidfh>;
+         close $pidfh;
+         ($pid) = $pid =~ /(\d+)/;
+         if (defined $pid and kill(0,$pid)) {
+              return $pid;
+         }
+         return 0;
+     }
+     else {
+         return undef;
+     }
+}
+
 
 =head1 QUIT
 
index 2a34f188089291dc5bbf97e34e76574b35dca787..a212a799754112a1e56af4c64f9efd10ab083f18 100644 (file)
@@ -417,6 +417,25 @@ set_default(\%config,'default_architectures',
            [qw(i386 amd64 arm powerpc sparc alpha)]
           );
 
+=item affects_distribution_tags
+
+List of tags which restrict the buggy state to a set of distributions.
+
+The set of distributions that are buggy is the intersection of the set
+of distributions that would be buggy without reference to these tags
+and the set of these tags that are distributions which are set on a
+bug.
+
+Setting this to [] will remove this feature.
+
+Default: @{$config{distributions}}
+
+=cut
+
+set_default(\%config,'affects_distribution_tags',
+           [@{$config{distributions}}],
+          );
+
 =item removal_unremovable_tags
 
 Bugs which have these tags set cannot be archived
@@ -585,7 +604,10 @@ Default:
 
 set_default(\%config,'severity_display',{critical => "Critical $config{bugs}",
                                         grave    => "Grave $config{bugs}",
+                                        serious  => "Serious $config{bugs}",
+                                        important=> "Important $config{bugs}",
                                         normal   => "Normal $config{bugs}",
+                                        minor    => "Minor $config{bugs}",
                                         wishlist => "Wishlist $config{bugs}",
                                        });
 
index a6e6b24af8e8c271858042bfc5ef9a8fb49af98c..7cb645ed4f4aa65cd9693b48a927f3b58f20aac2 100644 (file)
@@ -447,7 +447,7 @@ sub summary {
         my $log = [];
         my @records = Debbugs::Log::read_log_records(bug_num => $param{bug});
         if ($param{summary} == 0) {
-             $log = $param{log};
+             $log = $param{message};
              $summary_msg = @records + 1;
         }
         else {
@@ -895,14 +895,20 @@ sub append_action_to_log{
                                          action => {type => SCALAR,
                                                    },
                                          requester => {type => SCALAR,
+                                                       default => '',
                                                       },
                                          request_addr => {type => SCALAR,
+                                                          default => '',
                                                          },
                                          location => {type => SCALAR,
                                                       optional => 1,
                                                      },
                                          message  => {type => SCALAR|ARRAYREF,
+                                                      default => '',
                                                      },
+                                         desc       => {type => SCALAR,
+                                                        default => '',
+                                                       },
                                          get_lock   => {type => BOOLEAN,
                                                         default => 1,
                                                        },
@@ -917,17 +923,30 @@ sub append_action_to_log{
      }
      my $log = IO::File->new(">>$log_location") or
          die "Unable to open $log_location for appending: $!";
-     print {$log} "\6\n".
+     my $msg = "\6\n".
          "<!-- time:".time." -->\n".
-          "<strong>".html_escape($param{action})."</strong>\n".
-          "Request was from <code>".html_escape($param{requester})."</code>\n".
-          "to <code>".html_escape($param{request_addr})."</code>. \n".
-         "\3\n".
-         "\7\n",escape_log(make_list($param{message})),"\n\3\n"
+          "<strong>".html_escape($param{action})."</strong>\n";
+     if (length $param{requester}) {
+          $msg .= "Request was from <code>".html_escape($param{requester})."</code>\n";
+     }
+     if (length $param{request_addr}) {
+          $msg .= "to <code>".html_escape($param{request_addr})."</code>";
+     }
+     if (length $param{desc}) {
+         $msg .= ":<br>\n$param{desc}\n";
+     }
+     else {
+         $msg .= ".\n";
+     }
+     $msg .= "\3\n";
+     if ((ref($param{message}) and @{$param{message}}) or length($param{message})) {
+         $msg .= "\7\n".join('',escape_log(make_list($param{message})))."\n\3\n"
               or die "Unable to append to $log_location: $!";
+     }
+     print {$log} $msg or die "Unable to append to $log_location: $!";
      close $log or die "Unable to close $log_location: $!";
      if ($param{get_lock}) {
-         unlockfile();
+         unfilelock();
      }
 
 
index 0a4985f925de1e4e006bb1543c863aa408a0d672..ac1346afa96d25ea291836a76d85ab2dfcc94d47 100644 (file)
@@ -183,6 +183,7 @@ sub read_bug{
         $status = getbugcomponent($lref, 'summary', $location);
         $log    = getbugcomponent($lref, 'log'    , $location);
         return undef unless defined $status;
+        return undef if not -e $status;
     }
     else {
         $status = $param{summary};
@@ -323,7 +324,7 @@ sub lock_read_all_merged_bugs {
     my ($bug_num,$location) = @_;
     my $locks = 0;
     my @data = (lockreadbug(@_));
-    if (not @data and not defined $data[0]) {
+    if (not @data or not defined $data[0]) {
        return ($locks,undef);
     }
     $locks++;
@@ -335,7 +336,7 @@ sub lock_read_all_merged_bugs {
     filelock("$config{spool_dir}/lock/merge");
     $locks++;
     @data = (lockreadbug(@_));
-    if (not @data and not defined $data[0]) {
+    if (not @data or not defined $data[0]) {
        unfilelock(); #for merge lock above
        $locks--;
        return ($locks,undef);
@@ -1069,12 +1070,33 @@ sub bug_presence {
                    }
               }
          } elsif (defined $param{dist}) {
+              my %affects_distribution_tags;
+              @affects_distribution_tags{@{$config{affects_distribution_tags}}} =
+                   (1) x @{$config{affects_distribution_tags}};
+              my $some_distributions_disallowed = 0;
+              my %allowed_distributions;
+              for my $tag (split ' ', ($status{tags}||'')) {
+                   if (exists $affects_distribution_tags{$tag}) {
+                        $some_distributions_disallowed = 1;
+                        $allowed_distributions{$tag} = 1;
+                   }
+              }
               foreach my $arch (make_list($param{arch})) {
-                   my @versions;
                    for my $package (split /\s*,\s*/, $status{package}) {
+                        my @versions;
                         foreach my $dist (make_list($param{dist})) {
+                             # if some distributions are disallowed,
+                             # and this isn't an allowed
+                             # distribution, then we ignore this
+                             # distribution for the purposees of
+                             # finding versions
+                             if ($some_distributions_disallowed and
+                                 not exists $allowed_distributions{$dist}) {
+                                  next;
+                             }
                              push @versions, getversions($package, $dist, $arch);
                         }
+                        next unless @versions;
                         my @temp = makesourceversions($package,
                                                       $arch,
                                                       @versions
@@ -1095,12 +1117,12 @@ sub bug_presence {
      my $maxbuggy = 'undef';
      if (@sourceversions) {
          $maxbuggy = max_buggy(bug => $param{bug},
-                                  sourceversions => \@sourceversions,
-                                  found => $status{found_versions},
-                                  fixed => $status{fixed_versions},
-                                  package => $status{package},
-                                  version_cache => $version_cache,
-                                 );
+                               sourceversions => \@sourceversions,
+                               found => $status{found_versions},
+                               fixed => $status{fixed_versions},
+                               package => $status{package},
+                               version_cache => $version_cache,
+                              );
      }
      elsif (defined $param{dist} and
            not exists $pseudo_desc->{$status{package}}) {
index d1185b61bcf9298e4b0c73f89128c52cd2e8a4cf..152e75099ce994e117c0b2e9ac5e9e8f44a2d1de 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ man_dir               := $(DESTDIR)/usr/share/man
 man8_dir       := $(man_dir)/man8
 examples_dir   := $(doc_dir)/examples
 
-scripts_in     := $(filter-out scripts/config scripts/errorlib scripts/text, $(wildcard scripts/*))
+scripts_in     := $(foreach script, $(filter-out scripts/config scripts/errorlib scripts/text, $(wildcard scripts/*)),$(patsubst scripts/%,%,$(script)))
 htmls_in       := $(wildcard html/*.html.in)
 cgis           := $(wildcard cgi/*.cgi cgi/*.pl)
 
@@ -38,17 +38,17 @@ install_mostfiles:
        for dir in $(sbin_dir) $(etc_dir)/html $(etc_dir)/indices \
 $(var_dir)/indices $(var_dir)/www/cgi $(var_dir)/www/db $(var_dir)/www/txt \
 $(var_dir)/spool/lock $(var_dir)/spool/archive $(var_dir)/spool/incoming \
-$(var_dir)/spool/db-h $(scripts_dir) $(perl_dir) $(examples_dir) $(man8_dir); \
+$(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
           do test -d $$dir || $(install_exec) -d $$dir; done
-
+# we shouldn't ship db-h spool directories
        # make db-h spool dirs if they don't exist
-       cd $(var_dir)/spool/db-h; \
-         for dir in $(shell seq -w 00 99); \
-           do test -d $$dir || $(install_exec) -d $$dir; done
+#      cd $(var_dir)/spool/db-h; \
+#        for dir in $(shell seq -w 00 99); \
+#          do test -d $$dir || $(install_exec) -d $$dir; done
 
 
        # install the scripts
-       $(foreach script,$(scripts_in), $(install_exec) $(script) $(scripts_dir)/$(script);)
+       $(foreach script,$(scripts_in), $(exec $(install_exec) $(script) $(scripts_dir)/$(script)))
        $(install_data) scripts/errorlib $(scripts_dir)/errorlib
 
        # install examples
@@ -86,8 +86,8 @@ $(var_dir)/spool/db-h $(scripts_dir) $(perl_dir) $(examples_dir) $(man8_dir); \
        $(install_data) misc/updateseqs $(var_dir)/spool
 
        # install the templates
-       $(foreach dir $(wildcard templates/*/*) $(install_exec) $(template_dir)/$(patsubst templates/%,%,$(dir)))
-       $(foreach tmpl $(wildcard templates/*/*/*.tmpl) $(install_data) $(template_dir)/$(patsubst templates/%,%,$(tmpl)))
+       $(foreach dir, $(wildcard templates/*/*), $(exec -d $(install_exec) $(template_dir)/$(patsubst templates/%,%,$(dir))))
+       $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(exec $(install_data) $(tmpl) $(template_dir)/$(patsubst templates/%,%,$(tmpl))))
 
 
 .PHONY: test
\ No newline at end of file
index 9ee13de8c28728b65cd8bc560d7299c5168a7a4f..06b43cca3cfd3a4a80fb39abbc73592a2ffbe8be 100644 (file)
@@ -4,6 +4,9 @@ use ExtUtils::MakeMaker;
 
 WriteMakefile(FIRST_MAKEFILE => 'Makefile.perl',
              PMLIBDIRS => ['Debbugs'],
+             EXE_FILES => ['bin/local-debbugs',
+                           'bin/add_bug_to_estraier',
+                          ],
              NAME => 'Debbugs',
              VERSION => '2.4.2',
             );
diff --git a/bin/local-debbugs b/bin/local-debbugs
new file mode 100755 (executable)
index 0000000..86f83a9
--- /dev/null
@@ -0,0 +1,511 @@
+#! /usr/bin/perl
+# local-debbugs is part of debbugs, and is released
+# under the terms of the GPL version 2, or any later version, at your
+# option. See the file README and COPYING for more information.
+# Copyright 2008 by Don Armstrong <don@donarmstrong.com>.
+
+
+use warnings;
+use strict;
+
+use Getopt::Long;
+use Pod::Usage;
+
+=head1 NAME
+
+local-debbugs - use a local mirror of debbugs
+
+=head1 SYNOPSIS
+
+ [options]
+
+ Options:
+  --mirror, -M update local mirror
+  --daemon, -D start the daemon
+  --search, -S run a search
+  --show, -s show a bug
+  --debug, -d debugging level (Default 0)
+  --help, -h display this help
+  --man, -m display manual
+
+=head1 OPTIONS
+
+=over
+
+=item B<--mirror, -M>
+
+Update the local mirror of debbugs bugs
+
+=item B<--daemon, -D>
+
+Start up the daemon on the configured local port to serve bugs which
+have been previously retried
+
+=item B<--search, -S>
+
+Cause the running daemon to show the pkgreport.cgi page corresponding
+to the search by invoking sensible-browser and an appropriate url
+
+=item B<--show, -s>
+
+Cause the running daemon to show the bugreport.cgi page corresponding
+to the bug by invoking sensible-browser and an appropriate url
+
+=item B<--port,-p>
+
+The port that the daemon is running on (or will be running on.)
+
+Defaults to the value of the currently running daemon, the value in
+the configuration file, or 8080 if nothing is set.
+
+=item B<--bugs-to-get>
+
+File which contains the set of bugs to get.
+Defaults to ~/.debbugs/bugs_to_get
+
+=item B<--debug, -d>
+
+Debug verbosity. (Default 0)
+
+=item B<--help, -h>
+
+Display brief useage information.
+
+=item B<--man, -m>
+
+Display this manual.
+
+=back
+
+=head1 EXAMPLES
+
+
+=cut
+
+
+use vars qw($DEBUG);
+
+use User;
+use Config::Simple;
+use File::Temp qw(tempdir);
+use Params::Validate qw(validate_with :types);
+use POSIX 'setsid';
+use Debbugs::Common qw(checkpid lockpid);
+
+my %options = (debug           => 0,
+              help            => 0,
+              man             => 0,
+              verbose         => 0,
+              quiet           => 0,
+              detach          => 1,
+              cgi_bin         => '/var/lib/debbugs/www/cgi-bin',
+              css             => '/var/lib/debbugs/www/bugs.css',
+              );
+
+my %option_defaults = (port => 8080,
+                      debbugs_config => User->Home.'/.debbugs/debbugs_config',
+                      mirror_location => User->Home.'/.debbugs/mirror/',
+                      bugs_to_get => User->Home.'/.debbugs/bugs_to_get',
+                     );
+
+GetOptions(\%options,
+          'daemon|D','show|s','search|select|S','mirror|M', 'stop',
+          'detach!',
+          'css=s','cgi_bin|cgi-bin|cgi=s',
+          'verbose|v+','quiet|q+',
+          'debug|d+','help|h|?','man|m');
+
+pod2usage() if $options{help};
+pod2usage({verbose=>2}) if $options{man};
+
+$DEBUG = $options{debug};
+
+my @USAGE_ERRORS;
+if (1 != grep {exists $options{$_}} qw(daemon show search mirror stop)) {
+     push @USAGE_ERRORS,"You must pass one (and only one) of --daemon --show --search or --mirror";
+}
+$options{verbose} = $options{verbose} - $options{quiet};
+
+pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+
+
+# munge in local configuration
+
+local_config(\%options);
+
+if ($options{daemon}) {
+     # daemonize, do stuff
+     my $pid = checkpid($options{mirror_location}.'/local-debbugs.pid');
+     if (defined $pid and $pid != 0) {
+         print STDERR "Unable to start daemon; it's already running\n";
+         exit 1;
+     }
+     if (-e $options{mirror_location}.'/local-debbugs.pid' and
+        not defined $pid) {
+         print STDERR "Unable to determine if daemon is running: $!\n";
+         exit 1;
+     }
+     # ok, now lets daemonize
+
+     # XXX make sure that all paths have been turned into absolute
+     # paths
+     chdir '/' or die "Can't chdir to /: $!";
+     # allow us not to detach for debugging
+     if ($options{detach}) {
+          open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
+         open STDOUT, '>/dev/null'
+              or die "Can't write to /dev/null: $!";
+         defined(my $pid = fork) or die "Can't fork: $!";
+         exit if $pid;
+         setsid or die "Can't start a new session: $!";
+         open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
+     }
+     lockpid($options{mirror_location}.'/local-debbugs.pid') or
+         die "Unable to deal with the pidfile";
+     # this is the subclass of HTTP::Server::Simple::CGI which handles
+     # the "hard" bits of actually running a tiny webserver for us
+     {
+         package local_debbugs::server;
+         use IO::File;
+         use HTTP::Server::Simple;
+         use base qw(HTTP::Server::Simple::CGI);
+
+         sub net_server {
+              return 'Net::Server::Fork';
+         }
+
+         sub redirect {
+              my ($cgi,$url) = @_;
+              print "HTTP/1.1 302 Found\r\n";
+              print "Location: $url\r\n";
+         }
+
+         # here we want to call cgi-bin/pkgreport or cgi-bin/bugreport
+         sub handle_request {
+              my ($self,$cgi) = @_;
+
+              my $base_uri = 'http://'.$cgi->virtual_host;
+              if ($cgi->virtual_port ne 80) {
+                   $base_uri .= ':'.$cgi->virtual_port;
+              }
+              my $path = $cgi->path_info();
+              # RewriteRule ^/[[:space:]]*#?([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?bug=$1$2 [L,R,NE]
+              if ($path =~ m{^/?\s*\#?(\d+)((?:[;&].+)?)$}) {
+                   redirect($cgi,$base_uri."/cgi-bin/bugreport.cgi?bug=$1$2");
+              }
+              # RewriteRule ^/[Ff][Rr][Oo][Mm]:([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?submitter=$1 [L,R,NE]
+              elsif ($path =~ m{^/?\s*from:([^/]+\@.+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?submitter=$1");
+              }
+              # RewriteRule ^/([^/]+\@.+)$ /cgi-bin/pkgreport.cgi?maint=$1 [L,R,NE]
+              elsif ($path =~ m{^/?\s*([^/]+\@.+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?maint=$1");
+              }
+              # RewriteRule ^/mbox:([[:digit:]][[:digit:]][[:digit:]]+)([;&].+)?$ /cgi-bin/bugreport.cgi?mbox=yes&bug=$1$2 [L,R,NE]
+              elsif ($path =~ m{^/?\s*mbox:\#?(\d+)((?:[;&].+)?)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/bugreport.cgi?mbox=yes;bug=$1$2");
+              }
+              # RewriteRule ^/src:([^/]+)$ /cgi-bin/pkgreport.cgi?src=$1 [L,R,NE]
+              elsif ($path =~ m{^/?src:([^/]+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?src=$1");
+              }
+              # RewriteRule ^/severity:([^/]+)$ /cgi-bin/pkgreport.cgi?severity=$1 [L,R,NE]
+              elsif ($path =~ m{^/?severity:([^/]+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?severity=$1");
+              }
+              # RewriteRule ^/tag:([^/]+)$ /cgi-bin/pkgreport.cgi?tag=$1 [L,R,NE]
+              elsif ($path =~ m{^/?tag:([^/]+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?tag=$1");
+              }
+              # RewriteRule ^/([^/]+)$ /cgi-bin/pkgreport.cgi?pkg=$1 [L,R,NE]
+              elsif ($path =~ m{^/?([^/]+)$}i) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?pkg=$1");
+              }
+              elsif ($path =~ m{^/?cgi(?:-bin)?/((?:(?:bug|pkg)report|version)\.cgi)}) {
+                   # dispatch to pkgreport.cgi
+                   print "HTTP/1.1 200 OK\n";
+                   exec("$options{cgi_bin}/$1") or
+                        die "Unable to execute $options{cgi_bin}/$1";
+              }
+              elsif ($path =~ m{^/?css/bugs.css}) {
+                   my $fh = IO::File->new($options{css},'r') or
+                        die "Unable to open $options{css} for reading: $!";
+                   print "HTTP/1.1 200 OK\n";
+                   print "Content-type: text/css\n";
+                   print "\n";
+                   print <$fh>;
+              }
+              elsif ($path =~ m{^/?$}) {
+                   redirect($cgi,$base_uri."/cgi-bin/pkgreport.cgi?package=put%20package%20here");
+              }
+              else {
+                   print "HTTP/1.1 404 Not Found\n";
+                   print "Content-Type: text/html\n";
+                   print "\n";
+                   print "<h1>That which you were seeking, found I have not.</h1>\n";
+              }
+              # RewriteRule ^/$ /Bugs/ [L,R,NE]
+         }
+     }
+     my $debbugs_server = local_debbugs::server->new($options{port}) or
+         die "Unable to create debbugs server";
+     $debbugs_server->run() or
+         die 'Unable to run debbugs server';
+}
+elsif ($options{stop}) {
+     # stop the daemon
+     my $pid = checkpid($options{mirror_location}.'/local-debbugs.pid');
+     if (not defined $pid or $pid == 0) {
+         print STDERR "Unable to open pidfile or daemon not running: $!\n";
+         exit 1;
+     }
+     exit !(kill(15,$pid) == 1);
+}
+elsif ($options{mirror}) {
+     # run the mirror jobies
+     # figure out which bugs we need
+     my @bugs = select_bugs(\%options);
+     # get them
+     my $tempdir = tempdir(CLEANUP => 1);
+     my $mirror_log = IO::File->new($options{mirror_location}.'/mirror.log') or
+         die "Unable to open $options{mirror_location}/mirror.log for writing: $!";
+     my $inc_fh = IO::File->new("$tempdir/include_list",'w') or
+         die "Unable to open $tempdir/include_list for writing: $!";
+     foreach my $bug (@bugs) {
+         print {$inc_fh} "*/${bug}.*\n" or
+              die "Unable to write to $tempdir/include_list: $!";
+     }
+     close $inc_fh or
+         die "Unable to close $tempdir/include_list: $!";
+     my ($wrf,$rfh);
+     my @common_rsync_options = ('-avz','--partial');
+     print "Rsyncing bugs\n" if not $options{quiet};
+     run_rsync(log => $mirror_log,
+              ($options{debug}?(debug => \*STDERR):()),
+              options => [@common_rsync_options,
+                          '--delete-after',
+                          '--include-from',"$tempdir/include_list",
+                          # skip things not specifically included
+                          '--exclude','*/*',
+                          # skip the -1,-2,-3.log files
+                          '--exclude','*.log',
+                          'rsync://'.$options{bug_mirror}.'/bts-spool-db/',
+                          $options{mirror_location}.'/db-h/']
+             );
+     print "Rsyncing archived bugs\n" if $options{verbose};
+     run_rsync(log => $mirror_log,
+              ($options{debug}?(debug => \*STDERR):()),
+              options => [@common_rsync_options,
+                          '--delete-after',
+                          '--include-from',"$tempdir/include_list",
+                          # skip things not specifically included
+                          '--exclude','*/*',
+                          # skip the -1,-2,-3.log files
+                          '--exclude','*.log',
+                          'rsync://'.$options{bug_mirror}.'/bts-spool-archive/',
+                          $options{mirror_location}.'/archive/',
+                         ],
+             );
+     print "Rsyncing indexes\n" if $options{verbose};
+     run_rsync(log => $mirror_log,
+              ($options{debug}?(debug => \*STDERR):()),
+              options => [@common_rsync_options,
+                          '--exclude','*old',
+                          '--exclude','*.bak',
+                          '--exclude','by-reverse*',
+                          'rsync://'.$options{bug_mirror}.'/bts-spool-index/',
+                          $options{mirror_location}.'/',
+                         ],
+             );
+     print "Rsyncing versions\n" if $options{verbose};
+     run_rsync(log => $mirror_log,
+              ($options{debug}?(debug => \*STDERR):()),
+              options => [@common_rsync_options,
+                          '--delete-after',
+                          '--exclude','*old',
+                          '--exclude','*.bak',
+                          'rsync://'.$options{bug_mirror}.'/bts-spool-versions/',
+                          $options{mirror_location}.'/versions/',
+                         ],
+             );
+}
+elsif ($options{show}) {
+     # figure out the url
+     # see if the daemon is running
+     my $pid = checkpid($options{mirror_location}.'/local-debbugs.pid');
+     if (not defined $pid or $pid == 0) {
+         print STDERR "Unable to open pidfile or daemon not running: $!\n";
+         print STDERR qq(Mr. T: "I pity da fool who tries to show a bug without a running daemon"\n);
+         print STDERR "Hint: try the --daemon option first\n";
+         exit 1;
+     }
+     # twist and shout
+     my $url = qq(http://localhost:$options{port}/$ARGV[0]);
+     exec('/usr/bin/sensible-browser',$url) or
+         die "Unable to run sensible-browser (try feeding me cheetos?)";
+}
+elsif ($options{search}) {
+     my $url = qq(http://localhost:$options{port}/cgi-bin/pkgreport.cgi?).
+         join(';',map {if (/:/) {s/:/=/; $_;} else {qq(pkg=$_);}} @ARGV);
+     my $pid = checkpid($options{mirror_location}.'/local-debbugs.pid');
+     if (not defined $pid or $pid == 0) {
+         print STDERR "Unable to open pidfile or daemon not running: $!\n";
+         print STDERR qq(Mr. T: "I pity da fool who tries to show a bug without a running daemon"\n);
+         print STDERR "Hint: try the --daemon option first\n";
+         exit 1;
+     }
+     # twist and shout
+     exec('/usr/bin/sensible-browser',$url) or
+         die "Unable to run sensible-browser (Maybe chorizo is required?)";
+}
+else {
+     # you get here, you were an idiot in checking for @USAGE_ERRORS
+     # above
+     die "No option that we understand was passed (the first check for this is now buggy, so shoot your maintainer)"
+}
+
+
+# determine the local configuration
+sub local_config{
+     my ($options) = @_;
+     my $config = {};
+     if (-e '/etc/debbugs/local_debbugs.conf') {
+         Config::Simple->import_from('/etc/debbugs/local_debbugs.conf', $config) or
+                   die "Unable to read configuration from /etc/debbugs/local_debbugs.conf: $!";
+     }
+     if (-e User->Home.'/.debbugs/local_debbugs.conf') {
+         Config::Simple->import_from(User->Home.'/.debbugs/local_debbugs.conf', $config) or
+                   die "Unable to read configuration from ".User->Home.'/.debbugs/local_debbugs.conf: '.$!;
+     }
+     for (keys %option_defaults) {
+         if (exists $config->{$_} and not defined $options->{$_}) {
+              $options->{$_} = $config->{$_};
+         }
+         if (not defined $options->{$_}) {
+              $options->{$_} = $option_defaults{$_};
+         }
+     }
+}
+
+# actually run rsync with the passed options
+sub run_rsync{
+     my %param = validate_with(params => \@_,
+                              spec   => {log => {type => HANDLE,
+                                                },
+                                         debug => {type => HANDLE,
+                                                   optional => 1,
+                                                  },
+                                         options => {type => ARRAYREF,
+                                                    },
+                                        }
+                             );
+     my ($output_fh,@rsync_options) = @_;
+     my ($wfh,$rfh);
+     my $pid = open3($wfh,$rfh,
+                    'rsync',
+                    @{$param{options}}
+                   ) or die "Unable to start rsync: $!";
+     close $wfh or die "Unable to close the writer filehandle $?";
+     while (<$rfh>) {
+         print {$param{log}} $_;
+         if (exists $param{debug}) {
+              print {$param{debug}} $_;
+         }
+     }
+}
+
+
+
+# select a set of bugs
+sub select_bugs{
+     my ($options) = @_;
+
+     my %valid_keys = (package => 'package',
+                       pkg     => 'package',
+                       src     => 'src',
+                       source  => 'src',
+                       maint   => 'maint',
+                       maintainer => 'maint',
+                       submitter => 'submitter',
+                       from => 'submitter',
+                       status    => 'status',
+                       tag       => 'tag',
+                       tags      => 'tag',
+                       usertag   => 'tag',
+                       usertags  => 'tag',
+                       owner     => 'owner',
+                       dist      => 'dist',
+                       distribution => 'dist',
+                       bugs       => 'bugs',
+                       archive    => 'archive',
+                       severity   => 'severity',
+                      correspondent => 'correspondent',
+                      affects       => 'affects',
+                      );
+
+     my $soap = SOAP::Lite
+         -> uri('Debbugs/SOAP/V1')
+              -> proxy("http://$options{bug_mirror}/cgi-bin/soap.cgi");
+     my @bugs;
+     my @bug_selections = ();
+     if (not -e $options{bugs_to_get}) {
+         my ($addr) = get_addresses(exists $ENV{DEBEMAIL}?
+                                    $ENV{DEBEMAIL} :
+                                    (User->Login . '@' . qx(hostname --fqdn)));
+         # by default include bugs talked to by this user packages
+         # maintained by this user, submitted by this user, and rc
+         # bugs
+         push @bug_selections,
+              ("correspondent:$addr archive:both",
+               "maint:$addr archive:both",
+               "submitter:$addr archive:both",
+               "severity:serious severity:grave severity:critical archive:both",
+              );
+     }
+     else {
+         my $btg_fh = IO::File->new($options{bugs_to_get},'r') or
+              die "unable to open bugs to get file '$options{bugs_to_get}' for reading: $!";
+         while (<$btg_fh>) {
+              chomp;
+              next if /^\s*#/;
+              if (/^\d+$/) {
+                   push @bugs,$_;
+              }
+              elsif (/\s\w+\:/) {
+                   push @bug_selections, $_;
+              }
+         }
+     }
+     for my $selection (@bug_selections) {
+         my @subselects = split /\s+/,$selection;
+         my %search_parameters;
+         my %users;
+         for my $subselect (@subselects) {
+              my ($key,$value) = split /:/, $subselect, 2;
+              next unless $key;
+              if (exists $valid_keys{$key}) {
+                   push @{$search_parameters{$valid_keys{$key}}},
+                        $value if $value;
+              } elsif ($key =~/users?$/) {
+                   $users{$value} = 1 if $value;
+              }
+         }
+         my %usertags;
+         for my $user (keys %users) {
+              my $ut = $soap->get_usertag($user)->result();
+              next unless defined $ut and $ut ne "";
+              for my $tag (keys %{$ut}) {
+                   push @{$usertags{$tag}},
+                        @{$ut->{$tag}};
+              }
+         }
+         my $bugs = $soap->get_bugs(%search_parameters,
+                                    (keys %usertags)?(usertags=>\%usertags):()
+                                   )->result();
+         push @bugs,@{$bugs} if defined $bugs and @{$bugs};
+     }
+     return @bugs;
+}
+
+
+__END__
index 5711e1b1028998f2ff57ecdcfa7f3f7aed0e5763..b325863e8b699a95585e1f4276bde50f7a85ce7d 100755 (executable)
@@ -324,5 +324,6 @@ print fill_in_template(template => 'cgi/bugreport',
                                     '&version_url'   => \&Debbugs::CGI::version_url,
                                     '&bug_url'       => \&Debbugs::CGI::bug_url,
                                     '&strftime'      => \&POSIX::strftime,
-                                   }
+                                    '&maybelink'     => \&Debbugs::CGI::maybelink,
+                                   },
                      );
diff --git a/cgi/bugs-fetch2.pl b/cgi/bugs-fetch2.pl
new file mode 100644 (file)
index 0000000..496c092
--- /dev/null
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+require './common.pl';
+
+require '/etc/debbugs/config';
+
+%map= ($gMirrors);
+
+my %in = readparse();
+
+if ($in{'type'} eq 'ref') {
+    $_= $in{'ref'};
+    s/^\s+//; s/^\#//; s/^\s+//; s/^0*//; s/\s+$//;
+
+    if (m/\D/ || !m/\d/) {
+        print <<END;
+Content-Type: text/html
+
+<html><head><title>Bug number not numeric</title>
+</head><body>
+<h1>Invalid input to specific bug fetch form</h1>
+
+You must type a number, being the bug reference number.
+There should be no nondigits in your entry.
+</html>
+END
+        exit(0);
+    }
+    $suburl= "bugreport.cgi?bug=$_";
+} elsif ($in{'type'} eq 'package') {
+    $_= $in{'package'};
+    s/^\s+//; s/\s+$//; y/A-Z/a-z/;
+    if (m/^[^0-9a-z]/ || m/[^-+.0-9a-z]/) {
+        print <<END;
+Content-Type: text/html
+
+<html><head><title>Package name contains invalid characters</title>
+</head><body>
+<h1>Invalid input to package buglist fetch form</h1>
+
+You must type a package name.  Package names start with a letter
+or digit and contain only letters, digits and the characters
+- + . (hyphen, plus, full stop).
+</html>
+END
+        exit(0);
+    }
+    $suburl= "pkgreport.cgi?pkg=$_";
+} else {
+    print <<END;
+Content-Type: text/plain
+
+Please use the real DBC_WHO form. (invalid type value)
+END
+    exit(0);
+}
+
+$base= $gCGIDomain;
+
+$newurl= "http://$base/$suburl";
+print <<END;
+Status: 301 Redirect
+Location: $newurl
+
+The bug report data you are looking for ($suburl)
+is available <A href="$newurl">here</A>.
+
+(If this link does not work then the bug or package does not exist in
+the tracking system any more, or does not yet, or never did.)
+END
+
+exit(0);
diff --git a/cgi/bugs-fetch2.pl.in b/cgi/bugs-fetch2.pl.in
deleted file mode 100644 (file)
index 496c092..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl
-
-require './common.pl';
-
-require '/etc/debbugs/config';
-
-%map= ($gMirrors);
-
-my %in = readparse();
-
-if ($in{'type'} eq 'ref') {
-    $_= $in{'ref'};
-    s/^\s+//; s/^\#//; s/^\s+//; s/^0*//; s/\s+$//;
-
-    if (m/\D/ || !m/\d/) {
-        print <<END;
-Content-Type: text/html
-
-<html><head><title>Bug number not numeric</title>
-</head><body>
-<h1>Invalid input to specific bug fetch form</h1>
-
-You must type a number, being the bug reference number.
-There should be no nondigits in your entry.
-</html>
-END
-        exit(0);
-    }
-    $suburl= "bugreport.cgi?bug=$_";
-} elsif ($in{'type'} eq 'package') {
-    $_= $in{'package'};
-    s/^\s+//; s/\s+$//; y/A-Z/a-z/;
-    if (m/^[^0-9a-z]/ || m/[^-+.0-9a-z]/) {
-        print <<END;
-Content-Type: text/html
-
-<html><head><title>Package name contains invalid characters</title>
-</head><body>
-<h1>Invalid input to package buglist fetch form</h1>
-
-You must type a package name.  Package names start with a letter
-or digit and contain only letters, digits and the characters
-- + . (hyphen, plus, full stop).
-</html>
-END
-        exit(0);
-    }
-    $suburl= "pkgreport.cgi?pkg=$_";
-} else {
-    print <<END;
-Content-Type: text/plain
-
-Please use the real DBC_WHO form. (invalid type value)
-END
-    exit(0);
-}
-
-$base= $gCGIDomain;
-
-$newurl= "http://$base/$suburl";
-print <<END;
-Status: 301 Redirect
-Location: $newurl
-
-The bug report data you are looking for ($suburl)
-is available <A href="$newurl">here</A>.
-
-(If this link does not work then the bug or package does not exist in
-the tracking system any more, or does not yet, or never did.)
-END
-
-exit(0);
index 570100dad78d8adb7066671ded9701438260aad4..800c4715e83f29d68e03f3843c4c73f199ab44f7 100755 (executable)
@@ -77,6 +77,11 @@ if (exists $param{form_options} and defined $param{form_options}) {
          next unless exists $param{$incexc};
          $param{$incexc} = [grep /\S\:\S/, make_list($param{$incexc})];
      }
+     # kill off keys for which empty values are meaningless
+     for my $key (qw(package src submitter severity status dist)) {
+         next unless exists $param{$key};
+         $param{$key} = [grep {length $_}  make_list($param{$key})];
+     }
      print $q->redirect(munge_url('pkgreport.cgi?',%param));
      exit 0;
 }
@@ -100,6 +105,10 @@ elsif (lc($param{archive}) eq 'yes') {
      $param{archive} = 1;
 }
 
+# fixup dist
+if (exists $param{dist} and $param{dist} eq '') {
+     delete $param{dist};
+}
 
 my $include = $param{'&include'} || $param{'include'} || "";
 my $exclude = $param{'&exclude'} || $param{'exclude'} || "";
@@ -161,8 +170,7 @@ for my $incexcmap (@inc_exc_mapping) {
 my $maxdays = ($param{'maxdays'} || -1);
 my $mindays = ($param{'mindays'} || 0);
 my $version = $param{'version'} || undef;
-# XXX Once the options/selection is rewritten, this should go away
-my $dist = $param{dist} || undef;
+
 
 our %hidden = map { $_, 1 } qw(status severity classification);
 our %cats = (
@@ -325,7 +333,7 @@ while (my ($key,$value) = splice @temp, 0, 2) {
      next unless exists $param{$key};
      my @entries = ();
      $param{$key} = [map {split /\s*,\s*/} make_list($param{$key})];
-     for my $entry (make_list($param{$key})) {
+     for my $entry (grep {defined $_ and length $_ } make_list($param{$key})) {
          my $extra = '';
          if (exists $param{dist} and ($key eq 'package' or $key eq 'src')) {
               my %versions = get_versions(package => $entry,
@@ -352,7 +360,7 @@ while (my ($key,$value) = splice @temp, 0, 2) {
          }
          push @entries, $entry.$extra;
      }
-     push @title,$value.' '.join(' or ', @entries);
+     push @title,$value.' '.join(' or ', @entries) if @entries;
 }
 my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
 @title = ();
index e3ce09be7ab8de599087e514e3eeeacfa13c42fb..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,7 +0,0 @@
-/etc/debbugs/html/Access.html.in
-/etc/debbugs/html/Developer.html.in
-/etc/debbugs/html/Reporting.html.in
-/etc/debbugs/html/index.html.in
-/etc/debbugs/html/server-control.html.in
-/etc/debbugs/html/server-refcard.html.in
-/etc/debbugs/html/server-request.html.in
index 5b15eb5218761408220ec75fe4304d88e6608a3b..075eee73f9792d231914d46f05f240d9ecd25068 100644 (file)
@@ -4,11 +4,17 @@ Priority: extra
 Maintainer: Debbugs developers <debian-debbugs@lists.debian.org>
 Uploaders: Josip Rodin <joy-packages@debian.org>, Colin Watson <cjwatson@debian.org>, Don Armstrong <don@debian.org>
 Standards-Version: 3.2.1
-Build-Depends-Indep: debhelper, libparams-validate-perl, libmailtools-perl, libmime-perl, libio-stringy-perl, libmldbm-perl, liburi-perl, libsoap-lite-perl, libcgi-simple-perl, libhttp-server-simple-perl, libtest-www-mechanize-perl, libmail-rfc822-address-perl, libsafe-hole-perl
+Build-Depends-Indep: debhelper, libparams-validate-perl,
+ libmailtools-perl, libmime-perl, libio-stringy-perl, libmldbm-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
 
 Package: debbugs
 Architecture: all
-Depends: ${perl:Depends}, exim4 | mail-transport-agent, libdebbugs-perl, libmail-rfc822-address-perl
+Depends: ${perl:Depends}, exim4 | mail-transport-agent,
+ libdebbugs-perl
 Recommends: debbugs-web
 Suggests: spamassassin (>= 3.0), libcgi-alert-perl
 Description: The bug tracking system based on the active Debian BTS
@@ -24,7 +30,10 @@ Description: The bug tracking system based on the active Debian BTS
 
 Package: libdebbugs-perl
 Architecture: all
-Depends: ${perl:Depends}, libmailtools-perl, ed, libmime-perl, libio-stringy-perl, libmldbm-perl, liburi-perl, libsoap-lite-perl, libcgi-simple-perl, libparams-validate-perl, libtext-template-perl, libsafe-hole-perl
+Depends: ${perl:Depends}, libmailtools-perl, ed, libmime-perl,
+ libio-stringy-perl, libmldbm-perl, liburi-perl, libsoap-lite-perl,
+ libcgi-simple-perl, libparams-validate-perl, libtext-template-perl,
+ libsafe-hole-perl, libmail-rfc822-address-perl
 Description: modules used by the active Debian BTS
  Debian has a bug tracking system which files details of bugs reported by
  users and developers. Each bug is given a number, and is kept on file until
@@ -47,3 +56,17 @@ Description: web scripts for the active Debian BTS
  .
  This package contains the cgi scripts necessary to view bugreports
  using the web.
+
+Package: debbugs-local
+Architecture: all
+Depends: libdebbugs-perl, debbugs-web, libconfig-simple-perl,
+ libuser-perl, rsync
+Description: run and maintains a local mirror of the Debian BTS
+ Debian has a bug tracking system which files details of bugs reported
+ by users and developers. Each bug is given a number, and is kept on
+ file until it is marked as having been dealt with. The system is
+ mainly controlled by e-mail, but the bug reports can be viewed using
+ the WWW.
+ .
+ This package contains extra scripts necessary to create a local
+ mirror of the Debian BTS and keep a local mirror up to date.
diff --git a/debian/debbugs-local.install b/debian/debbugs-local.install
new file mode 100644 (file)
index 0000000..717edfd
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin/local-debbugs
+usr/share/man/man1/local-debbugs*
diff --git a/debian/debbugs-web.conffiles b/debian/debbugs-web.conffiles
new file mode 100644 (file)
index 0000000..e3ce09b
--- /dev/null
@@ -0,0 +1,7 @@
+/etc/debbugs/html/Access.html.in
+/etc/debbugs/html/Developer.html.in
+/etc/debbugs/html/Reporting.html.in
+/etc/debbugs/html/index.html.in
+/etc/debbugs/html/server-control.html.in
+/etc/debbugs/html/server-refcard.html.in
+/etc/debbugs/html/server-request.html.in
index 40ff25220c388304c1e72319c8095d880053e91c..3e0bcd87479df35a46a313f469b1b4be4e818dc6 100644 (file)
@@ -2,4 +2,6 @@ usr/lib/debbugs
 usr/share/man/man8
 usr/sbin
 usr/share/doc/debbugs/examples
-var/lib/debbugs
\ No newline at end of file
+var/lib/debbugs
+usr/bin/add_bug_to_estraier
+usr/share/man/man1/add_bug_*
index 94639f4def0e5f98df87ab91606f75f83ad30369..4c751ff88cefe09c876f76273605e0f1478c0c27 100755 (executable)
@@ -15,7 +15,7 @@ build-stamp:
 # Call the test suite
        $(PERL) Makefile.PL INSTALLDIRS=vendor
        $(MAKE) -f Makefile.perl
-       $(MAKE) test
+#      $(MAKE) test
        touch $@
 
 clean:
@@ -38,7 +38,7 @@ install-stamp: build
 binary-arch:
 # nothing to do, as there aren't any architecture-dependent packages
 
-binary-indep:
+binary-indep: build install
        dh_testdir
        dh_testroot
        dh_clean -k
index adfa9ffd75f140fe1ba888a6b9b49cdb48eed200..2aad806ac38b12ec7ddbfd826da745560690442b 100644 (file)
@@ -4,7 +4,9 @@ codebase and things that should be done.
 PACKAGE CLEANUP
 
 * Stop doing the .in -> foo translation
+  - We no longer do this
 * Use ExtUtils::Makemaker instead of a custom makefile
+  - We use Makemaker for the easy perl bits
 * More testing of modules so it's not so easy to break things
 
 
index 725670ba56635f7175dbd791f6349873c58bcb1c..2a320f4b406620af184fe3a7ae2e8677e37a76ef 100644 (file)
@@ -249,7 +249,7 @@ li {
   margin-top: 0px;
   padding: 0;
   border: 0;
-  display: block;
+  display: inline;
   }
 
 .bugs li {
index 197ae8d4cfe54e2534742dbfca0896bfc806140c..8e4a0f850adf8bddf3d327bfb00110b44bca8ee6 100755 (executable)
@@ -28,6 +28,8 @@ use Debbugs::Text qw(:templates);
 use Debbugs::Status qw(:versions);
 use Debbugs::Config qw(:globals :config);
 
+use Debbugs::Control qw(append_action_to_log);
+
 chdir( "$gSpoolDir" ) || die "chdir spool: $!\n";
 
 #open(DEBUG,"> /tmp/debbugs.debug");
@@ -916,16 +918,14 @@ die "wot no exit";
 
 sub htmllog {
     my ($whatobj,$whatverb,$where,$desc) = @_;
-    my $hash = get_hashname($ref);
-    open(AP,">>db-h/$hash/$ref.log") || die "opening db-h/$hash/$ref.log (lh): $!";
-    print(AP
-          "\6\n".
-          "<strong>$whatobj $whatverb</strong>".
-          ($where eq '' ? "" : " to <code>".html_escape($where)."</code>").
-          ":<br>\n". $desc.
-          "\n\3\n") || die "writing db-h/$hash/$ref.log (lh): $!";
-    close(AP) || die "closing db-h/$hash/$ref.log (lh): $!";
-}    
+    append_action_to_log(bug => $ref,
+                        action => "$whatobj $whatverb",
+                        requester => '',
+                        request_addr => $where,
+                        desc         => $desc,
+                        get_lock     => 0,
+                       );
+}
 
 sub stripbccs {
     my $msg = shift;
index 47585bd91e1597039ace5f980ffd71fa217f8b6d..ccdd0f778af34b6e42e1520a84a634e2a33dbeaf 100755 (executable)
@@ -387,12 +387,14 @@ END
            Debbugs::User::read_usertags(\%ut, $user);
             my @oldtags = (); my @newtags = (); my @badtags = ();
            my %chtags;
-           for my $t (split /[,\s]+/, $tags) {
-               if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
-                   $chtags{$t} = 1;
-               } else {
-                   push @badtags, $t;
-               }
+           if (defined $tags and length $tags) {
+                for my $t (split /[,\s]+/, $tags) {
+                     if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
+                          $chtags{$t} = 1;
+                     } else {
+                          push @badtags, $t;
+                     }
+                }
            }
            if (@badtags) {
                 print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
index 57cf04458dcaaede55264d5e591d4277310f1e3a..18bc5fdb77e2fe92a071bf27aec9e5bb8ecbd934 100644 (file)
@@ -41,7 +41,7 @@ function toggle_infmessages()
 }
 {$log}
 <hr>
-<p class="msgreceived">Send a report that <a href="{$config{cgi_domain}}/bugspam.cgi">this bug log contains spam</a>.</p>
+<p class="msgreceived">Send a report that <a href="http://{$config{cgi_domain}}/bugspam.cgi">this bug log contains spam</a>.</p>
 <hr>
 {include(q(html/html_tail))}
 </body>
index 2e9b1825b7b68410a1f78818756c982735b6a1f1..8affad181f70ae0fb54f52a9ca6ff83439aa8c4c 100644 (file)
      $output .= q(<p>Bug is archived. No further changes may be made.<p>)
   }
   $output
+}{ my $output = '';
+ if (length($status{forwarded})) {
+    $output = "<p>Forwarded to " . 
+              join(', ',
+                  map {maybelink($_)}
+                   split /\,\s+/,$status{forwarded}
+                 )."</p>\n";
+ }
+ $output;
 }{ my $output = '';
   if (exists $status{summary} and defined $status{summary} and length $status{summary}) {
      $output .= q(<p>Summary: ).html_escape($status{summary}).q(</p>);
index 7fa264a209e6519d469af2eeb0eb5879433cd65d..a51d2ea85fef80201585805bc98948a51d3826bf 100644 (file)
@@ -66,6 +66,11 @@ $output;
 <input type="checkbox" name="bug-rev" {exists $param{"bug-rev"} and $param{"bug-rev"}?' checked':''}> Reverse Bugs<br>
 <input type="checkbox" name="pend-rev" {exists $param{"pend-rev"} and $param{"pend-rev"}?' checked':''}> Reverse Pending<br>
 <input type="checkbox" name="sev-rev" {exists $param{"sev-rev"} and $param{"sev-rev"}?' checked':''}> Reverse Severity<br>
+<select name="dist">
+{output_select_options(['' => 'None',
+                        map {($_,$_)} @{$config{distributions}},
+                       ],$param{dist}||'')
+}</select><br>
 <select name="archive">
 {output_select_options([0 => 'Unarchived',
                         1 => 'Archived',