Add mail stuff from old code
authorFrank Lichtenheld <frank@lichtenheld.de>
Tue, 28 Feb 2006 21:41:42 +0000 (21:41 +0000)
committerFrank Lichtenheld <frank@lichtenheld.de>
Tue, 28 Feb 2006 21:41:42 +0000 (21:41 +0000)
bin/build-maintainerdb [new file with mode: 0755]
conf/maintainerdb.override [new file with mode: 0644]
cron.d/300maintainerdb [new file with mode: 0755]
mail/aliases [new file with mode: 0644]
mail/dot.forward-default [new file with mode: 0644]

diff --git a/bin/build-maintainerdb b/bin/build-maintainerdb
new file mode 100755 (executable)
index 0000000..af4e19e
--- /dev/null
@@ -0,0 +1,158 @@
+#! /usr/bin/perl
+
+#   build-maintainerdb - convert several Packages files to maintainer database
+#   Copyright (c) 1998,9,2001,3,4  Martin Schulze <joey@debian.org>
+
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id$
+
+#   Todo:
+#    . Read maintainer changes from overrides file(s), need to rub
+#      out all existing entries
+
+# read the configuration
+if (!open (C, "../config.sh")) {
+    printf "\nInternal Error: Cannot open configuration file.\n\n";
+    exit 0;
+}
+while (<C>) {
+    $topdir = $1 if (/^\s*topdir="?(.*)"?\s*$/);
+}
+close (C);
+
+$maintainerfile = "$topdir/archive/Maintainers";
+$maintainerdb = "$topdir/files/maintainerdb";
+$overridefile = "$topdir/conf/maintainerdb.override";
+
+sub package_maintainer
+{
+    my $pkg = shift;
+    my $login = shift;
+    my $addr = shift;
+    my $home = "/debian/home/$login";
+
+    if (-d $home) {
+       if (-f "$home/.forward-$pkg") {
+           return "$login-$pkg\@master.debian.org";
+       }
+    }
+    return $addr;
+}
+
+sub read_maintainer
+{
+    my $file = shift;
+    my $package;
+    my $maintainer;
+    my $maint;
+
+    open (F, "$file") || die "Can't open $file, $!";
+    printf "Reading %s\n", $file if ($opt_verbose);
+    while (<F>) {
+       next if (/^#/);
+       next if (/^$/);
+       /(\S+)\s+(.*)/;
+       $package=$1; $maint=$2;
+       if (! exists $maint{$package}) {
+           printf "  EVAL (%s, \"%s\")\n", $package, $maint if ($opt_verbose > 2);
+
+               if (exists $maint{$package}) {
+                   $maint{$package} .= " ";
+                   printf "  EXPAND (%s)\n", $package if ($opt_verbose > 2);
+               }
+               if ($maint =~ /.*<(.*)>/) {
+                   $maint{$package} .= $1;
+                   printf "  ADD (%s, %s)\n", $package, $1 if ($opt_verbose > 2);
+               } elsif ($maint =~ /\s*(\S+)\s+\(.*\)/) {
+                   $maint{$package} .= $1;
+                   printf "  ADD (%s, %s)\n", $package, $1 if ($opt_verbose > 2);
+               } else {
+                   $maint{$package} .= $maint;
+                   printf "  ADD (%s, %s)\n", $package, $maint if ($opt_verbose > 2);
+               }
+
+           printf "  %s: %s\n", $package, $maint{$package} if ($opt_verbose > 1);
+           $pkgshort = "";
+           if ($package =~ /(.*[^\d\.]+)([\d\.]*\d)$/) {
+               $pkgshort = $1;
+               $maint{$pkgshort} = $maint{$package} if (! exists $maint{$pkgshort});
+               printf "  %s: %s\n", $pkgshort, $maint{$package} if ($opt_verbose > 1);
+           }
+           if ($maint{$package} =~ /([^\@]+)\@(master\.)?debian\.org/) {
+               $addrsave = $maint{$package} if ($opt_verbose > 1);
+               $maint{$package} = package_maintainer ($package, $1, $maint{$package});
+               printf "  Changed to %s\n", $maint{$package} if ($opt_verbose > 1 && ($addrsave ne $maint{$package}));
+               if (length ($pkgshort) > 0) {
+                   $maint{$pkgshort} = package_maintainer ($pkg, $1, $maint{$pkgshort});
+               }
+           }
+       } else {
+           printf "Skipping double $package\n" if ($opt_verbose);
+           printf "LINE: $_" if ($opt_verbose > 2);
+       }
+    }
+    close (F);
+}
+
+sub write_maintainer
+{
+    my $file = shift;
+
+    printf "Writing to %s.new\n", $file if ($opt_verbose > 0);
+    open (CONF, ">$file.new") || die "Can't open $file.new, $!";
+    foreach $package (sort(keys(%maint))) {
+       printf "%s -> %s\n", $package, $maint{$package} if ($opt_verbose > 1);
+       printf CONF "%s:%s\n", $package, $maint{$package};
+    }
+    close (CONF);
+    printf "Renaming to %s\n", $file if ($opt_verbose > 0);
+    system "mv -f $file.new $file";
+}
+
+sub help
+{
+    print "build-maintainerdb - Build the maintainer db for packages.debian.org.\n";
+    print "-d     debug, changes output file to ./maintainerdb\n";
+    print "-h     This help\n";
+    print "-v     Increase verbosity by 1\n";
+    print "-vv    Increase verbosity by 2\n";
+    print "-vvv   Increase verbosity by 3\n";
+}
+
+# 
+# Main program
+#
+$opt_verbose = 0;
+while ($#ARGV > -1) {
+    if ($ARGV[0] eq "-v") {
+       $opt_verbose++;
+    } elsif ($ARGV[0] eq "-vv") {
+       $opt_verbose+= 2;
+    } elsif ($ARGV[0] eq "-vvv") {
+       $opt_verbose+= 3;
+    } elsif ($ARGV[0] eq "-h") {
+       help();
+    } elsif ($ARGV[0] eq "-d") {
+       $maintainerdb = "./maintainerdb";
+    }
+    shift;
+}
+
+&read_maintainer ($overridefile);
+&read_maintainer ($maintainerfile);
+
+&write_maintainer ($maintainerdb);
+
diff --git a/conf/maintainerdb.override b/conf/maintainerdb.override
new file mode 100644 (file)
index 0000000..c2bed2f
--- /dev/null
@@ -0,0 +1,10 @@
+packages.debian.org  Martin Schulze <joey@debian.org>
+nonus.debian.org     Archive Maintenance <ftp.debian.org@packages.debian.org>
+nonus                NonUS Archive <nonus.debian.org@packages.debian.org>
+non-us               NonUS Archive <nonus.debian.org@packages.debian.org>
+bugs                 Bug Tracking System <bugs.debian.org@packages.debian.org>
+aboot                jeff@planetfall.com (Jefferson E. Noxon)
+blt8.0               g.russell@dcs.napier.ac.uk
+egcs                 debian-gcc@lists.debian.org
+gcc                  debian-gcc@lists.debian.org
+glibc               debian-glibc@lists.debian.org
diff --git a/cron.d/300maintainerdb b/cron.d/300maintainerdb
new file mode 100755 (executable)
index 0000000..6e54a9c
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. `dirname $0`/../config.sh
+
+if [ ! -e ${archivedir}/Maintainers ]
+then
+    ln -s ${ftproot}/debian/indices/Maintainers ${archivedir}/Maintainers
+fi
+
+cd ${bindir}
+${bindir}/build-maintainerdb
diff --git a/mail/aliases b/mail/aliases
new file mode 100644 (file)
index 0000000..ace74b6
--- /dev/null
@@ -0,0 +1,14 @@
+root: joey@debian.org
+admin: joey@debian.org
+sysop: joey@debian.org
+debian: debian@debian.org
+postmaster: joey@debian.org
+MAILER_DAEMON: joey@debian.org
+usenet: joey@debian.org
+news: joey@debian.org
+newsmaster: joey@debian.org
+joey: joey@debian.org
+
+submit: submit@bugs.debian.org
+
+base: base-files@packages.debian.org, base-passwd@packages.debian.org
diff --git a/mail/dot.forward-default b/mail/dot.forward-default
new file mode 100644 (file)
index 0000000..76b8f82
--- /dev/null
@@ -0,0 +1,13 @@
+# Exim Filter
+# /org/packages.debian.org/mail/.forward-default
+
+# This filter looks up the package name in the maintainer database, if it is
+# not found then a bounce message is generated. Although the docs say you
+# can put spaces in the $lookup stuff you can't, don't try it.
+if ${lookup{${local_part}}lsearch{/org/packages.debian.org/files/maintainerdb}{$value}{unknown}} is "unknown"
+then
+   save /dev/null
+else
+   seen deliver ${lookup{${local_part}}partial-lsearch{/org/packages.debian.org/files/maintainerdb}{$value}}
+endif
+