X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=debian%2Flist-deps;h=83a40532176de2e77924be6b667b2bf899f61892;hb=9fdceaa3b5b2bb37127e53638857f4196498d077;hp=f12d088177b418ca908bf3fe285c6c624b73aaa4;hpb=8599b1dc5d4bf48261d22fa8db553351e978d0b5;p=srvgit diff --git a/debian/list-deps b/debian/list-deps index f12d088177..83a4053217 100755 --- a/debian/list-deps +++ b/debian/list-deps @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# Write dependency list from Koha PerlDependencies.pm, in Debian format. +# Write dependency list from Koha cpanfile, in Debian format. # # Copyright 2010 Catalyst IT, Ltd # @@ -17,16 +17,23 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -use strict; -use warnings; +use Modern::Perl; +use Parallel::ForkManager; +use Sys::CPU; -use C4::Installer::PerlDependencies; +use C4::Installer::PerlModules; # 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 = ( - 'LWP::Protocol::https' => 'liblwp-protocol-https-perl|libwww-perl (<6.02), libio-socket-ssl-perl', + 'LWP::Protocol::https' => 'liblwp-protocol-https-perl | libwww-perl (<<6.02), libio-socket-ssl-perl', + 'HTTP::OAI' => 'libhttp-oai-perl (>= 3.2) | libhttp-oai-3.27-perl, libhttp-oai-perl (<< 4.0) | libhttp-oai-3.27-perl', + 'IO::Socket::IP' => 'perl-modules (>= 5.20.0) | libio-socket-ip-perl', + 'Swagger2' => 'libswagger2-perl (>= 0.59)', + 'Mojolicious' => 'libmojolicious-perl (>= 6.0)', + 'CPAN::Meta' => 'libcpan-meta-perl (>= 2.150010) | perl-modules-5.28 | perl-modules-5.30 | perl-modules (>= 5.20.2)', + 'Locale::Language' => 'liblocale-codes-perl' ); # These are packages we're going to ignore @@ -36,59 +43,67 @@ my %ignore = ( 'CHI::Driver::Memcached' => 1, ); -my $deps = $C4::Installer::PerlDependencies::PERL_DEPS; +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.]+)"; -my $prefix = "^/usr/((lib|share)/perl5|(lib|share)/perl/[0-9.]+)"; +my $pm = Parallel::ForkManager->new( Sys::CPU::cpu_count() ); -foreach my $module ( keys %$deps ) { - next if $ignore{$module}; - my $ver = $deps->{$module}->{'min_ver'}; - my $subpath = $module; - $subpath =~ s,::,/,g; - my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$"); - my @temp = split( /\n/, $output ); - my @lines = (); +my $modules = C4::Installer::PerlModules->new(); +my $prereqs = $modules->prereqs; +foreach my $phase ($prereqs->phases) { + foreach my $type ($prereqs->types_in($phase)) { + my $reqs = $prereqs->requirements_for($phase, $type); - # 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 ( exists $overrides{$module} ) { - print "$overrides{$module}\n"; - } - elsif ( scalar(@lines) == 1 && $lines[0] ne "" ) { - my $pkg = $lines[0]; - print "$pkg\n"; - } - elsif ( scalar(@lines) > 1 ) { - foreach my $pkg (@lines) { - print " | " if ( $pkg ne $lines[0] ); - print "$pkg"; - } - print "\n"; - } - elsif ( scalar(@temp) != 0 ) { + MODULE_LOOP: + foreach my $module ( $reqs->required_modules ) { + my $pid = $pm->start and next MODULE_LOOP; - # 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 ( ! $deps->{$module}->{'required'} ) { - # Ignore because we don't have it and we don't care. - } - else { - print "EEEK: unknown package for $module\n"; + next if $ignore{$module}; + my $subpath = $module; + $subpath =~ s,::,/,g; + + my $output = qx(apt-file -l -x search "$prefix/$subpath.pm\$"); + 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. + + + # skip perl-base and problematic version specific libperl* and + # perl-module* packages (they get installed as deps. anyway) + foreach my $line (@temp) { + if ( $line ne "perl-base" and $line !~ /^libperl5\./ and $line !~ /^perl-modules-5\./ ) { + @lines = ( @lines, $line ); + } + } + + if ( exists $overrides{$module} ) { + print "$overrides{$module}\n"; + } + elsif ( scalar(@lines) == 1 && $lines[0] ne "" ) { + my $pkg = $lines[0]; + print "$pkg\n"; + } + elsif ( scalar(@lines) > 1 ) { + foreach my $pkg (@lines) { + print " | " if ( $pkg ne $lines[0] ); + print "$pkg"; + } + print "\n"; + } + elsif ( scalar(@temp) != 0 ) { + # hmm, skip module + } + elsif ( $type ne 'requires' ) { + # Ignore because we don't have it and we don't care. + } + else { + print "EEEK: unknown package for $module\n"; + } + + $pm->finish; # Terminates the child process + } } } +$pm->wait_all_children;