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 050ba27a6187ac99cbe3c601c9c8200d477d28fb
Author: Dominique Dumont <d...@debian.org>
Date:   Tue Apr 15 20:03:20 2014 +0200

    check_versioned_dep is now synchronous
---
 lib/Config/Model/Dpkg/Dependency.pm | 57 +++++++++++++++++--------------------
 t/dependency-check.t                | 16 ++++-------
 2 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Dependency.pm 
b/lib/Config/Model/Dpkg/Dependency.pm
index 821a043..36cb655 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -511,7 +511,8 @@ sub check_perl_lib_dep {
                 my $dep_str = $dep_name . ( defined $check_v ? ' ' . $check_v 
: '' );
                 $logger->debug("dual life $dep_str aka $dep_name_as_perl[0] 
found in Perl core $v_normal");
             }
-            $self->check_versioned_dep( $on_perl_check_done , ['perl', '>=', 
$v_normal] );
+            my @res = $self->check_versioned_dep(  ['perl', '>=', $v_normal] );
+                       $on_perl_check_done->(@res);
         }
     };
 
@@ -538,7 +539,8 @@ sub check_perl_lib_dep {
         };
 
         if ( defined $dep_v ) {
-            $self->check_versioned_dep( $on_perl_lib_check_done, $depend );
+            my @res = $self->check_versioned_dep(  $depend );
+                       $on_perl_lib_check_done->(@res);
         }
         else {
             $on_perl_lib_check_done->(0);
@@ -588,39 +590,32 @@ sub check_perl_lib_dep {
 }
 
 sub check_versioned_dep {
-    my ($self, $callback ,$dep_info) = @_ ;
+    my ($self ,$dep_info) = @_ ;
     my ( $pkg,  $oper,      $vers )    = @$dep_info;
     $logger->debug("called with '" . $self->struct_to_dep($dep_info) ."'") if 
$logger->is_debug;
 
     # special case to keep lintian happy
-    $callback->(1) if $pkg eq 'debhelper' ;
-
-    my $cb = sub {
-        my @dist_version = @_ ;
-        $async_log->debug("in check_versioned_dep callback with ". 
$self->struct_to_dep($dep_info)
-            ." -> @dist_version") if $async_log->is_debug;
-
-        if ( @dist_version  # no older for unknow packages
-             and defined $oper
-             and $oper =~ />/
-             and $vers !~ /^\$/  # a dpkg variable
-        ) {
-            my $src_pkg_name = $self->grab_value("!Dpkg::Control source 
Source") ;
-
-            my $filter = $test_filter || $self->grab_value(
-                step => qq{!Dpkg my_config 
package-dependency-filter:"$src_pkg_name"},
-                mode => 'loose',
-            ) || '';
-            $callback->($self->has_older_version_than ($pkg, $vers,  $filter, 
\@dist_version ));
-        }
-        else {
-            $callback->(1) ;
-        }
-    };
+    return (1) if $pkg eq 'debhelper' ;
 
     # check if Debian has version older than required version
-    my @res = $self->get_available_version( $pkg) ;
-       $cb->(@res);
+    my @dist_version = $self->get_available_version( $pkg) ;
+
+       if ( @dist_version  # no older for unknow packages
+                and defined $oper
+                and $oper =~ />/
+                and $vers !~ /^\$/  # a dpkg variable
+        ) {
+               my $src_pkg_name = $self->grab_value("!Dpkg::Control source 
Source") ;
+
+               my $filter = $test_filter || $self->grab_value(
+                       step => qq{!Dpkg my_config 
package-dependency-filter:"$src_pkg_name"},
+                       mode => 'loose',
+               ) || '';
+               return ($self->has_older_version_than ($pkg, $vers,  $filter, 
\@dist_version ));
+       }
+       else {
+               return (1) ;
+       }
 }
 
 sub has_older_version_than {
@@ -760,8 +755,8 @@ sub check_or_fix_dep {
         } ;
 
         $async_log->debug("begin") ;
-        $self->check_versioned_dep($cb,  $dep_info );
-
+        my @res = $self->check_versioned_dep( $dep_info );
+               $cb->(@res);
     }
 }
 
diff --git a/t/dependency-check.t b/t/dependency-check.t
index 991aad5..d7bffc3 100644
--- a/t/dependency-check.t
+++ b/t/dependency-check.t
@@ -174,8 +174,8 @@ warning_like {
 
 is($dep_value->_pending_store, 0,"check that no pending store is left") ;
 
-my $ok_cb = sub {is($_[0],0,"check perl (>= 5.6.0) dependency: no older 
version"); };
-$dep_value->check_versioned_dep( $ok_cb, ['perl','>=','5.6.0'] ) ;
+my $res = $dep_value->check_versioned_dep(  ['perl','>=','5.6.0'] );
+is( $res, 0,"check perl (>= 5.6.0) dependency: no older version");
 
 
 # $dep_value->store('libcpan-meta-perl') ;
@@ -230,15 +230,11 @@ if ($trace) {
 my $perl_dep = $control->grab("binary:libdist-zilla-plugins-cjm-perl 
Depends:3");
 is($perl_dep->fetch,"perl (>= 5.10.1)","check dependency value from config 
tree");
 
-my @ret = $perl_dep->check_versioned_dep(
-    sub { is($_[0],1,"check perl (>= 5.28.1) dependency: has older version");},
-    ['perl','>=','5.28.1']
-) ;
+my $res = $perl_dep->check_versioned_dep(['perl','>=','5.28.1']) ;
+is($res,1,"check perl (>= 5.28.1) dependency: has older version");
 
-@ret = $perl_dep->check_versioned_dep(
-    sub {is($_[0],0,"check perl (>= 5.6.0) dependency: no older version"); },
-    ['perl','>=','5.6.0']
-) ;
+$res = $perl_dep->check_versioned_dep(['perl','>=','5.6.0']) ;
+is($res,0,"check perl (>= 5.6.0) dependency: no older version");
 
 my $dpkg_dep = $control->grab("source Build-Depends:2");
 is($dpkg_dep->fetch,"dpkg",'check dpkg value') ;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to