]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Config.pm
* Add template system
[debbugs.git] / Debbugs / Config.pm
index 9b2792a2972c8aa44889c38b71f6145de63c8941..57aeb9838cd1befac498644f53d335c4f6c2e6a5 100644 (file)
@@ -1,3 +1,9 @@
+# This module 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 2007 by Don Armstrong <don@donarmstrong.com>.
 
 package Debbugs::Config;
 
@@ -44,16 +50,21 @@ BEGIN {
                                 qw($gSubmitList $gMaintList $gQuietList $gForwardList),
                                 qw($gDoneList $gRequestList $gSubmitterList $gControlList),
                                 qw($gStrongList),
+                                qw($gPackageVersionRe),
                                 qw($gSummaryList $gMirrorList $gMailer $gBug),
                                 qw($gBugs $gRemoveAge $gSaveOldBugs $gDefaultSeverity),
                                 qw($gShowSeverities $gBounceFroms $gConfigDir $gSpoolDir),
                                 qw($gIncomingDir $gWebDir $gDocDir $gMaintainerFile),
-                                qw($gMaintainerFileOverride $gPseudoDescFile $gPackageSource),
+                                qw($gMaintainerFileOverride $gPseudoMaintFile $gPseudoDescFile $gPackageSource),
                                 qw($gVersionPackagesDir $gVersionIndex $gBinarySourceMap $gSourceBinaryMap),
-                                qw($gSendmail $gLibPath $gSpamScan),
+                                qw($gVersionTimeIndex),
+                                qw($gSendmail $gLibPath $gSpamScan @gExcludeFromControl),
                                 qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
                                 qw(%gSearchEstraier),
-                                qw(@gPostProcessall),
+                                qw(%gDistributionAliases),
+                                qw(@gPostProcessall @gRemovalDefaultDistributionTags @gRemovalDistributionTags @gRemovalArchitectures),
+                                qw(@gRemovalStrongSeverityDefaultDistributionTags),
+                                qw($gTemplateDir),
                                ],
                     text     => [qw($gBadEmailPrefix $gHTMLTail $gHTMLExpireNote),
                                 ],
@@ -80,10 +91,14 @@ use Safe;
 %config = ();
 # untaint $ENV{DEBBUGS_CONFIG_FILE} if it's owned by us
 # This enables us to test things that are -T.
-if (exists $ENV{DEBBUGS_CONFIG_FILE} and
-    ${[stat($ENV{DEBBUGS_CONFIG_FILE})]}[4] = $<) {
-     $ENV{DEBBUGS_CONFIG_FILE} =~ /(.+)/;
-     $ENV{DEBBUGS_CONFIG_FILE} = $1;
+if (exists $ENV{DEBBUGS_CONFIG_FILE}) {
+     if (${[stat($ENV{DEBBUGS_CONFIG_FILE})]}[4] = $<) {
+         $ENV{DEBBUGS_CONFIG_FILE} =~ /(.+)/;
+         $ENV{DEBBUGS_CONFIG_FILE} = $1;
+     }
+     else {
+         die "Environmental variable DEBBUGS_CONFIG_FILE set, and $ENV{DEBBUGS_CONFIG_FILE} is not owned by the user running this script.";
+     }
 }
 read_config(exists $ENV{DEBBUGS_CONFIG_FILE}?$ENV{DEBBUGS_CONFIG_FILE}:'/etc/debbugs/config');
 
@@ -165,6 +180,15 @@ package links will not be made.
 
 set_default(\%config,'package_pages',undef);
 
+=item package_pages  $gUsertagPackageDomain
+
+Domain where where usertags of packages belong; defaults to $gPackagePages
+
+=cut
+
+set_default(\%config,'usertag_package_domain',$config{package_pages});
+
+
 =item subscription_domain $gSubscriptionDomain
 
 Domain where subscriptions to package lists happen
@@ -314,15 +338,50 @@ Default: 1
 
 set_default(\%config,'save_old_bugs',1);
 
+=item distribution_aliases
+
+Map of distribution aliases to the distribution name
+
+Default:
+         {experimental => 'experimental',
+         unstable     => 'unstable',
+         testing      => 'testing',
+         stable       => 'stable',
+         oldstable    => 'oldstable',
+         sid          => 'unstable',
+         lenny        => 'testing',
+         etch         => 'stable',
+         sarge        => 'oldstable',
+        }
+
+=cut
+
+set_default(\%config,'distribution_aliases',
+           {experimental => 'experimental',
+            unstable     => 'unstable',
+            testing      => 'testing',
+            stable       => 'stable',
+            oldstable    => 'oldstable',
+            sid          => 'unstable',
+            lenny        => 'testing',
+            etch         => 'stable',
+            sarge        => 'oldstable',
+           },
+          );
+
+
+
 =item distributions
 
 List of valid distributions
 
-Default: qw(experimental unstable testing stable oldstable);
+Default: The values of the distribution aliases map.
 
 =cut
 
-set_default(\%config,'distributions',[qw(experimental unstable testing stable oldstable)]);
+my %_distributions_default;
+@_distributions_default{values %{$config{distribution_aliases}}} = values %{$config{distribution_aliases}};
+set_default(\%config,'distributions',[keys %_distributions_default]);
 
 =item removal_distribution_tags
 
@@ -348,6 +407,97 @@ set_default(\%config,'removal_default_distribution_tags',
            [qw(unstable testing)]
           );
 
+=item removal_strong_severity_default_distribution_tags
+
+For removal/archival purposes, all bugs with strong severity are
+assumed to have these tags set.
+
+Default: qw(unstable testing stable);
+
+=cut
+
+set_default(\%config,'removal_strong_severity_default_distribution_tags',
+           [qw(unstable testing stable)]
+          );
+
+
+=item removal_architectures
+
+For removal/archival purposes, these architectures are consulted if
+there is more than one architecture applicable. If the bug is in a
+package not in any of these architectures, the architecture actually
+checked is undefined.
+
+Default: qw(i386 amd64 arm ppc sparc alpha);
+
+=cut
+
+set_default(\%config,'removal_architectures',
+           [qw(i386 amd64 arm ppc sparc alpha)]
+          );
+
+
+=item package_name_re
+
+The regex which will match a package name
+
+Default: '[a-z0-9][a-z0-9\.+-]+'
+
+=cut
+
+set_default(\%config,'package_name_re',
+           '[a-z0-9][a-z0-9\.+-]+');
+
+=item package_version_re
+
+The regex which will match a package version
+
+Default: '[A-Za-z0-9:+\.-]+'
+
+=cut
+
+set_default(\%config,'package_version_re',
+           '[A-Za-z0-9:+\.~-]+');
+
+
+=item control_internal_requester
+
+This address is used by Debbugs::Control as the request address which
+sent a control request for faked log messages.
+
+Default:"Debbugs Internal Request <$config{maintainer_email}>"
+
+=cut
+
+set_default(\%config,'control_internal_requester',
+           "Debbugs Internal Request <$config{maintainer_email}>",
+          );
+
+=item control_internal_request_addr
+
+This address is used by Debbugs::Control as the address to which a
+faked log message request was sent.
+
+Default: "internal_control\@$config{email_domain}";
+
+=cut
+
+set_default(\%config,'control_internal_request_addr',
+           'internal_control@'.$config{email_domain},
+          );
+
+
+=item exclude_from_control
+
+Addresses which are not allowed to send messages to control
+
+=cut
+
+set_default(\%config,'exclude_from_control',[]);
+
+
+
+
 set_default(\%config,'default_severity','normal');
 set_default(\%config,'show_severities','critical, grave, normal, minor, wishlist');
 set_default(\%config,'strong_severities',[qw(critical grave)]);
@@ -373,13 +523,75 @@ set_default(\%config,'web_dir','/var/lib/debbugs/www');
 set_default(\%config,'doc_dir','/var/lib/debbugs/www/txt');
 set_default(\%config,'lib_path','/usr/lib/debbugs');
 
+
+=item template_dir
+
+directory of templates; defaults to /usr/share/debbugs/templates.
+
+=cut
+
+set_default(\%config,'template_dir','/usr/share/debbugs/templates');
+
+
 set_default(\%config,'maintainer_file',$config{config_dir}.'/Maintainers');
 set_default(\%config,'maintainer_file_override',$config{config_dir}.'/Maintainers.override');
+set_default(\%config,'pseudo_maint_file',$config{config_dir}.'/pseudo-packages.maint');
 set_default(\%config,'pseudo_desc_file',$config{config_dir}.'/pseudo-packages.description');
 set_default(\%config,'package_source',$config{config_dir}.'/indices/sources');
 
+
+=item version_packages_dir
+
+Location where the version package information is kept; defaults to
+spool_dir/../versions/pkg
+
+=cut
+
 set_default(\%config,'version_packages_dir',$config{spool_dir}.'/../versions/pkg');
 
+=item version_time_index
+
+Location of the version/time index file. Defaults to
+spool_dir/../versions/idx/versions_time.idx if spool_dir/../versions
+exists; otherwise defaults to undef.
+
+=cut
+
+
+set_default(\%config,'version_time_index', -d $config{spool_dir}.'/../versions' ? $config{spool_dir}.'/../versions/indices/versions_time.idx' : undef);
+
+=item version_index
+
+Location of the version index file. Defaults to
+spool_dir/../versions/indices/versions.idx if spool_dir/../versions
+exists; otherwise defaults to undef.
+
+=cut
+
+set_default(\%config,'version_index',-d $config{spool_dir}.'/../versions' ? $config{spool_dir}.'/../versions/indices/versions.idx' : undef);
+
+=item binary_source_map
+
+Location of the binary -> source map. Defaults to
+spool_dir/../versions/indices/bin2src.idx if spool_dir/../versions
+exists; otherwise defaults to undef.
+
+=cut
+
+set_default(\%config,'binary_source_map',-d $config{spool_dir}.'/../versions' ? $config{spool_dir}.'/../versions/indices/binsrc.idx' : undef);
+
+=item source_binary_map
+
+Location of the source -> binary map. Defaults to
+spool_dir/../versions/indices/src2bin.idx if spool_dir/../versions
+exists; otherwise defaults to undef.
+
+=cut
+
+set_default(\%config,'source_binary_map',-d $config{spool_dir}.'/../versions' ? $config{spool_dir}.'/../versions/indices/srcbin.idx' : undef);
+
+
+
 set_default(\%config,'post_processall',[]);
 
 =item sendmail