[libconfig-model-dpkg-perl] 06/07: Dpkg::Dep: Warn and fix if a dual dependency is used with a module that is or will no longer be dual life
dod at debian.org
dod at debian.org
Sat Sep 27 17:25:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.
commit f2cdec2e0b470a744277b9677fce16d756193a28
Author: Dominique Dumont <dod at debian.org>
Date: Sat Sep 27 19:21:03 2014 +0200
Dpkg::Dep: Warn and fix if a dual dependency is used with a module that is or will no longer be dual life
---
lib/Config/Model/Dpkg/Dependency.pm | 20 ++++++++++++++++----
t/dependency-check.t | 12 ++++++------
t/model_tests.d/dpkg-control-test-conf.pl | 4 ++--
t/model_tests.d/dpkg-test-conf.pl | 5 +----
4 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index f695c94..486e8e6 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -451,6 +451,11 @@ sub check_perl_lib_dep {
my @dep_name_as_perl = Module::CoreList->find_modules(qr/^$pname$/i) ;
return 1 unless @dep_name_as_perl;
+ my $deprecated = Module::CoreList->deprecated_in($dep_name_as_perl[0]) ;
+ $logger->debug("dual life $dep_name is deprecated with perl $deprecated") if $deprecated;
+ my $removed = Module::CoreList->removed_from($dep_name_as_perl[0]) ;
+ $logger->debug("dual life $dep_name is removed from perl $removed") if $removed;
+
return 1 if (defined $dep_v && $dep_v =~ m/^\$/) ;
my @ideal_perl_dep = qw/perl/ ;
@@ -509,7 +514,7 @@ sub check_perl_lib_dep {
push @ideal_lib_dep, '>=', $dep_v if $has_older_lib;
}
}
- elsif ($has_older_perl) {
+ elsif ($has_older_perl or $removed or $deprecated) {
push @ideal_lib_dep, $dep_name;
}
@@ -521,9 +526,10 @@ sub check_perl_lib_dep {
"older than perl in sid ($perl_version{sid})"
);
- my @ordered_ideal_dep = $has_older_perl_in_sid ?
- ( \@ideal_perl_dep, \@ideal_lib_dep ) :
- ( \@ideal_lib_dep, \@ideal_perl_dep ) ;
+ my @ordered_ideal_dep
+ = $removed || $deprecated ? ( \@ideal_lib_dep )
+ : $has_older_perl_in_sid ? ( \@ideal_perl_dep, \@ideal_lib_dep )
+ : ( \@ideal_lib_dep, \@ideal_perl_dep ) ;
my $ideal_dep = $self->struct_to_dep( @ordered_ideal_dep );
if ( $actual_dep ne $ideal_dep ) {
@@ -534,6 +540,12 @@ sub check_perl_lib_dep {
else {
$self->{nb_of_fixes}++;
my $msg = "Dependency of dual life package should be '$ideal_dep' not '$actual_dep'";
+ if ($removed) {
+ $msg .= " (removed from perl $removed)" ;
+ }
+ elsif ($deprecated) {
+ $msg .= " (deprecated from perl $deprecated)" ;
+ }
$self->add_warning ($msg);
$logger->info("will warn: $msg (fix++)");
}
diff --git a/t/dependency-check.t b/t/dependency-check.t
index 7093bd7..7038c65 100644
--- a/t/dependency-check.t
+++ b/t/dependency-check.t
@@ -131,7 +131,7 @@ warning_like {
$unit->config_root->init ;
}
[ qr/is unknown/, qr/unnecessary/, (qr/dual life/) , qr/unnecessary/,
- ( qr/dual life/) x 2 , (qr/unnecessary/) x 2 ] ,
+ ( qr/dual life.*removed/), ( qr/dual life/) , (qr/unnecessary/) x 2 ] ,
"test BDI warn on unittest instance";
my $c_unit = $unit->config_root ;
@@ -180,11 +180,11 @@ is( $res, 0,"check perl (>= 5.6.0) dependency: no older version");
my @chain_tests = (
# tag name for display, test data, expected result: 1 (good dep) or expected fixed structure
'libcpan-meta-perl' => [ ['libcpan-meta-perl']] => [[qw/perl >= 5.13.10/],['libcpan-meta-perl']],
- 'libmodule-build-perl perl 5.10' => [ [qw/perl >= 5.10/], ['libmodule-build-perl']] => [['perl'],[]],
+ 'libmodule-build-perl perl 5.10' => [ [qw/perl >= 5.10/], ['libmodule-build-perl']] => [['libmodule-build-perl']],
# test Debian #719225
- 'libarchive-extract-perl' => [ [qw/libarchive-extract-perl >= 0.68/] , [qw/perl >= 5.17.9/]] => [ [qw/perl >= 5.17.9/], ['libarchive-extract-perl'] ,],
- 'libarchive-extract-perl' => [ [qw/perl >= 5.17.9/], ['libarchive-extract-perl'] , ] => 1,
- 'libmodule-build-perl to fix' => [ [qw/perl >= 5.11.3/], [qw/libmodule-build-perl >= 0.360000/] ] => [ [qw/perl >= 5.11.3/], ['libmodule-build-perl'] ] ,
+ 'libarchive-extract-perl' => [ [qw/libarchive-extract-perl >= 0.68/] , [qw/perl >= 5.17.9/]] => [ ['libarchive-extract-perl'] ,],
+ 'libarchive-extract-perl' => [ [qw/perl >= 5.17.9/], ['libarchive-extract-perl'] , ] => 0, # Archive::Extract is now removed from core
+ 'libmodule-build-perl to fix' => [ [qw/perl >= 5.11.3/], [qw/libmodule-build-perl >= 0.360000/] ] => [ ['libmodule-build-perl'] ] ,
);
while (@chain_tests) {
@@ -325,7 +325,7 @@ is($perl_bdi->has_fixes,2, "test presence of fixes");
is($perl_bdi->has_fixes,0, "test that fixes are gone");
is($perl_bdi->has_warning,0,"check that warnings are gone");
-is($perl_bdi->fetch,"perl","check fixed B-D-I dependency value");
+is($perl_bdi->fetch,"libmodule-build-perl","check fixed B-D-I dependency value");
print scalar $inst->list_changes,"\n" if $trace ;
is($inst->c_count, 1,"check that fixes are tracked with notify changes") ;
diff --git a/t/model_tests.d/dpkg-control-test-conf.pl b/t/model_tests.d/dpkg-control-test-conf.pl
index 92bcbdd..57e65df 100644
--- a/t/model_tests.d/dpkg-control-test-conf.pl
+++ b/t/model_tests.d/dpkg-control-test-conf.pl
@@ -23,7 +23,7 @@ providing the following file:
'source Build-Depends-Indep:0', "libcpan-meta-perl | perl (>= 5.13.10)", # fixed
'source Build-Depends-Indep:1', "libdist-zilla-perl", # fixed
'source Build-Depends-Indep:5', "libpath-class-perl",
- 'source Build-Depends-Indep:6', "perl (>= 5.11.3) | libmodule-build-perl (>= 0.36)", # fixed
+ 'source Build-Depends-Indep:6', "libmodule-build-perl (>= 0.36)", # fixed
'source Build-Depends-Indep:7', "udev [linux-any] | makedev [linux-any]",
'binary:libdist-zilla-plugins-cjm-perl Depends:0',
'${misc:Depends}',
@@ -32,7 +32,7 @@ providing the following file:
},
load_warnings => [ qr/dependency/, qr/dual life/, (qr/dependency/) x 2,
qr/libmodule-build-perl \(>= 0.36\) \| perl \(>= 5.8.8\)/,
- qr/should be 'perl \(>= 5.11.3\) \| libmodule-build-perl \(>= 0.36\)/,
+ qr/should be 'libmodule-build-perl \(>= 0.36\)/,
qr/standards version/,
qr/dependency/, qr/dual life/, (qr/dependency/) x 2 ],
apply_fix => 1,
diff --git a/t/model_tests.d/dpkg-test-conf.pl b/t/model_tests.d/dpkg-test-conf.pl
index b85e3a6..cff9281 100644
--- a/t/model_tests.d/dpkg-test-conf.pl
+++ b/t/model_tests.d/dpkg-test-conf.pl
@@ -19,11 +19,8 @@ my $del_home = sub {
{ name => 't0',
check =>
{ 'control source Build-Depends-Indep:3', 'libtest-pod-perl', },
- dump_warnings => [ (qr/deprecated/) x 3 ],
file_check_sub => $del_home,
- # apply_fix => 1 ,
-
- #errors => [ ],
+ apply_fix => 1 ,
},
{ name => 't1',
apply_fix => 1 ,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git
More information about the Pkg-perl-cvs-commits
mailing list