line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::Debian; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
84944
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
80
|
|
4
|
2
|
|
|
2
|
|
1493
|
use Module::Install::Base; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
49
|
|
5
|
2
|
|
|
2
|
|
2336
|
use English; |
|
2
|
|
|
|
|
16097
|
|
|
2
|
|
|
|
|
12
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1495
|
use vars qw{$VERSION @ISA}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
138
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
2
|
|
|
2
|
|
4
|
$VERSION = '0.030'; |
11
|
2
|
|
|
|
|
712
|
@ISA = qw{Module::Install::Base}; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dpkg_requires { |
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
if ( !$self->can_run('dpkg') ) { |
18
|
0
|
|
|
|
|
|
warn 'No dpkg installed.'; |
19
|
0
|
|
|
|
|
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
while (@_) { |
23
|
0
|
0
|
|
|
|
|
my $package = shift or last; |
24
|
0
|
|
0
|
|
|
|
my $version = shift || 0; |
25
|
0
|
|
|
|
|
|
push @{ $self->{values}{dpkg_requires} }, [ $package, $version ]; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Check for package |
28
|
0
|
|
|
|
|
|
print "Checking dpkg $package status...\n"; |
29
|
0
|
|
|
|
|
|
my $dpkg_status = `dpkg -s $package`; |
30
|
0
|
|
|
|
|
|
my $installed = ( $dpkg_status =~ /^Status\:.*installed/m ); |
31
|
0
|
|
|
|
|
|
my ($installed_version) = ( $dpkg_status =~ /^Version\: (.*)$/m ); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($installed) { |
34
|
0
|
|
|
|
|
|
print "$package $version ... $installed_version\n"; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Check version |
37
|
0
|
|
|
|
|
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
|
print "$package $version ... missing\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Check for apt-get |
44
|
0
|
0
|
|
|
|
|
if ( !$self->can_run('apt-get') ) { |
45
|
0
|
|
|
|
|
|
warn "No apt-get installed. Needs to but cannot install $package"; |
46
|
0
|
|
|
|
|
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Check for root? |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Install package |
52
|
0
|
|
|
|
|
|
`apt-get install $package`; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$self->{values}{dpkg_requires}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Module::Install::Debian - Require debian packages to be installed on the system |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Have your Makefile.PL read as follows: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
use inc::Module::Install; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
name 'Foo-Bar'; |
72
|
|
|
|
|
|
|
all_from 'lib/Foo/Bar.pm'; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
dpkg_requires '' => 'bar'; # require .deb file |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
WriteAll; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 DESCRIPTION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Module::Install::Debian allows you to require .deb packages to be installed |
82
|
|
|
|
|
|
|
on the system. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 METHODS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 1 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * dpkg_requires() |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Takes a list of key/value pairs specifying a debian package name and version |
91
|
|
|
|
|
|
|
number. This will install the package in the system if it is not there allready. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This module will not honour the version requirement yet. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Please report any bugs to (patches welcome): |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Install-Debian |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<Module::Install> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Bjørn-Olav Strand E<lt>bo@startsiden.noE<gt> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 LICENSE |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright 2009 by ABC Startsiden AS, Bjørn-Olav Strand <bo@startsiden.no>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |