Merge branch 'bug_8931' into 3.12-master
[koha.git] / debian / list-deps
index e30c54a..a892f37 100755 (executable)
@@ -23,6 +23,16 @@ use warnings;
 
 use C4::Installer::PerlDependencies;
 
+# These are packages that may not be in the apt archive in a way that
+# apt-file can find, e.g. in the Koha repo rather than the regular
+# debian one.
+my %overrides = (
+    'CGI::Session::Driver::memcached' => 'libcgi-session-driver-memcached-perl',
+    'CHI'                             => 'libchi-perl',
+    'CHI::Driver::Memcached'          => 'libchi-driver-memcached-perl',
+    'Template::Plugin::HtmlToText'    => 'libtemplate-plugin-htmltotext-perl',
+);
+
 my $deps = $C4::Installer::PerlDependencies::PERL_DEPS;
 
 my $prefix = "^/usr/((lib|share)/perl5|(lib|share)/perl/[0-9.]+)";
@@ -31,9 +41,18 @@ foreach my $module (keys %$deps) {
     my $ver = $deps->{$module}->{'min_ver'};
     my $subpath = $module;
     $subpath =~ s,::,/,g;
-    my $output = 
+    my $output =
         qx(apt-file -l -x search "$prefix/$subpath.pm\$");
-    my @lines = split(/\n/, $output);
+    my @temp = split(/\n/, $output);
+    my @lines = ();
+    # Remove packages that are required/essential and always installed on
+    # a Debian system. Debian packages should not have unversioned 
+    # dependencies on such packages.
+    foreach my $line (@temp) {
+        if ($line ne "perl-base") {
+            @lines = (@lines, $line);
+        }
+    }
     if (scalar(@lines) == 1 && $lines[0] ne "") {
         my $pkg = $lines[0];
         print "$pkg\n";
@@ -43,6 +62,20 @@ foreach my $module (keys %$deps) {
             print "$pkg";
         }
         print "\n";
+    } elsif (scalar(@temp) != 0) {
+        # I'm an Essential and I'm OK,
+        # I install all night, and work all day.
+        # I chomp up strings. I eat my bugs.
+        # I go to the base install.
+        # On Fridays I go drinking,
+        # and have buttered commits for git.
+        # (Beer O'Clock is more than two hours
+        # away. I don't even drink beer. There
+        # is no reason to be suspicious of this
+        # commit.)
+        # RM note: suspicious?  me?  always!
+    } elsif (exists $overrides{$module}) {
+        print "$overrides{$module}\n";
     } else {
         print "EEEK: unknown package for $module\n";
     }