[libconfig-model-dpkg-perl] 07/24: Dpkg::Dependency: get_available_version is synchronous
dod at debian.org
dod at debian.org
Sun Apr 20 13:07:46 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 a165bcdcbc86fdf32120041cba60bf75b1cc64fb
Author: Dominique Dumont <dod at debian.org>
Date: Tue Apr 15 19:41:10 2014 +0200
Dpkg::Dependency: get_available_version is synchronous
---
lib/Config/Model/Dpkg/Dependency.pm | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index d9498e9..25ac72f 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -546,7 +546,8 @@ sub check_perl_lib_dep {
};
$get_perl_versions = sub {
- $self->get_available_version($on_get_perl_versions, 'perl');
+ my @res = $self->get_available_version( 'perl');
+ $on_get_perl_versions->(@res) ;
} ;
$on_get_perl_versions = sub {
@@ -580,8 +581,8 @@ sub check_perl_lib_dep {
} ;
# start the whole async stuff
- $self->get_available_version($on_get_lib_version, $dep_name);
-
+ my @res = $self->get_available_version( $dep_name);
+ $on_get_lib_version->(@res) ;
return $ret ;
}
@@ -618,8 +619,8 @@ sub check_versioned_dep {
};
# check if Debian has version older than required version
- $self->get_available_version($cb, $pkg) ;
-
+ my @res = $self->get_available_version( $pkg) ;
+ $cb->(@res);
}
sub has_older_version_than {
@@ -726,8 +727,8 @@ sub check_or_fix_pkg_name {
# is asynchronous
$async_log->debug("begin on $pkg");
- $self->get_available_version( $cb, $pkg );
-
+ my @res = $self->get_available_version( $pkg );
+ $cb->(@res);
# if no pkg was found
}
}
@@ -795,32 +796,28 @@ END {
untie %cache ;
}
-# asynchronous method
my $cache_expire_date = time - 24 * 60 * 60 * 7 ;
sub get_available_version {
- my ($self, $callback,$pkg_name) = @_ ;
+ my ($self, $pkg_name) = @_ ;
- $async_log->debug("called on $pkg_name");
+ $logger->debug("called on $pkg_name");
# don't query info for known virtual package
if ($virtual_hash{$pkg_name}) {
- $async_log->debug("$pkg_name is a known virtual package");
- $callback->() ;
- return;
+ $logger->debug("$pkg_name is a known virtual package");
+ return ();
}
# needed to test unknown package without network
if (exists $cache{$pkg_name} and not defined $cache{$pkg_name}) {
- $async_log->debug("$pkg_name is an unknown package (for test only)");
- $callback->() ;
- return;
+ $logger->debug("$pkg_name is an unknown package (for test only)");
+ return ();
}
my ($time, at res) = split / /, ($cache{$pkg_name} || '');
if (defined $time and $time =~ /^\d+$/ and $time > $cache_expire_date ) {
- $async_log->debug("using cached info for $pkg_name");
- $callback->(@res) ;
- return;
+ $logger->debug("using cached info for $pkg_name");
+ return @res;
}
my $url = "http://qa.debian.org/cgi-bin/madison.cgi?package=".uri_escape($pkg_name)."&text=on" ;
@@ -838,6 +835,7 @@ sub get_available_version {
}
say "got info for $pkg_name" ;
$cache{$pkg_name} = time ." @res" ;
+ return @res;
}
# this function queries *once* madison for package info not found in cache.
--
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