]> git.deb.at Git - deb/packages.git/blobdiff - bin/build-maintainerdb
Comment clean-up: Remove $Id$, fix FSF address, copyright years
[deb/packages.git] / bin / build-maintainerdb
index af4e19e1f615a84dc9f383228576dd35d7634e8f..9125664822f9c9aa617e5a25a20903da0aa4a06b 100755 (executable)
@@ -1,41 +1,49 @@
 #! /usr/bin/perl
 
 #   build-maintainerdb - convert several Packages files to maintainer database
-#   Copyright (c) 1998,9,2001,3,4  Martin Schulze <joey@debian.org>
-
+#   Copyright (c) 1998,9,2001,3,4,6  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$
+#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 #   Todo:
 #    . Read maintainer changes from overrides file(s), need to rub
 #      out all existing entries
 
+use strict;
+use warnings;
+
 # read the configuration
 if (!open (C, "../config.sh")) {
-    printf "\nInternal Error: Cannot open configuration file.\n\n";
+    print "\nInternal Error: Cannot open configuration file.\n\n";
     exit 0;
 }
+my $topdir = "/org/packages.debian.org";
 while (<C>) {
     $topdir = $1 if (/^\s*topdir="?(.*)"?\s*$/);
 }
 close (C);
 
-$maintainerfile = "$topdir/archive/Maintainers";
-$maintainerdb = "$topdir/files/maintainerdb";
-$overridefile = "$topdir/conf/maintainerdb.override";
+my $maildomain = "packages.debian.org";
+
+my $maintainerfile = "$topdir/archive/Maintainers";
+my $maintainerdb = "$topdir/conf/maintainer";
+my $overridefile = "$topdir/conf/maintainerdb.override";
+my @postcall = ( "/usr/sbin/postmap", $maintainerdb );
+my $opt_verbose = 0;
+
+my %maint;
 
 sub package_maintainer
 {
@@ -85,18 +93,18 @@ sub read_maintainer
                }
 
            printf "  %s: %s\n", $package, $maint{$package} if ($opt_verbose > 1);
-           $pkgshort = "";
+           my $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);
+               my $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});
+                   $maint{$pkgshort} = package_maintainer ($pkgshort, $1, $maint{$pkgshort});
                }
            }
        } else {
@@ -113,13 +121,15 @@ sub write_maintainer
 
     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))) {
+    foreach my $package (sort(keys(%maint))) {
        printf "%s -> %s\n", $package, $maint{$package} if ($opt_verbose > 1);
-       printf CONF "%s:%s\n", $package, $maint{$package};
+       printf CONF "%s@%s\t%s\n", $package, $maildomain, $maint{$package};
     }
     close (CONF);
     printf "Renaming to %s\n", $file if ($opt_verbose > 0);
     system "mv -f $file.new $file";
+    printf "Executing @postcall\n" if ($opt_verbose > 0);
+    system @postcall;
 }
 
 sub help
@@ -135,7 +145,6 @@ sub help
 # 
 # Main program
 #
-$opt_verbose = 0;
 while ($#ARGV > -1) {
     if ($ARGV[0] eq "-v") {
        $opt_verbose++;