[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#824085: Updated patch ready to commit to git



Hello,

I just discovered that there was a git repository[1] where this script
is managed. I have slightly updated my patch to also skip maintainer
emails in @tracker.debian.org.

I can commit it directly if you wish since I'm part of webwml. But I can't
deploy it since I'm not part of pkg_maint.

Attached is the patch generated with git format-patch.

[1] http://anonscm.debian.org/cgit/webwml/packages.git in branch
debian-master
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/
>From 5f4f27920e996e521d32dfb5a9693a09348d18d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Fri, 13 May 2016 11:42:09 +0200
Subject: [PATCH] bin/build-maintainerdb: use tracker.debian.org instead of
 packages.qa.debian.org

We now forwards mails to the correct email address at tracker.debian.org.
packages.qa.debian.org is no longer responsible of email subscriptions to
packages. cf
https://lists.debian.org/debian-devel-announce/2015/12/msg00001.html

The code registering packages maintainer emails has been factored
in a new function that applies some supplementary checks:
- we skip maintainer emails in @packages.debian.org (we don't want loops)
- we skip maintainer emails in @tracker.debian.org (we already forward
  emails to dispatch+package_contact@, no need to forward them also to
  another tracker.debian.org address)

Those changes will additionnaly make it possible to use foo@packages.debian.org
(or future teams+foo@tracker.debian.org) emails in package maintainer field
and have all co-maintainers subscribed through the Debian package tracker.
---
 bin/build-maintainerdb | 52 +++++++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/bin/build-maintainerdb b/bin/build-maintainerdb
index 0767e80..da4eb29 100755
--- a/bin/build-maintainerdb
+++ b/bin/build-maintainerdb
@@ -35,7 +35,7 @@ if (!open (C, "../config.sh")) {
     print "\nInternal Error: Cannot open configuration file.\n\n";
     exit 0;
 }
-my $topdir = "/org/packages.debian.org";
+my $topdir = "/srv/packages.debian.org";
 my $localdir = "/srv/mirrors/debian/";
 
 while (<C>) {
@@ -44,8 +44,8 @@ while (<C>) {
 }
 close (C);
 
-#my $maildomain = "packages.debian.org";
-my $ptsdomain = "packages.qa.debian.org";
+my $maildomain = "packages.debian.org";
+my $trackerdomain = "tracker.debian.org";
 
 
 my $maintainerfile = "$localdir/indices/Maintainers";
@@ -119,6 +119,22 @@ sub package_maintainer
     return $addr;
 }
 
+sub add_maintainer
+{
+    my $package = shift;
+    my $email = shift;
+
+    $maint{$package} //= "";
+
+    if ($email =~ /\@\Q$maildomain\E$/ or $email =~ /\@\Q$trackerdomain\E$/) {
+	return;  # Ignore maintainer emails in @packages.d.o or @tracker.d.o
+    }
+
+    $maint{$package} .= " " if ($maint{$package});
+    $maint{$package} .= $email;
+    printf "  ADD (%s, %s)\n", $package, $email if ($opt_verbose > 2);
+}
+
 sub read_maintainer
 {
     my $file = shift;
@@ -136,20 +152,13 @@ sub read_maintainer
 	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);
-		}
+	    if ($maint =~ /.*<(.*)>/) {
+		add_maintainer($package, $1);
+	    } elsif ($maint =~ /\s*(\S+)\s+\(.*\)/) {
+		add_maintainer($package, $1);
+	    } else {
+		add_maintainer($package, $maint);
+	    }
 
 	    printf "  %s: %s\n", $package, $maint{$package} if ($opt_verbose > 1);
 
@@ -191,13 +200,12 @@ sub write_maintainer
     open (CALLOUT, ">$calloutfile.new") || die "Can't open $file.new, $!";
     my $forward;
     foreach my $package (sort(keys(%maint))) {
-# It is possible that we do not know a source package -> in that case fall back to old behaviour
-# and only mail the maintainer. Can happen when pdo doesnt know the suite the source is in, like
-# it doesnt know oldstable-proposed-updates at date of writing this code.
-	$forward = "$maint{$package}";
 	if ($binsrc{$package}) {
-	    $forward .= ", $binsrc{$package}_contact\@$ptsdomain";
+	    $forward = "dispatch+$binsrc{$package}_contact\@$trackerdomain";
+	} else {
+	    $forward = "dispatch+${package}_contact\@$trackerdomain";
 	}
+	$forward .= ", $maint{$package}" if $maint{$package};
 	printf "%s -> %s\n", $package, $forward if ($opt_verbose);
 	printf CONF "%s:\t%s\n", $package, $forward;
 	printf WRITE "+%d,%d:%s->%s\n", length($package), length($forward), $package, $forward;
-- 
2.8.1


Reply to: