[libconfig-model-dpkg-perl] 05/12: Dpkg::Dependency: no longer complain about *known* virtual packages

dod at debian.org dod at debian.org
Wed Mar 26 20:07:56 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 4fd8b9f50b31f5e6dd2d0b17725f4ab5c39cc6ea
Author: Dominique Dumont <dod at debian.org>
Date:   Wed Mar 26 12:23:21 2014 +0100

    Dpkg::Dependency: no longer complain about *known* virtual packages
---
 lib/Config/Model/Dpkg/Dependency.pm | 108 +++++++++++++++++++++++++++++++++++-
 t/dependency-check.t                |   7 +++
 2 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index 432a712..c3646cd 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -27,6 +27,97 @@ use AptPkg::System '$_system';
 use AptPkg::Version;
 use AptPkg::Cache ;
 
+# list of virtual packages
+# See https://www.debian.org/doc/packaging-manuals/virtual-package-names-list.txt
+my @virtual_list = qw/
+ audio-mixer
+ awk
+ boom-engine
+ boom-wad
+ c-compiler
+ c-shell
+ cron-daemon
+ debconf-2.0
+ dhcp-client
+ dict-client
+ dict-server
+ dictd-dictionary
+ doom-engine
+ doom-wad
+ dotfile-module
+ emacsen
+ flexmem
+ fonts-japanese-gothic
+ fonts-japanese-mincho
+ foomatic-data
+ fortran77-compiler
+ ftp-server
+ httpd
+ httpd-cgi
+ ident-server
+ imap-client
+ imap-server
+ inet-superserver
+ info-browser
+ ispell-dictionary
+ java1-runtime
+ java2-runtime
+ kernel-headers
+ kernel-image
+ kernel-source
+ lambdamoo-core
+ lambdamoo-server
+ libc-dev
+ linux-kernel-log-daemon
+ lzh-archiver
+ mail-reader
+ mail-transport-agent
+ mailx
+ man-browser
+ mpd-client
+ myspell-dictionary
+ news-reader
+ news-transport-system
+ pdf-preview
+ pdf-viewer
+ pgp
+ pop3-server
+ postscript-preview
+ postscript-viewer
+ radius-server
+ rsh-client
+ rsh-server
+ scheme-ieee-11878-1900
+ scheme-r4rs
+ scheme-r5rs
+ scheme-srfi-0
+ scheme-srfi-55
+ scheme-srfi-7
+ stardict
+ stardict-dictdata
+ stardict-dictionary
+ system-log-daemon
+ tclsh
+ telnet-client
+ telnet-server
+ time-daemon
+ ups-monitor
+ wish
+ wordlist
+ www-browser
+ x-audio-mixer
+ x-display-manager
+ x-session-manager
+ x-terminal-emulator
+ x-window-manager
+ xserver
+/;
+
+# other less official virtual packages
+push @virtual_list, qw/ruby-interpreter/;
+
+my %virtual_hash = map {( $_ => 1); } @virtual_list;
+
 use vars qw/$test_filter/ ;
 $test_filter = ''; # reserved for tests
 
@@ -672,7 +763,7 @@ sub check_or_fix_pkg_name {
     }
     else {
         my $cb = sub {
-            if ( @_ == 0 ) {
+            if ( @_ == 0 and not $virtual_hash{$pkg}) {
                 # no version found for $pkg
                 # don't know how to distinguish virtual package from source package
                 $logger->debug("unknown package $pkg");
@@ -777,6 +868,20 @@ sub get_available_version {
 
     $async_log->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;
+    }
+
+    # 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;
+    }
+
     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");
@@ -835,6 +940,7 @@ sub cache_info_from_madison {
     my @needed;
 
     foreach my $pkg_name (@pkg_names) {
+        next if $virtual_hash{$pkg_name} ; # skip known virtual package
         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");
diff --git a/t/dependency-check.t b/t/dependency-check.t
index 9026e7f..24fbbc7 100644
--- a/t/dependency-check.t
+++ b/t/dependency-check.t
@@ -17,6 +17,7 @@ BEGIN {
         'dpkg' => 'squeeze 1.15 wheezy 1.16 sid 1.16',
         makedev => 'squeeze 2.3.1-89 wheezy 2.3.1-92 jessie 2.3.1-92 sid 2.3.1-93',
         udev => 'squeeze 164-3 wheezy 175-7.2 jessie 175-7.2 sid 175-7.2',
+        foobar => undef, # used to test that unknown package trigger a warning, real cache should not contain undef
     );
     my $t = time ;
     map { $_ = "$t $_"} values %Config::Model::Dpkg::Dependency::cache ;
@@ -298,6 +299,12 @@ is($perl_dep->has_warning,0,"check that warnings are gone");
 is($inst->c_count, 2,"check that fixes are tracked with notify changes") ;
 print scalar $inst->list_changes,"\n" if $trace ;
 
+$control->load(q{binary:libdist-zilla-plugins-cjm-perl Depends:8=mailx Depends:9=foobar});
+is($control->grab('binary:libdist-zilla-plugins-cjm-perl Depends:8')->has_warning,
+    0, "check that _known_ virtual package don't trigger a warning");
+is($control->grab('binary:libdist-zilla-plugins-cjm-perl Depends:9')->has_warning,
+    1, "check that _unknown_ package do trigger a warning");
+
 my $perl_bdi = $control->grab("source Build-Depends-Indep:1");
 
 my $bdi_val ;

-- 
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