[libconfig-model-dpkg-perl] 03/07: can start dependency cache from scratch
dod at debian.org
dod at debian.org
Thu Jul 27 19:02:39 UTC 2017
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 bf10b4de1308263b331ec770c0967d9ca51d9a6d
Author: Dominique Dumont <dod at debian.org>
Date: Mon Jul 17 20:07:07 2017 +0200
can start dependency cache from scratch
Fix a bug where a missing cache would not trigger the creation of the
tied file, so dependency cache cannot be re-created from scratch.
Not that recreating the cache is a good idea: most tests break because
of new dependency warnings
---
lib/Config/Model/Dpkg/Dependency.pm | 6 +++---
t/dependency-check.t | 2 ++
t/model_tests.d/dpkg-control-test-conf.pl | 2 ++
t/model_tests.d/dpkg-test-conf.pl | 2 ++
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index a4ee632..93b8da6 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -832,19 +832,19 @@ sub warn_or_remove_vers_dep {
}
}
-use vars qw/%cache/ ;
+use vars qw/%cache $use_test_cache/ ;
# Set up persistence
my $cache_file_name = $ENV{HOME}.'/.config_model_depend_cache' ;
# this condition is used during tests
-if (not %cache) {
+if (not $use_test_cache) {
tie %cache => 'DB_File', $cache_file_name,
}
# required to write data back to DB_File
END {
- untie %cache ;
+ untie %cache unless $use_test_cache;
}
my $cache_expire_date = time - 24 * 60 * 60 * 7 ;
diff --git a/t/dependency-check.t b/t/dependency-check.t
index a7fa6dc..35a0061 100644
--- a/t/dependency-check.t
+++ b/t/dependency-check.t
@@ -49,6 +49,8 @@ use warnings;
use strict;
+$Config::Model::Dpkg::Dependency::use_test_cache = 1;
+
my $arg = shift || '';
my ($log,$show,$one) = (0) x 3 ;
diff --git a/t/model_tests.d/dpkg-control-test-conf.pl b/t/model_tests.d/dpkg-control-test-conf.pl
index 67035be..3c73084 100644
--- a/t/model_tests.d/dpkg-control-test-conf.pl
+++ b/t/model_tests.d/dpkg-control-test-conf.pl
@@ -205,6 +205,8 @@ providing the following file:
my $cache_file = 't/model_tests.d/dependency-cache.txt';
+$Config::Model::Dpkg::Dependency::use_test_cache = 1;
+
my $ch = new IO::File "$cache_file";
foreach ($ch->getlines) {
chomp;
diff --git a/t/model_tests.d/dpkg-test-conf.pl b/t/model_tests.d/dpkg-test-conf.pl
index 0eb034e..e9d9384 100644
--- a/t/model_tests.d/dpkg-test-conf.pl
+++ b/t/model_tests.d/dpkg-test-conf.pl
@@ -255,6 +255,8 @@ sub add {
my $cache_file = 't/model_tests.d/dependency-cache.txt';
+$Config::Model::Dpkg::Dependency::use_test_cache = 1;
+
my $ch = new IO::File "$cache_file";
foreach ( $ch->getlines ) {
chomp;
--
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