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

Bug#805128: Replace outdated copy of dd-list with wrapper around dd-list



Package: qa.debian.org
Tags: patch

Starting with devscripts 2.15.9, the functionality from QA's copy of
dd-list has been integrated.  The only missing piece is automatically
using the specific sources files of interest for the QA infrastructure.

Converting /srv/qa.debian.org/bin/dd-list to a wrapper around the
actual dd-list, as the attached patch does, enables adding the relevant
sources files to the dd-list command and doesn't break the various calls
to dd-list.

I've already sent a request to debian-admin to get an updated version of
devscripts installed, so once that's complete this patch can be applied.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@debian.org>
From 484c5120220383ef50870e90b8a0931b61f36847 Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan@debian.org>
Date: Sat, 14 Nov 2015 20:52:50 -0500
Subject: [PATCH] Replace outdated copy of dd-list with wrapper around dd-list

Starting with devscripts 2.15.9, the functionality from QA's copy of
dd-list has been integrated.  The only missing piece is automatically
using the specific sources files of interest for the QA infrastructure.

Converting /srv/qa.debian.org/bin/dd-list to a wrapper around the
actual dd-list enables adding the relevant sources files to the dd-list
command and doesn't break the various calls to dd-list.
---
 bin/dd-list | 286 ++----------------------------------------------------------
 1 file changed, 5 insertions(+), 281 deletions(-)

diff --git a/bin/dd-list b/bin/dd-list
index c5fc7e6..67e17a5 100755
--- a/bin/dd-list
+++ b/bin/dd-list
@@ -1,283 +1,7 @@
-#!/usr/bin/perl -w
-#
-# dd-list: Generate a list of maintainers of packages.
-#
-# Written by Joey Hess <joeyh@debian.org>
-# Based on a python implementation by Lars Wirzenius.
-# Copyright 2005 Lars Wirzenius, Joey Hess
-#
-# 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, see <http://www.gnu.org/licenses/>.
+#!/bin/sh
 
-# changes between dd-list 2.10.69+squeeze4 and this dd-list :
-#
-# Copyright (C) 2012 Bart Martens <bartm@knars.be>
-#
-# 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 3 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, see <http://www.gnu.org/licenses/>.
+for sources in /srv/mirrors/debian/dists/unstable/*/source/Sources.gz /srv/mirrors/debian/dists/experimental/*/source/Sources.gz; do
+    set -- "$@" -s "$sources"
+done
 
-use strict;
-use Getopt::Long;
-
-my $version='2.10.69+squeeze4+bartm';
-
-my %arch;
-
-sub read_arch
-{
-	my $count = 0;
-
-	foreach my $dist ( "unstable", "experimental" )
-	{
-		my $package = undef;
-		my $maintainer = undef;
-		my $uploaders = undef;
-	
-		open INPUT, "zcat /srv/mirrors/debian/dists/$dist/*/source/Sources.gz |" or die "failed to read $dist Sources files";
-		while(<INPUT>)
-		{
-			chomp;
-	
-			$package = $1 if( /^Package: (.*)/ );
-			$maintainer = $1 if( /^Maintainer: (.*)/ );
-			$uploaders = $1 if( /^Uploaders: (.*)/ );
-	
-			if( /^$/ )
-			{
-				die "$package" if( not defined $package );
-
-				$count++ if( not defined $arch{$package}{$dist}{"Maintainer"} );
-	
-				delete $arch{$dist}{$package}{"Maintainer"};
-				delete $arch{$dist}{$package}{"Uploaders"};
-	
-				$arch{$dist}{$package}{"Maintainer"} = $maintainer if( defined $maintainer );
-				$arch{$dist}{$package}{"Uploaders"} = $uploaders if( defined $uploaders );
-	
-				$package = undef;
-				$maintainer = undef;
-				$uploaders = undef;
-			}
-		}
-	}
-
-	die "low number of packages in Sources files: $count" if( $count < 20000 ); # 20768 on 2012-12-02
-}
-
-sub undef2empty
-{
-	my $value = shift;
-	return "" if( not defined $value );
-	return $value;
-}
-
-sub get_developers_given_package {
-	my ($package_name,$print_binary,$dist) = @_;
-
-	my $developer;
-	my $uploaders;
-	my @uploaders = ();
-	my $found = 0;
-
-	if( defined $arch{$dist}{$package_name} )
-	{
-		if( $found
-		and ( undef2empty( $developer ) ne undef2empty( $arch{$dist}{$package_name}{"Maintainer"} )
-		or undef2empty( $uploaders ) ne undef2empty( $arch{$dist}{$package_name}{"Uploaders"} ) ) )
-		{
-			print STDERR "warning: package $package_name has different maintainers and/or uploaders\n";
-		}
-
-		$found = 1;
-
-		$developer = undef;
-		$uploaders = undef;
-		@uploaders = ();
-
-		$developer = $arch{$dist}{$package_name}{"Maintainer"} if( defined $arch{$dist}{$package_name}{"Maintainer"} );
-		$uploaders = $arch{$dist}{$package_name}{"Uploaders"} if( defined $arch{$dist}{$package_name}{"Uploaders"} );
-
-		if( defined $uploaders )
-		{
-			# copied from /home/bartm/src/wnpp-rfs-mentors/wnpp-rfs-mentors.pl
-			$uploaders =~ s/Adam C\. Powell, IV/Adam C. Powell IV/;
-			$uploaders =~ s/Thomas Bushnell, BSG/Thomas Bushnell BSG/;
-			$uploaders =~ s/TransNexus, Inc/TransNexus Inc/;
-			$uploaders =~ s/, *,/,/; # pandoc
-			$uploaders =~ s/John H\. Robinson, IV/John H. Robinson IV/;
-		}
-
-		@uploaders = split /\s*,\s*/, $uploaders if( defined $uploaders );
-	}
-
-	return ($developer, \@uploaders, $package_name);
-}
-
-sub parse_developer {
-	my $developer=shift;
-
-	$developer =~ s/\s\([^\s\(\)]*\)(\s)/$1/;
-
-	my ($name, $domain) = $developer=~/^(.*)\s+<.*@(.*)>\s*$/i;
-	if (defined $domain && $domain !~ /^(lists(\.alioth)?\.debian\.org|teams\.debian\.net)$/) {
-		return join " ", reverse split " ", $name;
-	}
-	elsif (defined $name) {
-		return $name;
-	}
-	else {
-		return $developer;
-	}
-}
-
-sub sort_developers {
-	sort { uc(parse_developer($a)) cmp uc(parse_developer($b)) } @_;
-}
-
-sub help {
-	print <<"EOF"
-Usage: dd-list [options] [package ...]
-
-    -h, --help
-        Print this help text.
-        
-    -i, --stdin
-        Read package names from the standard input.
-
-    -d, --dctrl
-        Read package list in Debian control data from standard input.
-
-    -u, --uploaders
-        Also list Uploaders of packages, not only the listed Maintainers
-        (this is the default behaviour, use --nouploaders to prevent this).
-
-    -nou, --nouploaders
-        Only list package Maintainers, do not list Uploaders.
-
-    -b, --print-binary
-        If binary package names are given as input, print these names 
-	in the output instead of corresponding source packages.
-
-    -V, --version
-        Print version (it\'s $version by the way).
-EOF
-}
-
-my $use_stdin=0;
-my $use_dctrl=0;
-my $show_uploaders=1;
-my $print_binary=0;
-if (! GetOptions(
-	"help" => sub { help(); exit },
-	"stdin|i" => \$use_stdin,
-	"dctrl|d" => \$use_dctrl,
-	"uploaders|u!" => \$show_uploaders,
-	"print-binary|b" => \$print_binary,
-	"version" => sub { print "dd-list version $version\n" })) {
-	exit(1);
-}
-
-my %dict;
-my $errors=0;
-
-if ($use_dctrl) {
-	local $/="\n\n";
-	while (<>) {
-		my ($package, $maintainer, $uploaders, @uploaders);
-
-		if (/^Package:\s+(.*)$/m) {
-			$package=$1;
-		}
-		if (/^Source:\s+(.*)$/m && ! $print_binary ) {
-			$package=$1;
-		}
-		if (/^Maintainer:\s+(.*)$/m) {
-			$maintainer=$1;
-		}
-		if (/^Uploaders:\s+(.*)$/m) {
-			$uploaders=$1;
-			@uploaders = split /\s*,\s*/, $uploaders;
-		}
-
-		if (defined $maintainer && defined $package) {
-			push @{$dict{$maintainer}}, $package;
-			if ($show_uploaders && defined $uploaders) {
-				foreach my $uploader (@uploaders) {
-					push @{$dict{$uploader}}, "$package (U)";
-				}
-			}
-		}
-		else {
-			print STDERR "E: parse error in stanza $.\n";
-			$errors=1;
-		}
-	}
-}
-else {
-	my @package_names;
-	if ($use_stdin) {
-		while (<>) {
-			chomp;
-			s/^\s+//;
-			s/\s+$//;
-			push @package_names, split ' ', $_;
-		}
-	}
-	else {
-		@package_names=@ARGV;
-	}
-
-	read_arch;
-
-	foreach my $package_name (@package_names) {
-	    foreach my $dist ( "unstable", "experimental" )
-	    {
-		my ($developer, $uploaders, $print_name)=get_developers_given_package($package_name,$print_binary,$dist);
-		if (defined $developer) {
-			push @{$dict{$developer}}, $print_name;
-			if ($show_uploaders && @$uploaders) {
-				foreach my $uploader (@$uploaders) {
-					push @{$dict{$uploader}}, "$print_name (U)";
-				}
-			}
-		}
-		else {
-			#print STDERR "E: Unknown package: $package_name\n";
-			#$errors=1;
-		}
-	    }
-	}
-}
-	
-foreach my $developer (sort_developers(keys %dict)) {
-	print "$developer\n";
-	my %seen;
-	foreach my $package (sort @{$dict{$developer}}) {
-		next if $seen{$package};
-		$seen{$package}=1;
-		print "   $package\n";
-	}
-	print "\n";
-}
-
-exit($errors);
+exec /usr/bin/dd-list "$@"
-- 
2.6.2

Attachment: signature.asc
Description: PGP signature


Reply to: