From f4882a82887dff190b618820969b0bc1dbe3cbda Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 2 Mar 2006 23:53:28 +0000 Subject: [PATCH] - Merge in some changes by Joey - Some code cleanup --- bin/build-maintainerdb | 39 ++++++++++++++++++++----------- cron.d/100syncarchive_maintainers | 21 +++++++++++++++++ cron.d/300maintainerdb | 5 ---- 3 files changed, 46 insertions(+), 19 deletions(-) create mode 100755 cron.d/100syncarchive_maintainers diff --git a/bin/build-maintainerdb b/bin/build-maintainerdb index af4e19e..1978854 100755 --- a/bin/build-maintainerdb +++ b/bin/build-maintainerdb @@ -1,18 +1,18 @@ #! /usr/bin/perl # build-maintainerdb - convert several Packages files to maintainer database -# Copyright (c) 1998,9,2001,3,4 Martin Schulze - +# Copyright (c) 1998,9,2001,3,4,6 Martin Schulze +# # 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. @@ -23,19 +23,29 @@ # . 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 () { $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 +95,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 +123,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 +147,6 @@ sub help # # Main program # -$opt_verbose = 0; while ($#ARGV > -1) { if ($ARGV[0] eq "-v") { $opt_verbose++; diff --git a/cron.d/100syncarchive_maintainers b/cron.d/100syncarchive_maintainers new file mode 100755 index 0000000..adb5f7f --- /dev/null +++ b/cron.d/100syncarchive_maintainers @@ -0,0 +1,21 @@ +#! /bin/bash + +. `dirname $0`/../config.sh + +test -d ${archivedir} || mkdir -p ${archivedir} +cd ${archivedir} + +# scp -q auric:/org/ftp.debian.org/ftp/indices/Maintainers . + +if [ -f /org/ftp.root/debian/indices/Maintainers ] +then + if [ ! -s Maintainers -a -L Maintainers ] + then + ln -s /org/ftp.root/debian/indices/Maintainers . + fi +else + if [ ! -L Maintainers ] + then + wget -q -O Maintainers ftp://ftp.debian.org/debian/indices/Maintainers + fi +fi diff --git a/cron.d/300maintainerdb b/cron.d/300maintainerdb index 6e54a9c..898a4c0 100755 --- a/cron.d/300maintainerdb +++ b/cron.d/300maintainerdb @@ -2,10 +2,5 @@ . `dirname $0`/../config.sh -if [ ! -e ${archivedir}/Maintainers ] -then - ln -s ${ftproot}/debian/indices/Maintainers ${archivedir}/Maintainers -fi - cd ${bindir} ${bindir}/build-maintainerdb -- 2.39.2