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

Bug#202158: Revised patch



tag 202158 + patch
thanks

On Mon, Sep 15, 2003 at 11:07:04PM -0700, Matt Kraai wrote:
> On Mon, Sep 15, 2003 at 09:34:23PM +0200, Frank Lichtenheld wrote:
> > Due to the changes to people.pl in the last weeks, my uploaders patch
> > doesn't apply clean anymore. Attached is a revised patch against the
> > current cvs version.
> 
> Thanks for the patch.  Unfortunately, it has some problems.
> 
> When I run it, it produces the following output:
> 
>  re-creating people.names file...
>  Unknown maintainer format:
>  matthew@debian.org
>  Unknown maintainer format:
>  matthew@debian.org
>  Unknown maintainer format:
>  matthew@debian.org
>  Unknown maintainer format:
>  matthew@debian.org
>  Unknown maintainer format:
>  matthew@debian.org
>  installing the updated people.names file into webwml...
> 
> Could it be made to handle these?

Hmm, in the original script this is not a warning but a fatal error (it
dies). How should I handle it? Just don't output the warning? Otherwise
it will probably require changes at different places all over the
script.

> It lists packages twice if someone is both a maintainer and an
> uploader.  See Andreas Barth, for instance.

Fixed.

> It mangles the e-mail address of Ben Bell, bjb@debian.org.

Fixed.

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/
Index: people.pl
===================================================================
RCS file: /cvs/webwml/cron/people_scripts/people.pl,v
retrieving revision 1.11
diff -u -b -r1.11 people.pl
--- people.pl	28 Aug 2003 06:15:52 -0000	1.11
+++ people.pl	16 Sep 2003 10:20:01 -0000
@@ -106,6 +106,22 @@
 	}
 }
 
+sub process_source_file {
+	my ($filename,$distribution) = @_;
+	my ($temp, $member, $name, $nname);
+
+	open (PKG, $filename) or return;
+	while (<PKG>) {
+		if (/^$/) {
+			process_src_package($distribution);
+			$package_info = "";
+		}
+		else {
+			$package_info .= $_;
+		}
+	}
+}
+
 sub process_package {
 	my ($distribution) = @_;
 	chop $package_info;
@@ -124,6 +140,36 @@
 	}
 }
 
+sub process_src_package {
+	my ($distribution) = @_;
+	my (@packages, $maintainer, @uploaders);
+
+	chop $package_info;
+	@package_pieces = split(/\n\b/, $package_info);
+	foreach (@package_pieces) {
+		if (/^binary:\s+(.+)$/io) {
+			@packages = split /\s*,\s*/, $1;
+		}
+		elsif (/^maintainer:\s+(.+)$/io) {
+			$maintainer = $1;
+		}
+		elsif (/^uploaders:\s+(.+)$/io) {
+		    # this seems ugly but works
+		    # improvements welcome
+		    @uploaders = split />\s*,\s*/, $1;
+		    map { $_ = "$_>" if ($_ =~ /</) 
+			      && ($_ !~ />/); } @uploaders;
+		}
+	}
+	foreach my $pack (@packages) {
+	    if (!defined $package{$pack}) {
+		$package{$pack}{distribution} = $distribution;
+		$package{$pack}{maintainer} = $maintainer;
+	    }
+	    $package{$pack}{uploaders} = \@uploaders if @uploaders;
+	}
+}
+
 # function contributed by Tomohiro Kubota
 sub from_utf8_or_iso88591_to_sgml ($) {
     my $str = shift;
@@ -157,19 +203,17 @@
     }
 }
 
-sub canonical_names {
-	PACK: foreach $pack (keys %package) {
-		$maintainer = $package{$pack}{maintainer};
+sub process_name {
+    my ($maintainer) = @_;
 		$maintainer =~ s/&/&amp;/g;
 
+    my ($lastname, $firstname, $email);
+
 		# Take care of the special cases first
 		foreach (@special_maintainer) {
 			if ($maintainer =~ /($_).*<(.+)>\s*/) {
 				$lastname = "$1"; $firstname = ""; $email = $2;
-				$package{$pack}{lastname} = $lastname;
-				$package{$pack}{firstname} = $firstname;
-				$package{$pack}{email} = $email;
-				next PACK;
+				return ($lastname, $firstname, $email);
 			}
 		}
 		$maintainer = from_utf8_or_iso88591_to_sgml($maintainer);
@@ -177,7 +221,7 @@
 		if ($maintainer =~ /Debian Quality Assurance.*<(.+)>/) {
 			$lastname = 'Debian QA Group'; $firstname = ''; $email = $1;
 		}
-		if ($maintainer =~ /Boot Floppies Team <(.+)>/) {
+		elsif ($maintainer =~ /Boot Floppies Team <(.+)>/) {
 			$lastname = 'Debian Install System Team'; $firstname = ''; $email = $1;
 		}
 		elsif ($maintainer =~ /Javier Fernandez-Sanguino Pen~a\s+<(.+)>/o) {
@@ -234,7 +278,7 @@
 		elsif ($maintainer =~ /Jose Carlos Garcia Sogo <(.+)>/) {
 			$lastname = 'Garcia Sogo' ; $firstname = 'Jose Carlos'; $email = $1;
 		}
-		elsif ($maintainer =~ /Luca - De Whiskey's - De Vitis <(.+)>/) {
+		elsif ($maintainer =~ /Luca - De Whiskey's - De Vitis <(.+)>/) { #'
 			$lastname = 'De Vitis' ; $firstname = 'Luca'; $email = $1;
 		}
 		elsif ($maintainer =~ /Chris(topher)? L\.? Cheney <(.+)>/) {
@@ -318,52 +362,44 @@
 		# Only an email address is given
 		elsif ($maintainer =~ /(.+)*/o) {
 			$_ = $1;
-			print "$_ X\n";
-			die "Unknown maintainer format:\n$_\n";
+#			print "$_ X\n";
+			warn "Unknown maintainer format:\n$_\n";
+			return;
 			# this error ends up being sent via cron mail
 		}
+    return ($lastname, $firstname, $email);
+}
+
+sub canonical_names {
+	PACK: foreach $pack (keys %package) {
+		$maintainer = $package{$pack}{maintainer};
+
+		my ($lastname, $firstname, $email) = process_name($maintainer);
+
+		next unless $lastname;
 
 		$package{$pack}{lastname} = $lastname;
 		$package{$pack}{firstname} = $firstname;
 		$package{$pack}{email} = $email;
-	}
-}
-
-
-# some old, obsolete code:
 
-# # Add this package onto the list
-# #    if (/^Maintainer: /) {
-# #       $People{"$lastname:$firstname"}{email} = $email;
-# #       push @{ $People{"$lastname:$firstname"}{$distribution} }, $pname;
-#        #$temp = $#{ $People{"$lastname:$firstname"}{$distribution} };
-# #print "temp=$temp, lastname=$lastname, firstname=$firstname, email=$email, dist=$distribution, dist=$distribution, pname=$pname\n";
-# #print @{ $People{"$lastname:$firstname"}{$distribution} }."\n";
-#        #if ($temp == -1) {
-#        #   push @{ $People{"$lastname:$firstname"}{$distribution} }, $pname;
-#        #}
-#        #else {
-#        #   $member=0;
-#        #   foreach (@{ $People{"$lastname:$firstname"}{$distribution} }) {
-#        #      if ($_ eq $pname) {
-#        #         $member = 1;
-#        #         last;
-#        #      }
-#        #   }
-#        #   if ($member == 0) {
-#        #      push @{ $People{"$lastname:$firstname"}{$distribution} }, $pname;
-#        #   }
-#        #}
-# #    }
-# # }
-# #}
+		my @uploaders;
+		foreach my $uploader (@{$package{$pack}{uploaders}}) {
+		    my ($ulastname, $ufirstname, $uemail) = process_name($uploader);
+		    next unless $ulastname;
+		    next if ($package{$pack}{lastname} eq $ulastname)
+			&& ($package{$pack}{firstname} eq $ufirstname);
+#		    warn "process_name: $uploader: $ulastname, $ufirstname\n";
+		    push( @uploaders, { lastname => $ulastname,
+				       firstname => $ufirstname,
+				       email => $uemail, } )
+			if $ulastname;
+		}
+		$package{$pack}{uploadernames} = \@uploaders if @uploaders;
+	    }
+      }
 
-sub create_maintainer_list {
-	foreach $pack (keys %package) {
-		$distribution = $package{$pack}{distribution};
-		$lastname = $package{$pack}{lastname};
-		$firstname = $package{$pack}{firstname};
-		$email = $package{$pack}{email};
+sub insert_maintainer {
+    my ($lastname, $firstname, $email, $distribution, $pack) =@_;
 
 		if (!exists $People{"$lastname:$firstname"}) {
 			@namelist = keys %People;
@@ -379,7 +415,28 @@
 			$People{"$lastname:$firstname"}{email} = $email;
 		}
 		push( @{$People{"$lastname:$firstname"}{$distribution}}, $pack );
+}
 
+sub create_maintainer_list {
+	foreach my $pack (keys %package) {
+		my $distribution = $package{$pack}{distribution};
+		my $lastname = $package{$pack}{lastname} || "";
+		my $firstname = $package{$pack}{firstname} || "";
+		my $email = $package{$pack}{email} || "";
+
+		insert_maintainer( $lastname, $firstname, $email,
+				   $distribution, $pack );
+
+		foreach my $uploader (@{$package{$pack}{uploadernames}}) {
+		    my $ulastname = $uploader->{lastname} || "";
+		    my $ufirstname = $uploader->{firstname} || "";
+		    my $uemail = $uploader->{email} || "";
+		    
+#		    warn "uploader: $ufirstname, $ulastname, $pack\n";
+		    insert_maintainer( $ulastname, $ufirstname, $uemail,
+				       $distribution, 
+				       "$pack\*" );
+		}
 	}
 }
 
@@ -450,27 +507,33 @@
 # and now, the script body itself.
 
 # go through Packages files one at a time
+    my $section;
 while ($file = shift @ARGV) {
     if ($file =~ m,main.*non-US,) {
-        process_package_file($file, 'nonusmain');
+        $section = 'nonusmain';
     }
     elsif ($file =~ m,contrib.*non-US,) {
-        process_package_file($file, 'nonuscontrib');
+        $section = 'nonuscontrib';
     }
     elsif ($file =~ m,non-free.*non-US,) {
-        process_package_file($file, 'nonusnonfree');
+        $section = 'nonusnonfree';
     }
     elsif ($file =~ m,main,) {
-        process_package_file($file, 'main');
+        $section = 'main';
     }
     elsif ($file =~ m,contrib,) {
-        process_package_file($file, 'contrib');
+        $section = 'contrib';
     }
     elsif ($file =~ m,non-free,) {
-        process_package_file($file, 'nonfree');
+        $section = 'nonfree';
     }
     else {
         die "can't determine distribution from file name: $file";
+    }
+    if ($file =~ m,Sources,) {
+	process_source_file($file, $section);
+    } else {
+	process_package_file($file, $section);
     }
 }
 
Index: update.packages+sources
===================================================================
RCS file: /cvs/webwml/cron/people_scripts/update.packages+sources,v
retrieving revision 1.1
diff -u -b -r1.1 update.packages+sources
--- update.packages+sources	22 Nov 2002 14:24:11 -0000	1.1
+++ update.packages+sources	16 Sep 2003 10:20:03 -0000
@@ -10,6 +10,12 @@
 
 cd $base_dir
 
+echo "retrieving latest versions of Sources files..."
+for sect in main contrib non-free; do
+    wget $verbose http://${mirror}/debian/dists/unstable/${sect}/source/Sources.gz
+    [ ! -f Sources.gz ] || { gunzip Sources; mv Sources ${sect}.Sources; chmod g+w ${sect}.Sources; }
+done
+
 echo "retrieving latest versions of Packages files..."
 for arch in $arches; do
   if [ ! -d $arch ] ; then mkdir $arch ; fi
@@ -17,6 +23,12 @@
     wget $verbose http://${mirror}/debian/dists/unstable/${sect}/binary-${arch}/Packages
     [ ! -f Packages ] || { mv Packages ${arch}/${sect}.Packages; chmod g+w ${arch}/${sect}.Packages; }
   done
+done
+
+echo "retrieving latest versions of non-US Sources files..."
+for sect in main contrib non-free; do
+    wget $verbose http://${mirror_nonus}/debian-non-US/dists/unstable/non-US/${sect}/source/Sources.gz
+    [ ! -f Sources.gz ] || { gunzip Sources; mv Sources ${sect}.Sources.non-US; chmod g+w ${sect}.Sources.non-US; }
 done
 
 echo "retrieving latest versions of non-US Packages files..."
Index: update.people.html
===================================================================
RCS file: /cvs/webwml/cron/people_scripts/update.people.html,v
retrieving revision 1.4
diff -u -b -r1.4 update.people.html
--- update.people.html	28 Aug 2003 06:12:52 -0000	1.4
+++ update.people.html	16 Sep 2003 10:20:03 -0000
@@ -7,7 +7,7 @@
 cd $base_dir
 
 echo "re-creating people.names file..."
-./people.pl {alpha,arm,hppa,hurd-i386,i386,ia64,m68k,mips,mipsel,powerpc,s390,sparc}/{main,contrib,non-free}.Packages{,.non-US,.debian-installer} > people.names.new
+./people.pl {alpha,arm,hppa,hurd-i386,i386,ia64,m68k,mips,mipsel,powerpc,s390,sparc}/{main,contrib,non-free}.Packages{,.non-US,.debian-installer} {main,contrib,non-free}.Sources{,.non-US} > people.names.new
 
 echo "installing the updated people.names file into webwml..."
 install -g debwww -m 664 people.names.new $dest_dir/people.names

Reply to: