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

Bug#202158: devel/people should list co-maintained packages as well



tags 202158 + patch
thanks

On Sat, Aug 02, 2003 at 09:59:31PM +0200, Frank Lichtenheld wrote:
> On Sun, Jul 20, 2003 at 12:01:24PM +0200, Martin Michlmayr wrote:
> > At the moment, http://www.debian.org/devel/people does not take the
> > Uploaders: field into account at all.  It would be great if the page
> > could indicate that you are the uploader (i.e. co-maintainer) of a
> > package.
> 
> I've been working on that. I only have to deal with maintainer names
> that contain ',' than I will post the patch.

Hmm, okay. Found a solution.
Now here's the patch.

Most important changes:
 - also retrieves the Sources files
 - parses the Sources files and uses the Uploaders: field
 - outputs in package list also co-maintained packages. Currently it
   uses the same list for both types of maintainership and only marks
   co-maintained packages with a '*' after the package name. This can
   easily be changed (<- comments?).

Tested and output looks good.

Gruesse,
-- 
*** Frank Lichtenheld <frank@lichtenheld.de> ***
          *** http://www.djpig.de/ ***
see also: - http://www.usta.de/
          - http://fachschaft.physik.uni-karlsruhe.de/
Index: people.pl
===================================================================
RCS file: /cvs/webwml/cron/people_scripts/people.pl,v
retrieving revision 1.7
diff -u -r1.7 people.pl
--- people.pl	30 Jan 2003 16:48:36 -0000	1.7
+++ people.pl	2 Aug 2003 22:09:04 -0000
@@ -95,6 +95,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;
@@ -113,6 +129,35 @@
 	}
 }
 
+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;
@@ -146,19 +191,17 @@
     }
 }
 
-sub canonical_names {
-	PACK: foreach $pack (keys %package) {
-		$maintainer = $package{$pack}{maintainer};
-		$maintainer =~ s/&/&amp;/g;
+sub process_name {
+    my ($maintainer) = @_;
+    $maintainer =~ s/&/&amp;/g;
+
+    my ($lastname, $firstname, $email);
 
-		# Take care of the special cases first
+                # 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);
@@ -166,7 +209,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) {
@@ -223,7 +266,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 <(.+)>/) {
@@ -268,6 +311,9 @@
 		elsif ($maintainer =~ /Lenart Janos <(.+)>/) {
 			$lastname = 'Lenart'; $firstname = 'Janos'; $email = $1;
 		}
+		elsif ($maintainer =~ /Bruno Barrera C. <(.+)>/) {
+			$lastname = 'Barrera'; $firstname = 'Bruno'; $email = $1;
+		}
 
 #
 # The following should handle almost everyone
@@ -304,53 +350,45 @@
 		# 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;
 			# send mail to webmaster@debian.org
 			# cron/weekly script has been fixed to annoy joy about these errors
 		}
+    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;
+
+		my @uploaders;
+		foreach my $uploader (@{$package{$pack}{uploaders}}) {
+		    my ($ulastname, $ufirstname, $uemail) = process_name($uploader);
+		    next unless $ulastname;
+#		    warn "process_name: $uploader: $ulastname, $ufirstname\n";
+		    push( @uploaders, { lastname => $ulastname,
+				       firstname => $ufirstname,
+				       email => $uemail, } )
+			if $ulastname;
+		}
+		$package{$pack}{uploadernames} = \@uploaders if @uploaders;
+		    
 	}
 }
 
-
-# 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;
-#        #   }
-#        #}
-# #    }
-# # }
-# #}
-
-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;
@@ -366,7 +404,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\*" );
+		}
 	}
 }
 
@@ -437,27 +496,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 -r1.1 update.packages+sources
--- update.packages+sources	22 Nov 2002 14:24:11 -0000	1.1
+++ update.packages+sources	2 Aug 2003 22:09:04 -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.1
diff -u -r1.1 update.people.html
--- update.people.html	22 Nov 2002 14:24:11 -0000	1.1
+++ update.people.html	2 Aug 2003 22:09:04 -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: