| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # vim: set ts=2 sw=2 tw=0: | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # vim: set expandtab: | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | Rex::Apache::Build::deb - Build deb packages | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | With this module you can build Debian packages to distribute your application. | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | build "my-software", | ||||||||||||||||||||||||||||||||||||||||||
| 18 | type => "deb", | ||||||||||||||||||||||||||||||||||||||||||
| 19 | version => "1.0", | ||||||||||||||||||||||||||||||||||||||||||
| 20 | source => "/path/to/your/software", | ||||||||||||||||||||||||||||||||||||||||||
| 21 | path => "/path/to/deploy/target", | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # below this, it is all optional | ||||||||||||||||||||||||||||||||||||||||||
| 23 | description => "some description of your package", | ||||||||||||||||||||||||||||||||||||||||||
| 24 | url => "website of the package", | ||||||||||||||||||||||||||||||||||||||||||
| 25 | depends => [qw/apache2 perl/], | ||||||||||||||||||||||||||||||||||||||||||
| 26 | release => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | epoch => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | vendor => "some vendor", | ||||||||||||||||||||||||||||||||||||||||||
| 29 | license => "your license for ex. GPL2", | ||||||||||||||||||||||||||||||||||||||||||
| 30 | section => "some/section", | ||||||||||||||||||||||||||||||||||||||||||
| 31 | conflicts => [qw/somepkg/], | ||||||||||||||||||||||||||||||||||||||||||
| 32 | provides => "some-package-name", | ||||||||||||||||||||||||||||||||||||||||||
| 33 | arch => "amd64", | ||||||||||||||||||||||||||||||||||||||||||
| 34 | target => "linux / the platform", | ||||||||||||||||||||||||||||||||||||||||||
| 35 | post_install => "filename or script to run after installation", | ||||||||||||||||||||||||||||||||||||||||||
| 36 | pre_install => "filename or script to run before installation", | ||||||||||||||||||||||||||||||||||||||||||
| 37 | post_uninstall => "filename or script to run after uninstall", | ||||||||||||||||||||||||||||||||||||||||||
| 38 | pre_uninstall => "filename or script to run before uninstall", | ||||||||||||||||||||||||||||||||||||||||||
| 39 | exclude => [qw/file1 file2/], | ||||||||||||||||||||||||||||||||||||||||||
| 40 | maintainer => "your name", | ||||||||||||||||||||||||||||||||||||||||||
| 41 | priority => "optional", | ||||||||||||||||||||||||||||||||||||||||||
| 42 | config_files => [qw/special files for configuration mostly for etc directory/]; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | package Rex::Apache::Build::deb; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | use attributes; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | use Cwd qw(getcwd); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use Digest::MD5; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use Rex -base; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | use Rex::Template; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | $Rex::Template::DO_CHOMP = TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | use Rex::Apache::Build::Base; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | use base qw(Rex::Apache::Build::Base); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $that = shift; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $self = $proto->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | bless($self, $proto); | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if($self->{arch} eq "x86_64") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->{arch} = "amd64"; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->{priority} ||= "optional"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"priority"} ||= "optional"
MC/DC0%0/1
$self->{"priority"} ||= "optional"
$self->{"priority"}
Truth table0%0/2
A
A= $self->{"priority"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $self->{exclude} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"exclude"} ||= []
MC/DC0%0/1
$self->{"exclude"} ||= []
$self->{"exclude"}
Truth table0%0/2
A
A= $self->{"exclude"}
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | push(@{ $self->{exclude} }, qr{^Rexfile$}, qr{^Rexfile\.lock$}, qr{^\.git}, qr{^\.svn}, qr{.*~$}, qr{\.sw[a-z]$}, qr{\.deb$}); | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $name ||= $self->{name}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$name ||= $self->{"name"}
MC/DC0%0/2
$name ||= $self->{"name"}
$name
$self->{"name"}
Truth table0%0/3
A ||= B
A= $nameB= $self->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $version = $self->version; | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $old_dir = getcwd; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | mkdir "temp-deb-build"; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | mkdir "temp-deb-build/control"; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | mkdir "temp-deb-build/tree"; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $self->copy_files_to_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | file "temp-deb-build/debian-binary", | |||||||||||||||||||||||||||||||||||||||||
| 98 | content => "2.0\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | file "temp-deb-build/control/control", | |||||||||||||||||||||||||||||||||||||||||
| 102 | content => template('@control.file', pkg => $self); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | file "temp-deb-build/control/md5sums", | |||||||||||||||||||||||||||||||||||||||||
| 105 | content => $self->get_md5sums; | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->create_config_files; | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->create_scripts; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->package_data; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->package_control; | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | rmdir "temp-deb-build/tree"; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | rmdir "temp-deb-build/control"; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | chdir "temp-deb-build"; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $arch = $self->{arch}; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $package_name = "${name}_${version}_${arch}.deb"; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | run "ar -qc ../$package_name debian-binary control.tar.gz data.tar.gz"; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | chdir ".."; | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | rmdir "temp-deb-build"; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | Rex::Logger::info("Your build is now available: $package_name"); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $package_name; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub create_config_files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_config_files: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if($self->{config_files}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | file "temp-deb-build/control/conffiles", | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | content => join("\n", @{ $self->{config_files} }); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub create_scripts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_scripts: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if($self->{post_install}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $post_install = $self->{post_install}; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if($post_install !~ m/\n/sim && -f $post_install) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $post_install =~ /\n/ism and -f $post_install
MC/DC0%0/2
not $post_install =~ /\n/ism and -f $post_install
not $post_install =~ /\n/ism
-f $post_install
Truth table0%0/3
not(A) and B
A= not $post_install =~ /\n/ismB= -f $post_install
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $post_install = eval { local(@ARGV, $/) = ($post_install); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | file "temp-deb-build/control/postinst", | |||||||||||||||||||||||||||||||||||||||||
| 149 | content => $post_install, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | mode => 755; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if($self->{pre_install}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $pre_install = $self->{pre_install}; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if($pre_install !~ m/\n/sim && -f $pre_install) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $pre_install =~ /\n/ism and -f $pre_install
MC/DC0%0/2
not $pre_install =~ /\n/ism and -f $pre_install
not $pre_install =~ /\n/ism
-f $pre_install
Truth table0%0/3
not(A) and B
A= not $pre_install =~ /\n/ismB= -f $pre_install
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $pre_install = eval { local(@ARGV, $/) = ($pre_install); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | file "temp-deb-build/control/preinst", | |||||||||||||||||||||||||||||||||||||||||
| 160 | content => $pre_install, | ||||||||||||||||||||||||||||||||||||||||||
| 161 | mode => 755; | ||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if($self->{post_uninstall}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $post_uninstall = $self->{post_uninstall}; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if($post_uninstall !~ m/\n/sim && -f $post_uninstall) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $post_uninstall =~ /\n/ism and -f $post_uninstall
MC/DC0%0/2
not $post_uninstall =~ /\n/ism and -f $post_uninstall
not $post_uninstall =~ /\n/ism
-f $post_uninstall
Truth table0%0/3
not(A) and B
A= not $post_uninstall =~ /\n/ismB= -f $post_uninstall
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $post_uninstall = eval { local(@ARGV, $/) = ($post_uninstall); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | file "temp-deb-build/control/postrm", | |||||||||||||||||||||||||||||||||||||||||
| 171 | content => $post_uninstall, | ||||||||||||||||||||||||||||||||||||||||||
| 172 | mode => 755; | ||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if($self->{pre_uninstall}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $pre_uninstall = $self->{pre_uninstall}; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if($pre_uninstall !~ m/\n/sim && -f $pre_uninstall) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $pre_uninstall =~ /\n/ism and -f $pre_uninstall
MC/DC0%0/2
not $pre_uninstall =~ /\n/ism and -f $pre_uninstall
not $pre_uninstall =~ /\n/ism
-f $pre_uninstall
Truth table0%0/3
not(A) and B
A= not $pre_uninstall =~ /\n/ismB= -f $pre_uninstall
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $pre_uninstall = eval { local(@ARGV, $/) = ($pre_uninstall); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | file "temp-deb-build/control/prerm", | |||||||||||||||||||||||||||||||||||||||||
| 182 | content => $pre_uninstall, | ||||||||||||||||||||||||||||||||||||||||||
| 183 | mode => 755; | ||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub package_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
package_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | chdir "temp-deb-build/tree"; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | run "tar czf ../data.tar.gz ."; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | chdir "../../"; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub package_control { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
package_control: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | chdir "temp-deb-build/control"; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | run "tar czf ../control.tar.gz ."; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | chdir "../../"; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | sub copy_files_to_tmp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy_files_to_tmp: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | my $prefix = $self->prefix || "."; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->prefix || '.'
MC/DC0%0/1
$self->prefix || '.'
$self->prefix
Truth table0%0/2
A
A= $self->prefix
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | mkdir "temp-deb-build/tree/$prefix"; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my @dirs = ($self->{source}); | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | for my $dir (@dirs) { | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | opendir(my $dh, $dir) or die($!); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | DIR_ENTRY: while(my $entry = readdir($dh)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | next if ($entry eq "." or $entry eq ".." or $entry eq "temp-deb-build"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$entry eq "." or $entry eq ".." or $entry eq "temp-deb-build"
$entry eq "." or $entry eq ".."
MC/DC0%0/3
$entry eq "." or $entry eq ".." or $entry eq "temp-deb-build"
$entry eq "."
$entry eq ".."
$entry eq "temp-deb-build"
Truth table0%0/4
A or B or C
A= $entry eq "."B= $entry eq ".."C= $entry eq "temp-deb-build"
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | for my $ex (@{ $self->exclude }) { | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | if($entry =~ m/$ex/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | next DIR_ENTRY; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $new_dir = "$dir/$entry"; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $new_dir =~ s/^$dirs[0]//; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $new_dir =~ s/^\///; | |||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if(-d "$dir/$entry") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | mkdir "temp-deb-build/tree$prefix/$new_dir"; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | push(@dirs, "$dir/$entry"); | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | next DIR_ENTRY; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | cp "$dir/$entry", "temp-deb-build/tree$prefix/$new_dir"; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } # DIR_ENTRY | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | closedir($dh); | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub get_md5sums { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_md5sums: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my @s = (); | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | chdir "temp-deb-build/tree"; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my @dirs = ("."); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | for my $dir (@dirs) { | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | opendir(my $dh, $dir); | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | while(my $entry = readdir($dh)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | next if($entry eq "."); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | next if($entry eq ".."); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $file = "$dir/$entry"; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if(-d $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | push(@dirs, $file); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $md5 = Digest::MD5->new; | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | open(my $fh, "<", $file) or die($!); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $file =~ s/^\.\///; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $md5->addfile($fh); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | push(@s, $md5->hexdigest . " " . $file); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | close($fh); | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | closedir($dh); | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | chdir "../.."; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | return join("\n", @s); | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub description { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my ($self, $desc) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if($desc) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $self->{description} = $desc; | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $s = ""; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | my @lines = split(/\n/, $self->{description}); | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $s = shift(@lines); | |||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | for (@lines) { | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $s .= " $_"; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | sub depends { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
depends: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my ($self, $dep) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if($dep) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->{depends} = $dep; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my @s = (); | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | for my $dep (@{ $self->{depends} }) { | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | if(ref($dep)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my ($pkg) = keys %{ $dep }; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | my ($ver) = values %{ $dep }; | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | push(@s, $pkg . "($ver)"); | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | push(@s, $dep); | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return join(", ", @s); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub installed_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
installed_size: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $size = 0; | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | chdir "temp-deb-build/tree"; | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my @dirs = ("."); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | for my $dir (@dirs) { | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | opendir(my $dh, $dir); | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | while(my $entry = readdir($dh)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | next if($entry eq "."); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | next if($entry eq ".."); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my $file = "$dir/$entry"; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if(-d $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | push(@dirs, $file); | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $size += -s $file; | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | closedir($dh); | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | chdir "../.."; | |||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | return $size; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||