Bug 16344 - DBRev 16.12.00.030
[koha.git] / debian / list-deps
blob617393a9bc63e91e8202f692fff6d39166639fdb
1 #!/usr/bin/perl
3 # Write dependency list from Koha PerlDependencies.pm, in Debian format.
5 # Copyright 2010 Catalyst IT, Ltd
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 use strict;
21 use warnings;
23 use C4::Installer::PerlDependencies;
25 # These are packages that may not be in the apt archive in a way that
26 # apt-file can find, e.g. in the Koha repo rather than the regular
27 # debian one.
28 my %overrides = (
29 'LWP::Protocol::https' => 'liblwp-protocol-https-perl|libwww-perl (<6.02), libio-socket-ssl-perl',
30 'IO::Socket::IP' => 'perl-modules (>= 5.20.0) | libio-socket-ip-perl',
31 'Swagger2' => 'libswagger2-perl (>= 0.59)',
32 'Mojolicious' => 'libmojolicious-perl (>= 6.0)',
35 # These are packages we're going to ignore
36 my %ignore = (
37 'Data::Pagination' => 1,
38 'CHI' => 1,
39 'CHI::Driver::Memcached' => 1,
42 my $deps = $C4::Installer::PerlDependencies::PERL_DEPS;
44 my $prefix = "^/usr/((lib|share)/perl5|(lib|share)/perl/[0-9.]+|(lib|share)/.*-linux-gnu.*/perl/[0-9.]+|(lib|share)/.*-linux-gnu.*/perl5/[0-9.]+)";
46 foreach my $module ( keys %$deps ) {
47 next if $ignore{$module};
48 my $ver = $deps->{$module}->{'min_ver'};
49 my $subpath = $module;
50 $subpath =~ s,::,/,g;
51 my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$");
52 my @temp = split( /\n/, $output );
53 my @lines = ();
55 # Remove packages that are required/essential and always installed on
56 # a Debian system. Debian packages should not have unversioned
57 # dependencies on such packages.
58 foreach my $line (@temp) {
59 if ( $line ne "perl-base" ) {
60 @lines = ( @lines, $line );
63 if ( exists $overrides{$module} ) {
64 print "$overrides{$module}\n";
66 elsif ( scalar(@lines) == 1 && $lines[0] ne "" ) {
67 my $pkg = $lines[0];
68 print "$pkg\n";
70 elsif ( scalar(@lines) > 1 ) {
71 foreach my $pkg (@lines) {
72 print " | " if ( $pkg ne $lines[0] );
73 print "$pkg";
75 print "\n";
77 elsif ( scalar(@temp) != 0 ) {
79 # I'm an Essential and I'm OK,
80 # I install all night, and work all day.
81 # I chomp up strings. I eat my bugs.
82 # I go to the base install.
83 # On Fridays I go drinking,
84 # and have buttered commits for git.
85 # (Beer O'Clock is more than two hours
86 # away. I don't even drink beer. There
87 # is no reason to be suspicious of this
88 # commit.)
89 # RM note: suspicious? me? always!
91 elsif ( ! $deps->{$module}->{'required'} ) {
92 # Ignore because we don't have it and we don't care.
94 else {
95 print "EEEK: unknown package for $module\n";