Package: dh-make-perl
Version: 0.20
Severity: wishlist
Tags: patch

*** Please type your report below this line ***

This patch looks up the version of the dependency in the META.yml file
and creates the information in the Depends of the resulting package.


Jesper
-- 
Jesper Krogh, [EMAIL PROTECTED]

--- /usr/bin/dh-make-perl	2005-10-27 04:46:58.000000000 +0200
+++ dh-make-perl	2006-04-22 20:37:22.000000000 +0200
@@ -7,7 +7,7 @@
 use Pod::Parser;
 use YAML;
 
[EMAIL PROTECTED]::ISA = qw(Pod::Parser);
+use base qw/Pod::Parser/;
 
 my @pragmas = qw(attributes attrs autouse base bigint bignum
 				 bigrat blib bytes charnames constant
@@ -203,7 +203,7 @@
 $depends .= ', ${misc:Depends}';
 extract_changelog($maindir);
 extract_docs($maindir);
-$depends .= ", " . extract_depends($maindir);
+$depends .= ", " . extract_depends($maindir,$meta);
 apply_overrides();
 
 die "Cannot find a description for the package: use the --desc switch\n" 
@@ -554,7 +554,7 @@
 }
 
 sub extract_depends {
-	my ($dir) = shift;
+	my ($dir,$meta) = @_;
 	$dir .= '/' unless $dir =~ m/\/$/;
 	local @INC = ($dir, @INC);
 
@@ -576,11 +576,13 @@
 		push @uses, $module;
 	}
 
+	
 	my @deps;
 	my @not_debs;
 
 	if (`which apt-file`) {
 		foreach my $module (@uses) {
+			my $mod = $module;
 			print "Searching for $module package using apt-file.\n";
 			$module =~ s|::|/|g;
 
@@ -598,7 +600,11 @@
 				my ($p, $f) = split / /, $_;
 				chop($p); #Get rid of the ":"
 				if ($f =~ /$re/ && ! grep { $_ eq $p } @deps, "perl", "perl-base", "perl-modules") {
-					push @deps, $p;
+					if(exists $dep_hash{$mod}){
+						push @deps, { name => $p, version => $dep_hash{$mod} };
+					}else{
+						push @deps, { name => $p };
+					}
 					last;
 				}
 			}
@@ -611,11 +617,11 @@
 	}
 	
 	print "\n";
-	print "Needs the following debian packages: " . join (", ", @deps) . "\n" if (@deps);
+	print "Needs the following debian packages: " . join (", ", map { $_->{name} } @deps) . "\n" if (@deps);
 	print "Needs the following modules for which there are no debian packages available: "
 		. join (", ", @not_debs) . "\n" if (@not_debs);
 	
-	return join (", ", @deps);
+	return join (", ", map { $_->{version} ? $_->{name} . " (>= " . $_->{version} . ")" : $_->{name} } @deps);
 }
 
 sub check_for_xs {

Reply via email to