Bug 20557: Prevent Koha/Acquisition/Order.t to fail randomly
[koha.git] / debian / list-deps
blobd599df855d14b989410784c437b7fd794dad85fd
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 Modern::Perl;
22 use C4::Installer::PerlDependencies;
24 # These are packages that may not be in the apt archive in a way that
25 # apt-file can find, e.g. in the Koha repo rather than the regular
26 # debian one.
27 my %overrides = (
28 'LWP::Protocol::https' => 'liblwp-protocol-https-perl|libwww-perl (<<6.02), libio-socket-ssl-perl',
29 'IO::Socket::IP' => 'perl-modules (>= 5.20.0) | perl-modules-5.22 | perl-modules-5.24 | libio-socket-ip-perl',
30 'Swagger2' => 'libswagger2-perl (>= 0.59)',
31 'Mojolicious' => 'libmojolicious-perl (>= 6.0)',
34 # These are packages we're going to ignore
35 my %ignore = (
36 'Data::Pagination' => 1,
37 'CHI' => 1,
38 'CHI::Driver::Memcached' => 1,
41 my $deps = $C4::Installer::PerlDependencies::PERL_DEPS;
43 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.]+)";
45 foreach my $module ( keys %$deps ) {
46 next if $ignore{$module};
47 my $ver = $deps->{$module}->{'min_ver'};
48 my $subpath = $module;
49 $subpath =~ s,::,/,g;
50 my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$");
51 my @temp = split( /\n/, $output );
52 my @lines = ();
54 # Remove packages that are required/essential and always installed on
55 # a Debian system. Debian packages should not have unversioned
56 # dependencies on such packages.
57 foreach my $line (@temp) {
58 if ( $line ne "perl-base" ) {
59 @lines = ( @lines, $line );
62 if ( exists $overrides{$module} ) {
63 print "$overrides{$module}\n";
65 elsif ( scalar(@lines) == 1 && $lines[0] ne "" ) {
66 my $pkg = $lines[0];
67 print "$pkg\n";
69 elsif ( scalar(@lines) > 1 ) {
70 foreach my $pkg (@lines) {
71 print " | " if ( $pkg ne $lines[0] );
72 print "$pkg";
73 print " | $pkg" . "-5.22" if ( $pkg eq "perl-modules" );
74 print " | $pkg" . "-5.24" if ( $pkg eq "perl-modules" );
76 print "\n";
78 elsif ( scalar(@temp) != 0 ) {
80 # I'm an Essential and I'm OK,
81 # I install all night, and work all day.
82 # I chomp up strings. I eat my bugs.
83 # I go to the base install.
84 # On Fridays I go drinking,
85 # and have buttered commits for git.
86 # (Beer O'Clock is more than two hours
87 # away. I don't even drink beer. There
88 # is no reason to be suspicious of this
89 # commit.)
90 # RM note: suspicious? me? always!
92 elsif ( ! $deps->{$module}->{'required'} ) {
93 # Ignore because we don't have it and we don't care.
95 else {
96 print "EEEK: unknown package for $module\n";