updated release notes for 3.14.0 beta
[koha.git] / debian / list-deps
1 #!/usr/bin/perl
2 #
3 # Write dependency list from Koha PerlDependencies.pm, in Debian format.
4 #
5 # Copyright 2010  Catalyst IT, Ltd
6 #
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.
11 #
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.
16 #
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/>.
19
20 use strict;
21 use warnings;
22
23 use C4::Installer::PerlDependencies;
24
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
30 # These are packages we're going to ignore
31 my %ignore = (
32     'Data::Pagination'       => 1,
33     'CHI'                    => 1,
34     'CHI::Driver::Memcached' => 1,
35 );
36
37 my $deps = $C4::Installer::PerlDependencies::PERL_DEPS;
38
39 my $prefix = "^/usr/((lib|share)/perl5|(lib|share)/perl/[0-9.]+)";
40
41 foreach my $module ( keys %$deps ) {
42     next if $ignore{$module};
43     my $ver     = $deps->{$module}->{'min_ver'};
44     my $subpath = $module;
45     $subpath =~ s,::,/,g;
46     my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$");
47     my @temp   = split( /\n/, $output );
48     my @lines  = ();
49
50     # Remove packages that are required/essential and always installed on
51     # a Debian system. Debian packages should not have unversioned
52     # dependencies on such packages.
53     foreach my $line (@temp) {
54         if ( $line ne "perl-base" ) {
55             @lines = ( @lines, $line );
56         }
57     }
58     if ( scalar(@lines) == 1 && $lines[0] ne "" ) {
59         my $pkg = $lines[0];
60         print "$pkg\n";
61     }
62     elsif ( scalar(@lines) > 1 ) {
63         foreach my $pkg (@lines) {
64             print " | " if ( $pkg ne $lines[0] );
65             print "$pkg";
66         }
67         print "\n";
68     }
69     elsif ( scalar(@temp) != 0 ) {
70
71         # I'm an Essential and I'm OK,
72         # I install all night, and work all day.
73         # I chomp up strings. I eat my bugs.
74         # I go to the base install.
75         # On Fridays I go drinking,
76         # and have buttered commits for git.
77         # (Beer O'Clock is more than two hours
78         # away. I don't even drink beer. There
79         # is no reason to be suspicious of this
80         # commit.)
81         # RM note: suspicious?  me?  always!
82     }
83     elsif ( exists $overrides{$module} ) {
84         print "$overrides{$module}\n";
85     }
86     else {
87         print "EEEK: unknown package for $module\n";
88     }
89 }