| 1 | package CPANPLUS::Dist::Arch; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings 'FATAL' => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use CPANPLUS::Dist::Base qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | our $VERSION = '1.30'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | our @EXPORT = qw(); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | our @EXPORT_OK = qw(dist_pkgname dist_pkgver); | |||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] ); | |||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | our @ISA = qw(CPANPLUS::Dist::Base); | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use File::Spec::Functions qw(catfile catdir); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use Module::CoreList qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use CPANPLUS::Error qw(error msg); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use Digest::MD5 qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use Pod::Select qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 7 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | use File::Path 2.06_05 qw(make_path); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | ▶ | use File::Copy qw(copy); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use File::stat qw(stat); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | ▶ | use DynaLoader qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use IPC::Cmd qw(can_run); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | ▶ | use version qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 7 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 7 | ▶ | use Carp qw(carp croak confess); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | ▶ | use Cwd qw(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # CLASS CONSTANTS | ||||||||||||||||||||||||||||||||||||||||||
| 33 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | my $MKPKGCONF_FQP = '/etc/makepkg.conf'; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 7 | my $CPANURL = 'http://search.cpan.org'; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | my $ROOT_USER_ID = 0; | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 7 | my $CFG_VALUE_MATCH = '\A \s* (%s) \s* = \s* (.*?) \s* (?: \#.* )? \z'; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | my $NONROOT_WARNING = <<'END_MSG'; | |||||||||||||||||||||||||||||||||||||||||
| 43 | In order to install packages as a non-root user (highly recommended) | ||||||||||||||||||||||||||||||||||||||||||
| 44 | you must have a sudo-like command specified in your CPANPLUS | ||||||||||||||||||||||||||||||||||||||||||
| 45 | configuration. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | END_MSG | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # Patterns to use when using pacman for finding library owners. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 7 | my $PACMAN_FINDOWN = qr/\A.*? is owned by /; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | my $PACMAN_FINDOWN_ERR = qr/\Aerror:/; | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | # Override a package's name to conform to packaging guidelines. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # Copied entries from CPANPLUS::Dist::Pacman and alot more | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # from searching for packages with perl in their name in | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # [extra] and [community] | ||||||||||||||||||||||||||||||||||||||||||
| 56 | my $PKGNAME_OVERRIDES = | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 7 | { map { split /[\s=]+/ } split /\s*\n+\s*/, <<'END_OVERRIDES' }; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | libwww-perl = perl-libwww | ||||||||||||||||||||||||||||||||||||||||||
| 60 | aceperl = perl-ace | ||||||||||||||||||||||||||||||||||||||||||
| 61 | mod_perl = mod_perl | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | glade-perl-two = perl-glade-two | ||||||||||||||||||||||||||||||||||||||||||
| 64 | Gnome2-GConf = gconf-perl | ||||||||||||||||||||||||||||||||||||||||||
| 65 | Gtk2-GladeXML = glade-perl | ||||||||||||||||||||||||||||||||||||||||||
| 66 | Glib = glib-perl | ||||||||||||||||||||||||||||||||||||||||||
| 67 | Gnome2 = gnome-perl | ||||||||||||||||||||||||||||||||||||||||||
| 68 | Gnome2-VFS = gnome-vfs-perl | ||||||||||||||||||||||||||||||||||||||||||
| 69 | Gnome2-Canvas = gnomecanvas-perl | ||||||||||||||||||||||||||||||||||||||||||
| 70 | Gnome2-GConf = gconf-perl | ||||||||||||||||||||||||||||||||||||||||||
| 71 | Gtk2 = gtk2-perl | ||||||||||||||||||||||||||||||||||||||||||
| 72 | Cairo = cairo-perl | ||||||||||||||||||||||||||||||||||||||||||
| 73 | Pango = pango-perl | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | Perl-Critic = perl-critic | ||||||||||||||||||||||||||||||||||||||||||
| 76 | Perl-Tidy = perl-tidy | ||||||||||||||||||||||||||||||||||||||||||
| 77 | App-Ack = ack | ||||||||||||||||||||||||||||||||||||||||||
| 78 | TermReadKey = perl-term-readkey | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | END_OVERRIDES | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # This var tells us whether to use a template module or our internal code: | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 7 | my $TT_MOD_NAME; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 7 | my @TT_MOD_SEARCH = qw/ Template Template::Alloy Template::Tiny /; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | sub _tt_block | ||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 21 | ▶ | my $inside = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tt_block: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 21 | return qr{ \[% -? | |||||||||||||||||||||||||||||||||||||||||
| 90 | \s* $inside \s* | ||||||||||||||||||||||||||||||||||||||||||
| 91 | (?: (?: -%\] \n* ) | %\] ) }xms; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | my $TT_IF_MATCH = _tt_block 'IF \s* (\w*)'; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | my $TT_END_MATCH = _tt_block 'END'; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | my $TT_VAR_MATCH = _tt_block '(\w+)'; | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | # Crude template for our PKGBUILD script | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 7 | my $PKGBUILD_TEMPL = <<'END_TEMPL'; | |||||||||||||||||||||||||||||||||||||||||
| 99 | # Contributor: [% packager %] | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # Generator : CPANPLUS::Dist::Arch [% version %] | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | pkgname='[% pkgname %]' | ||||||||||||||||||||||||||||||||||||||||||
| 103 | pkgver='[% pkgver %]' | ||||||||||||||||||||||||||||||||||||||||||
| 104 | pkgrel='[% pkgrel %]' | ||||||||||||||||||||||||||||||||||||||||||
| 105 | pkgdesc="[% pkgdesc %]" | ||||||||||||||||||||||||||||||||||||||||||
| 106 | arch=([% arch %]) | ||||||||||||||||||||||||||||||||||||||||||
| 107 | license=('PerlArtistic' 'GPL') | ||||||||||||||||||||||||||||||||||||||||||
| 108 | options=('!emptydirs') | ||||||||||||||||||||||||||||||||||||||||||
| 109 | depends=([% depends %]) | ||||||||||||||||||||||||||||||||||||||||||
| 110 | makedepends=([% makedepends %]) | ||||||||||||||||||||||||||||||||||||||||||
| 111 | [% IF checkdepends -%] | ||||||||||||||||||||||||||||||||||||||||||
| 112 | checkdepends=([% checkdepends %]) | ||||||||||||||||||||||||||||||||||||||||||
| 113 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 114 | [% IF conflicts -%] | ||||||||||||||||||||||||||||||||||||||||||
| 115 | conflicts=([% conflicts %]) | ||||||||||||||||||||||||||||||||||||||||||
| 116 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 117 | url='[% url %]' | ||||||||||||||||||||||||||||||||||||||||||
| 118 | source=('[% source %]') | ||||||||||||||||||||||||||||||||||||||||||
| 119 | md5sums=('[% md5sums %]') | ||||||||||||||||||||||||||||||||||||||||||
| 120 | [% IF sha512sums -%] | ||||||||||||||||||||||||||||||||||||||||||
| 121 | sha512sums=('[% sha512sums %]') | ||||||||||||||||||||||||||||||||||||||||||
| 122 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 123 | _distdir="[% distdir %]" | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | build() { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | ( export PERL_MM_USE_DEFAULT=1 PERL5LIB="" \ | ||||||||||||||||||||||||||||||||||||||||||
| 127 | PERL_AUTOINSTALL=--skipdeps \ | ||||||||||||||||||||||||||||||||||||||||||
| 128 | PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \ | ||||||||||||||||||||||||||||||||||||||||||
| 129 | PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \ | ||||||||||||||||||||||||||||||||||||||||||
| 130 | MODULEBUILDRC=/dev/null | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | cd "$srcdir/$_distdir" | ||||||||||||||||||||||||||||||||||||||||||
| 133 | [% IF is_makemaker -%] | ||||||||||||||||||||||||||||||||||||||||||
| 134 | /usr/bin/perl Makefile.PL | ||||||||||||||||||||||||||||||||||||||||||
| 135 | make | ||||||||||||||||||||||||||||||||||||||||||
| 136 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 137 | [% IF is_modulebuild -%] | ||||||||||||||||||||||||||||||||||||||||||
| 138 | /usr/bin/perl Build.PL | ||||||||||||||||||||||||||||||||||||||||||
| 139 | /usr/bin/perl Build | ||||||||||||||||||||||||||||||||||||||||||
| 140 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | check() { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | cd "$srcdir/$_distdir" | ||||||||||||||||||||||||||||||||||||||||||
| 146 | ( export PERL_MM_USE_DEFAULT=1 PERL5LIB="" | ||||||||||||||||||||||||||||||||||||||||||
| 147 | [% IF is_makemaker -%] | ||||||||||||||||||||||||||||||||||||||||||
| 148 | make test | ||||||||||||||||||||||||||||||||||||||||||
| 149 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 150 | [% IF is_modulebuild -%] | ||||||||||||||||||||||||||||||||||||||||||
| 151 | /usr/bin/perl Build test | ||||||||||||||||||||||||||||||||||||||||||
| 152 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 153 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | package() { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | cd "$srcdir/$_distdir" | ||||||||||||||||||||||||||||||||||||||||||
| 158 | [% IF is_makemaker -%] | ||||||||||||||||||||||||||||||||||||||||||
| 159 | make install | ||||||||||||||||||||||||||||||||||||||||||
| 160 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 161 | [% IF is_modulebuild -%] | ||||||||||||||||||||||||||||||||||||||||||
| 162 | /usr/bin/perl Build install | ||||||||||||||||||||||||||||||||||||||||||
| 163 | [% END -%] | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | find "$pkgdir" -name .packlist -o -name perllocal.pod -delete | ||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | # Local Variables: | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # mode: shell-script | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # sh-basic-offset: 2 | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # End: | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # vim:set ts=2 sw=2 et: | ||||||||||||||||||||||||||||||||||||||||||
| 173 | END_TEMPL | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | =for Weird "/usr/bin/perl Build" Syntax | ||||||||||||||||||||||||||||||||||||||||||
| 176 | We use "/usr/bin/perl Build" above instead of the normal "./Build" in | ||||||||||||||||||||||||||||||||||||||||||
| 177 | order to make the yaourt packager happy. Yaourt runs the PKGBUILD | ||||||||||||||||||||||||||||||||||||||||||
| 178 | under the /tmp directory and makepkg will fail if /tmp is a seperate | ||||||||||||||||||||||||||||||||||||||||||
| 179 | partition mounted with noexec. Thanks to xenoterracide on the AUR for | ||||||||||||||||||||||||||||||||||||||||||
| 180 | mentioning the problem. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | We also use /usr/bin/perl to ensure running the system-wide perl | ||||||||||||||||||||||||||||||||||||||||||
| 183 | interpreter. | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 188 | # CLASS GLOBALS | ||||||||||||||||||||||||||||||||||||||||||
| 189 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 7 | our ($Is_dependency, $PKGDEST, $SRCPKGDEST, $PACKAGER, $DEBUG); | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 7 | $PACKAGER = 'Anonymous'; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | sub _DEBUG; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | *_DEBUG = ( $ENV{DIST_ARCH_DEBUG} | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | ? sub { print STDERR '***DEBUG*** ', @_, "\n" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 21 | ▶ | : sub { return } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # Purpose: Expand environment variables and tildes like bash would. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 203 | sub _shell_expand | ||||||||||||||||||||||||||||||||||||||||||
| 204 | { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | my $dir = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_shell_expand: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $dir =~ s/ \A ~ / $ENV{HOME} /xmse; # tilde = homedir | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $dir =~ s/ (?<!\\) \$ (\w+) / $ENV{$1} || q{} /xmseg; # expand env vars | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $dir =~ s/ \\ [a-zA-Z] / /xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $dir =~ s/ \\ (.) / $1 /xmsg; # escaped special | |||||||||||||||||||||||||||||||||||||||||
| 210 | # chars | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return $dir; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | READ_CONF: | ||||||||||||||||||||||||||||||||||||||||||
| 215 | { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # Read makepkg.conf to see if there are system-wide settings | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 7 | my $mkpkgconf; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 7 | ▶ | if ( ! open $mkpkgconf, '<', $MKPKGCONF_FQP ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 7 | error "Could not read $MKPKGCONF_FQP: $!"; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 7 | last READ_CONF; | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my %cfg_vars = ( 'PKGDEST' => \$PKGDEST, | |||||||||||||||||||||||||||||||||||||||||
| 224 | 'SRCPKGDEST' => \$SRCPKGDEST, | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 'PACKAGER' => \$PACKAGER ); | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $cfg_field_match = sprintf $CFG_VALUE_MATCH, | |||||||||||||||||||||||||||||||||||||||||
| 228 | join '|', keys %cfg_vars; | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | CFG_LINE: | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | while (<$mkpkgconf>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | next CFG_LINE unless ( my ($name, $value) = /$cfg_field_match/xmso ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | ${ $cfg_vars{$name} } = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | ( $value =~ m/\A"(.*)"\z/ | ||||||||||||||||||||||||||||||||||||||||||
| 237 | ? _shell_expand( $1 ) # expand double quotes | ||||||||||||||||||||||||||||||||||||||||||
| 238 | : ( $value =~ m/\A'(.*)'\z/ | ||||||||||||||||||||||||||||||||||||||||||
| 239 | ? $1 # dont single quotes | ||||||||||||||||||||||||||||||||||||||||||
| 240 | : _shell_expand( $value ))); | ||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | close $mkpkgconf or error "close on makepkg.conf: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | # Environment variable has second highest priority for PACKAGER. | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 7 | ▶ | $PACKAGER = $ENV{PACKAGER} if $ENV{PACKAGER}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 249 | # PUBLIC CPANPLUS::Dist::Base Interface | ||||||||||||||||||||||||||||||||||||||||||
| 250 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | =for Interface Methods | ||||||||||||||||||||||||||||||||||||||||||
| 254 | See CPANPLUS::Dist::Base's documentation for a description of the | ||||||||||||||||||||||||||||||||||||||||||
| 255 | purpose of these functions. All of these "interface" methods override | ||||||||||||||||||||||||||||||||||||||||||
| 256 | Base's default actions in order to create our packages. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | #---INTERFACE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # Purpose : Checks if we have makepkg and pacman installed | ||||||||||||||||||||||||||||||||||||||||||
| 262 | # Returns : 1 - if we have the tools needed to make a pacman package. | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # 0 - if we don't think so. | ||||||||||||||||||||||||||||||||||||||||||
| 264 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 265 | sub format_available | ||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | for my $prog ( qw/ makepkg pacman / ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_available: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | if ( ! can_run($prog) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | error "CPANPLUS::Dist::Arch needs to run $prog, to work properly"; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | #---INTERFACE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 277 | # Purpose : Initializes our object internals to get things started | ||||||||||||||||||||||||||||||||||||||||||
| 278 | # Returns : 1 always | ||||||||||||||||||||||||||||||||||||||||||
| 279 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 280 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 5 | $self->status->mk_accessors( qw{ pkgname pkgver pkgbase pkgdesc | |||||||||||||||||||||||||||||||||||||||||
| 285 | pkgurl pkgsize arch pkgrel | ||||||||||||||||||||||||||||||||||||||||||
| 286 | builddir destdir metareqs | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | pkgbuild_templ tt_init_args } ); | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | #---INTERFACE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # Purpose : Prepares the files and directories we will need to build a | ||||||||||||||||||||||||||||||||||||||||||
| 295 | # package. Also prepares any data we expect to have later, | ||||||||||||||||||||||||||||||||||||||||||
| 296 | # on a per-object basis. | ||||||||||||||||||||||||||||||||||||||||||
| 297 | # Return : 1 if ok, 0 on error. | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # Postcond : Sets $self->status->prepare to 1 or 0 on success or | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # failure. | ||||||||||||||||||||||||||||||||||||||||||
| 300 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 301 | sub prepare | ||||||||||||||||||||||||||||||||||||||||||
| 302 | { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $status = $self->status; # Private hash | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $module = $self->parent; # CPANPLUS::Module | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my $intern = $module->parent; # CPANPLUS::Internals | |||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $conf = $intern->configure_object; # CPANPLUS::Configure | |||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $distcpan = $module->status->dist_cpan; # CPANPLUS::Dist::MM or | |||||||||||||||||||||||||||||||||||||||||
| 310 | # CPANPLUS::Dist::Build | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | # Call CPANPLUS::Dist::Base's prepare to resolve our pre-reqs. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $self->SUPER::prepare( @_ ) or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $self->_prepare_status; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | return $status->prepared; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | #---PRIVATE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # Purpose : Finds the first package file that matches our internal data. | ||||||||||||||||||||||||||||||||||||||||||
| 321 | # (Meaning we might have built it) We search for .tar.gz and | ||||||||||||||||||||||||||||||||||||||||||
| 322 | # .tar.xz files. | ||||||||||||||||||||||||||||||||||||||||||
| 323 | # Note : .tar.xz files have higher priority than .tar.gz files. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | # Params : $pkg_type - Must be 'bin' or 'src'. | ||||||||||||||||||||||||||||||||||||||||||
| 325 | # $destdir - The directory to search in for packages. | ||||||||||||||||||||||||||||||||||||||||||
| 326 | # Returns : The absolute path of the found package | ||||||||||||||||||||||||||||||||||||||||||
| 327 | #------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 328 | sub _find_built_pkg | ||||||||||||||||||||||||||||||||||||||||||
| 329 | { | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 4 | ▶ | my ($self, $pkg_type, $destdir) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_built_pkg: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 4 | my $status = $self->status; | |||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 4 | my $arch = $self->status->arch; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 4 | ▶ | if ( $arch eq q{'any'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 4 | $arch = 'any'; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | chomp( $arch = `uname -m` ); | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | ▶ | my $pkgfile = catfile( $destdir, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | ( join q{.}, | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | ( join q{-}, | ||||||||||||||||||||||||||||||||||||||||||
| 346 | $status->pkgname, | ||||||||||||||||||||||||||||||||||||||||||
| 347 | $status->pkgver, | ||||||||||||||||||||||||||||||||||||||||||
| 348 | $status->pkgrel, | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | ( $pkg_type eq q{bin} ? $arch : qw// ), | ||||||||||||||||||||||||||||||||||||||||||
| 351 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | ( $pkg_type eq q{bin} ? q{pkg} : q{src} ), | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | q{tar}, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | _DEBUG "Searching for file starting with $pkgfile"; | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 4 | my ($found) = grep { -f $_ } map { "$pkgfile.$_" } qw/ xz gz bz2 /; | |||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 4 | ▶ | _DEBUG ( $found ? "Found $found" : "No package file found!" ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 4 | return $found; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | #---INTERFACE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 368 | # Purpose : Creates the pacman package using the 'makepkg' command. | ||||||||||||||||||||||||||||||||||||||||||
| 369 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 370 | sub create | ||||||||||||||||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | my ($self, %opts) = (shift, @_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=22 SCAR=62.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $status = $self->status; # Private hash | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $module = $self->parent; # CPANPLUS::Module | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $intern = $module->parent; # CPANPLUS::Internals | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $conf = $intern->configure_object; # CPANPLUS::Configure | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $distcpan = $module->status->dist_cpan; # CPANPLUS::Dist::MM or | |||||||||||||||||||||||||||||||||||||||||
| 379 | # CPANPLUS::Dist::Build | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | my $pkg_type = $opts{pkg} || $opts{pkgtype} || 'bin'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$opts{'pkg'} || $opts{'pkgtype'} || 'bin'
$opts{"pkg"} or $opts{"pkgtype"}
MC/DC0%0/2
$opts{'pkg'} || $opts{'pkgtype'} || 'bin'
$opts{"pkg"}
$opts{"pkgtype"}
Truth table0%0/3
A or B
A= $opts{"pkg"}B= $opts{"pkgtype"}
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $pkg_type = lc $pkg_type; | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | unless ( $pkg_type =~ /^(?:bin|src)$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | error qq{Invalid package type requested: "$pkg_type" | |||||||||||||||||||||||||||||||||||||||||
| 386 | Package type must be 'bin' or 'src'}; | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | if ( $opts{verbose} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my %fullname = ( bin => 'binary', src => 'source' ); | |||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | msg "Creating a $fullname{$pkg_type} pacman package"; | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( $pkg_type eq 'bin' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | # Use CPANPLUS::Dist::Base to make packages for pre-requisites... | ||||||||||||||||||||||||||||||||||||||||||
| 397 | # (starts the packaging process for any missing ones) | ||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my @ok_resolve_args = qw/ verbose target force prereq_build /; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my %resolve_args = ( map { ( exists $opts{$_} ? | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | ($_ => $opts{$_}) : () ) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | @ok_resolve_args ); | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | local $Is_dependency = 1; # only top level pkgs explicitly installed | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $distcpan->_resolve_prereqs( %resolve_args, | |||||||||||||||||||||||||||||||||||||||||
| 406 | 'format' => ref $self, | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 'prereqs' => $module->status->prereqs ); | ||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | # Prepare our file name paths for pkgfile and source tarball... | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $srcfile_fqp = $status->pkgbase . '/' . $module->package; | |||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my ($destenv, $destdir) = $self->_calc_setdest( $pkg_type ); | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | $destdir = $opts{'destdir'} || $status->destdir || $destdir; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$opts{'destdir'} || $status->destdir || $destdir
$opts{"destdir"} or $status->destdir
MC/DC0%0/3
$opts{'destdir'} || $status->destdir || $destdir
$opts{"destdir"}
$status->destdir
$destdir
Truth table0%0/4
A or B || C
A= $opts{"destdir"}B= $status->destdirC= $destdir
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | # Create directories for building and delivering the new package. | ||||||||||||||||||||||||||||||||||||||||||
| 417 | MKDIR_LOOP: | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | for my $dir ( $status->pkgbase, $destdir ) { | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if ( -e $dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | die "$dir exists but is not a directory!" unless ( -d _ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | die "$dir exists but is read-only!" unless ( -w _ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | next MKDIR_LOOP; | |||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | make_path( $dir, { 'verbose' => $opts{'verbose'} ? 1 : 0 }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $destdir = Cwd::abs_path( $destdir ); | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | # Prepare our 'makepkg' package building directory, | ||||||||||||||||||||||||||||||||||||||||||
| 430 | # namely the PKGBUILD and source tarball files... | ||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( ! -e $srcfile_fqp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $tarball_fqp = $module->_status->fetch; | |||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | link $tarball_fqp, $srcfile_fqp | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | or error "Failed to create link to $tarball_fqp: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $self->create_pkgbuild( $self->status->pkgbase ); | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | # Package it up! | ||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | local $ENV{ $destenv } = $destdir; | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | my @cmdopts = (($EUID == 0) => '--asroot', | ||||||||||||||||||||||||||||||||||||||||||
| 443 | ($pkg_type eq 'src') => '--source', | ||||||||||||||||||||||||||||||||||||||||||
| 444 | $opts{'nocolor'} => '--nocolor', | ||||||||||||||||||||||||||||||||||||||||||
| 445 | $opts{'skiptest'} => '--nocheck', | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $opts{'quiet'} => '2>&1 >/dev/null'); | |||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | while ($i < @cmdopts) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | if ($cmdopts[$i]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | splice @cmdopts, $i++, 1; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | splice @cmdopts, $i, 2; | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my $oldcwd = Cwd::getcwd(); | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | chdir $status->pkgbase or die "chdir: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | my $makepkg_cmd = join q{ }, 'makepkg', '-f', @cmdopts; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | system $makepkg_cmd; | |||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if ( $CHILD_ERROR ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | error ( $CHILD_ERROR & 127 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | ? sprintf "makepkg failed with signal %d", $CHILD_ERROR & 127 | ||||||||||||||||||||||||||||||||||||||||||
| 465 | : sprintf "makepkg returned abnormal status: %d", | ||||||||||||||||||||||||||||||||||||||||||
| 466 | $CHILD_ERROR >> 8 ); | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | chdir $oldcwd or die "chdir: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | my $pkg_path = $self->_find_built_pkg( $pkg_type, $destdir ); | |||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $status->dist( $pkg_path ); | |||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return $status->created( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | #---INTERFACE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 479 | # Purpose : Installs the package file (.pkg.tar.xz) using sudo and | ||||||||||||||||||||||||||||||||||||||||||
| 480 | # pacman. | ||||||||||||||||||||||||||||||||||||||||||
| 481 | # Comments : Called automatically on pre-requisite packages | ||||||||||||||||||||||||||||||||||||||||||
| 482 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 483 | sub install | ||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | my ($self, %opts) = (shift, @_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my $status = $self->status; # Private hash | |||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my $module = $self->parent; # CPANPLUS::Module | |||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $intern = $module->parent; # CPANPLUS::Internals | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $conf = $intern->configure_object; # CPANPLUS::Configure | |||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | my $pkgfile_fqp = $status->dist; | |||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | unless ( $pkgfile_fqp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | error << 'END_ERROR'; | |||||||||||||||||||||||||||||||||||||||||
| 495 | Path to package file has not been set. | ||||||||||||||||||||||||||||||||||||||||||
| 496 | Someone is using CPANPLUS::Dist::Arch incorrectly. | ||||||||||||||||||||||||||||||||||||||||||
| 497 | Tell them to call create() before install(). | ||||||||||||||||||||||||||||||||||||||||||
| 498 | END_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | die "Package file $pkgfile_fqp was not found" if ( ! -f $pkgfile_fqp ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | my @pacmancmd = ( 'pacman', | ||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | ($opts{'force'} ? '--force' : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | '--noconfirm', | ||||||||||||||||||||||||||||||||||||||||||
| 507 | ($Is_dependency ? '--asdeps' : '--asexplicit'), | ||||||||||||||||||||||||||||||||||||||||||
| 508 | '-U', $pkgfile_fqp, | ||||||||||||||||||||||||||||||||||||||||||
| 509 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | # Make sure the user has access to install a package... | ||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my $sudocmd = $conf->get_program('sudo'); | |||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if ( $EFFECTIVE_USER_ID != $ROOT_USER_ID ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | if ( $sudocmd ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | unshift @pacmancmd, $sudocmd; | |||||||||||||||||||||||||||||||||||||||||
| 516 | # $pacmancmd = "$sudocmd pacman -U $pkgfile_fqp"; | ||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||
| 518 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | error $NONROOT_WARNING; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | system @pacmancmd; | |||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | if ( $CHILD_ERROR ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | error ( $CHILD_ERROR & 127 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | ? sprintf qq{'@pacmancmd' failed with signal %d}, | ||||||||||||||||||||||||||||||||||||||||||
| 529 | $CHILD_ERROR & 127 | ||||||||||||||||||||||||||||||||||||||||||
| 530 | : sprintf qq{'@pacmancmd' returned abnormal status: %d}, | ||||||||||||||||||||||||||||||||||||||||||
| 531 | $CHILD_ERROR >> 8 | ||||||||||||||||||||||||||||||||||||||||||
| 532 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | return $status->installed(1); | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 541 | # EXPORTED FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 542 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | sub dist_pkgname | ||||||||||||||||||||||||||||||||||||||||||
| 546 | { | ||||||||||||||||||||||||||||||||||||||||||
| 547 | 34 | ▶ | croak "Must provide arguments to dist_pkgname" if ( @_ == 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist_pkgname: called CC=5 SCAR=16.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 34 | my ($distname) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | # Override this package name if there is one specified... | ||||||||||||||||||||||||||||||||||||||||||
| 551 | return $PKGNAME_OVERRIDES->{$distname} | ||||||||||||||||||||||||||||||||||||||||||
| 552 | 34 | ▶ | if $PKGNAME_OVERRIDES->{$distname}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | # Package names should be lowercase and consist of alphanumeric | ||||||||||||||||||||||||||||||||||||||||||
| 555 | # characters only (and hyphens!)... | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 28 | $distname = lc $distname; | |||||||||||||||||||||||||||||||||||||||||
| 557 | 28 | $distname =~ tr/_/-/; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 28 | $distname =~ tr/-a-z0-9+//cd; # Delete all other chars | |||||||||||||||||||||||||||||||||||||||||
| 559 | 28 | $distname =~ s/-[+]/-/g; # + next to - looks weird | |||||||||||||||||||||||||||||||||||||||||
| 560 | 28 | $distname =~ s/[+]-/-/g; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 28 | $distname =~ tr/-/-/s; | |||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | # Delete leading or trailing hyphens... | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 28 | $distname =~ s/\A-//; | |||||||||||||||||||||||||||||||||||||||||
| 565 | 28 | $distname =~ s/-\z//; | |||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 28 | ▶ | die qq{Dist name '$distname' completely violates packaging standards} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | if ( length $distname == 0 ); | ||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | # Don't prefix the package with perl- if it IS perl... | ||||||||||||||||||||||||||||||||||||||||||
| 571 | 28 | ▶ | $distname = "perl-$distname" unless ( $distname eq 'perl' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 28 | return $distname; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | sub dist_pkgver | ||||||||||||||||||||||||||||||||||||||||||
| 577 | { | ||||||||||||||||||||||||||||||||||||||||||
| 578 | 13 | ▶ | my ($version) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist_pkgver: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | # Remove developer versions because pacman has no special logic | ||||||||||||||||||||||||||||||||||||||||||
| 581 | # to handle comparing them to regular versions such as perl uses. | ||||||||||||||||||||||||||||||||||||||||||
| 582 | 13 | $version =~ s/_[^_]+\z//; | |||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | # Package versions should be numbers and decimal points only... | ||||||||||||||||||||||||||||||||||||||||||
| 585 | 13 | $version =~ tr/-_/../; | |||||||||||||||||||||||||||||||||||||||||
| 586 | 13 | $version =~ tr/0-9.//cd; | |||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 13 | $version =~ tr/././s; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 13 | $version =~ s/^[.]|[.]$//g; | |||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | 13 | return $version; | |||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | =for Letters In Versions | ||||||||||||||||||||||||||||||||||||||||||
| 595 | Letters aren't allowed in versions because makepkg doesn't handle them | ||||||||||||||||||||||||||||||||||||||||||
| 596 | in dependencies. Example: | ||||||||||||||||||||||||||||||||||||||||||
| 597 | * CAM::PDF requires Text::PDF 0.29 | ||||||||||||||||||||||||||||||||||||||||||
| 598 | * Text::PDF 0.29a was built/installed | ||||||||||||||||||||||||||||||||||||||||||
| 599 | * makepkg still complains about perl-text-pdf>=0.29 is missing ... ? | ||||||||||||||||||||||||||||||||||||||||||
| 600 | So ... no more letters in versions. | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 606 | # PUBLIC METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 607 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | sub set_destdir | ||||||||||||||||||||||||||||||||||||||||||
| 611 | { | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | croak 'Invalid arguments to set_destdir' if ( @_ != 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_destdir: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | my ($self, $destdir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $self->status->destdir($destdir); | |||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | return $destdir; | |||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | sub get_destdir | ||||||||||||||||||||||||||||||||||||||||||
| 619 | { | ||||||||||||||||||||||||||||||||||||||||||
| 620 | return shift->status->destdir | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_destdir: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | sub get_pkgpath | ||||||||||||||||||||||||||||||||||||||||||
| 624 | { | ||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | shift->status->dist; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgpath: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | sub get_cpandistdir | ||||||||||||||||||||||||||||||||||||||||||
| 629 | { | ||||||||||||||||||||||||||||||||||||||||||
| 630 | 10 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cpandistdir: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 10 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 10 | my $distdir = $module->status->dist_cpan->status->distdir; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 10 | $distdir =~ s{^.*/}{}; | |||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 10 | return $distdir; | |||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | sub get_pkgname | ||||||||||||||||||||||||||||||||||||||||||
| 640 | { | ||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | return shift->status->pkgname; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgname: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | sub get_pkgver | ||||||||||||||||||||||||||||||||||||||||||
| 645 | { | ||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | return shift->status->pkgver; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgver: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | sub get_pkgrel | ||||||||||||||||||||||||||||||||||||||||||
| 650 | { | ||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgrel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | return $self->status->pkgrel; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | sub set_pkgrel | ||||||||||||||||||||||||||||||||||||||||||
| 656 | { | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | my ($self, $new_pkgrel) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_pkgrel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | return $self->status->pkgrel( $new_pkgrel ); | |||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 662 | # Converts a specification aref into a pkg specification (i.e. depends). | ||||||||||||||||||||||||||||||||||||||||||
| 663 | # This can be used as a PKGBUILD field's value. | ||||||||||||||||||||||||||||||||||||||||||
| 664 | sub _specstr | ||||||||||||||||||||||||||||||||||||||||||
| 665 | { | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 20 | ▶ | my ($a) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_specstr: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 667 | 20 | my @strs; | |||||||||||||||||||||||||||||||||||||||||
| 668 | 20 | for my $x (@$a) { | |||||||||||||||||||||||||||||||||||||||||
| 669 | 10 | push @strs, join q{}, @$x; | |||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||
| 671 | 20 | return join ' ', map { qq{'$_'} } @strs; | |||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | sub get_pkgvars | ||||||||||||||||||||||||||||||||||||||||||
| 675 | { | ||||||||||||||||||||||||||||||||||||||||||
| 676 | 10 | ▶ | croak 'Invalid arguments to get_pkgvars' if ( @_ != 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgvars: called CC=7 SCAR=20.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 679 | 10 | my $status = $self->status; | |||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 10 | ▶ | croak 'prepare() must be called before get_pkgvars()' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | unless ($status->prepared); | ||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||
| 684 | 10 | my $pkglinks = $self->_get_pkg_rels; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 10 | my @shavars; | |||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 10 | my %vars = (pkgname => $status->pkgname, | |||||||||||||||||||||||||||||||||||||||||
| 688 | pkgver => $status->pkgver, | ||||||||||||||||||||||||||||||||||||||||||
| 689 | pkgrel => $status->pkgrel, | ||||||||||||||||||||||||||||||||||||||||||
| 690 | arch => $status->arch, | ||||||||||||||||||||||||||||||||||||||||||
| 691 | pkgdesc => $status->pkgdesc, | ||||||||||||||||||||||||||||||||||||||||||
| 692 | url => $self->_get_disturl, | ||||||||||||||||||||||||||||||||||||||||||
| 693 | source => $self->_get_srcurl, | ||||||||||||||||||||||||||||||||||||||||||
| 694 | md5sums => $self->_calc_tarballmd5, | ||||||||||||||||||||||||||||||||||||||||||
| 695 | pkglinks => $pkglinks, | ||||||||||||||||||||||||||||||||||||||||||
| 696 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 10 | ▶ | if (eval { require Digest::SHA }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 10 | $vars{'sha512sums'} = $self->_calc_shasum(512); | |||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 10 | $vars{$_} = _specstr($pkglinks->{$_}) for (qw/depends makedepends/); | |||||||||||||||||||||||||||||||||||||||||
| 702 | 10 | for (qw/checkdepends conflicts/) { | |||||||||||||||||||||||||||||||||||||||||
| 703 | 20 | ▶ | if (@{$pkglinks->{$_}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $vars{$_} = _specstr($pkglinks->{$_}); | |||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 10 | return %vars; | |||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | sub get_pkgvars_ref | ||||||||||||||||||||||||||||||||||||||||||
| 712 | { | ||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | croak 'Invalid arguments to get_pkgvars_ref' if ( @_ != 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgvars_ref: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | return { $self->get_pkgvars }; | |||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | sub set_tt_init_args | ||||||||||||||||||||||||||||||||||||||||||
| 720 | { | ||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tt_init_args: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | croak 'set_tt_init_args() must be given a hash as an argument' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | unless @_ % 2 == 0; | ||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | return $self->status->tt_init_args( { @_ } ); | |||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | sub set_tt_module | ||||||||||||||||||||||||||||||||||||||||||
| 730 | { | ||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | ▶ | my ($self, $modname) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tt_module: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | 2 | ▶ | return ( $TT_MOD_NAME = 0 ) unless $modname; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||
| 735 | 1 | ▶ | croak qq{Failed to load template module "$modname"} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 736 | unless eval "require $modname; 1;"; | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | _DEBUG "Loaded template module: $modname"; | |||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | 1 | return $TT_MOD_NAME = $modname; | |||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | sub get_tt_module | ||||||||||||||||||||||||||||||||||||||||||
| 744 | { | ||||||||||||||||||||||||||||||||||||||||||
| 745 | 1 | ▶ | _load_tt_module() unless defined $TT_MOD_NAME; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tt_module: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | return $TT_MOD_NAME; | |||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | sub set_pkgbuild_templ | ||||||||||||||||||||||||||||||||||||||||||
| 751 | { | ||||||||||||||||||||||||||||||||||||||||||
| 752 | 9 | ▶ | my ($self, $template) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_pkgbuild_templ: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 9 | return $self->status->pkgbuild_templ( $template ); | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | sub get_pkgbuild_templ | ||||||||||||||||||||||||||||||||||||||||||
| 758 | { | ||||||||||||||||||||||||||||||||||||||||||
| 759 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgbuild_templ: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | 2 | ▶ | return $self->status->pkgbuild_templ() || $PKGBUILD_TEMPL; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->status->pkgbuild_templ || $PKGBUILD_TEMPL
MC/DC0%0/2
$self->status->pkgbuild_templ || $PKGBUILD_TEMPL
$self->status->pkgbuild_templ
$PKGBUILD_TEMPL
Truth table66%2/3
A || B
A= $self->status->pkgbuild_templB= $PKGBUILD_TEMPL
| |||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | sub get_pkgbuild | ||||||||||||||||||||||||||||||||||||||||||
| 765 | { | ||||||||||||||||||||||||||||||||||||||||||
| 766 | 10 | ▶ | croak 'Invalid arguments to get_pkgbuild' if ( @_ < 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pkgbuild: called CC=6 SCAR=18.4
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 10 | my $status = $self->status; | |||||||||||||||||||||||||||||||||||||||||
| 770 | 10 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 771 | 10 | my $conf = $module->parent->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | 10 | ▶ | croak 'prepare() must be called before get_pkgbuild()' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | unless $status->prepared; | ||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 10 | my %pkgvars = $self->get_pkgvars; | |||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | # Quote our package desc for bash. | ||||||||||||||||||||||||||||||||||||||||||
| 779 | 10 | $pkgvars{pkgdesc} =~ s/ ([\$\"\`]) /\\$1/gxms; | |||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | 10 | my $templ_vars = { packager => $PACKAGER, | |||||||||||||||||||||||||||||||||||||||||
| 782 | version => $VERSION, | ||||||||||||||||||||||||||||||||||||||||||
| 783 | %pkgvars, | ||||||||||||||||||||||||||||||||||||||||||
| 784 | distdir => $self->get_cpandistdir(), | ||||||||||||||||||||||||||||||||||||||||||
| 785 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | 10 | my $dist_type = $module->status->installer_type; | |||||||||||||||||||||||||||||||||||||||||
| 788 | 10 | ▶ | @{$templ_vars}{'is_makemaker', 'is_modulebuild'} = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | ( $dist_type eq 'CPANPLUS::Dist::MM' ? (1, 0) : | ||||||||||||||||||||||||||||||||||||||||||
| 790 | $dist_type eq 'CPANPLUS::Dist::Build' ? (0, 1) : | ||||||||||||||||||||||||||||||||||||||||||
| 791 | die "unknown Perl module installer type: '$dist_type'" ); | ||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | 10 | ▶ | my $templ_text = $status->pkgbuild_templ || $PKGBUILD_TEMPL; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$status->pkgbuild_templ || $PKGBUILD_TEMPL
MC/DC0%0/2
$status->pkgbuild_templ || $PKGBUILD_TEMPL
$status->pkgbuild_templ
$PKGBUILD_TEMPL
Truth table66%2/3
A || B
A= $status->pkgbuild_templB= $PKGBUILD_TEMPL
| |||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | 10 | return scalar $self->_process_template( $templ_text, $templ_vars ); | |||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | sub create_pkgbuild | ||||||||||||||||||||||||||||||||||||||||||
| 799 | { | ||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | croak 'Invalid arguments to create_pkgbuild' if ( @_ < 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_pkgbuild: not called CC=6 SCAR=37.4
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | my ($self, $destdir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | croak qq{Invalid directory passed to create_pkgbuild: "$destdir" ... | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $destdir and -w _
MC/DC0%0/2
-d $destdir and -w _
-d $destdir
-w _
Truth table0%0/3
A and B
A= -d $destdirB= -w _
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | Directory does not exist or is not writeable} | ||||||||||||||||||||||||||||||||||||||||||
| 805 | unless ( -d $destdir && -w _ ); | ||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my $pkgbuild_text = $self->get_pkgbuild(); | |||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | my $fqpath = catfile( $destdir, 'PKGBUILD' ); | |||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | open my $pkgbuild_file, '>', $fqpath | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 811 | or die "failed to open new PKGBUILD: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | print $pkgbuild_file $pkgbuild_text; | |||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | close $pkgbuild_file | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 814 | or die "failed to close new PKGBUILD: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 821 | # PRIVATE INSTANCE METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 822 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | #---HELPER METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 825 | # Caculates where we should store our built package. | ||||||||||||||||||||||||||||||||||||||||||
| 826 | # (does not take into account our $self->status state or parameters) | ||||||||||||||||||||||||||||||||||||||||||
| 827 | # | ||||||||||||||||||||||||||||||||||||||||||
| 828 | # Returns the environment variable we should override as well as the | ||||||||||||||||||||||||||||||||||||||||||
| 829 | # value we should set it to. | ||||||||||||||||||||||||||||||||||||||||||
| 830 | sub _calc_setdest | ||||||||||||||||||||||||||||||||||||||||||
| 831 | { | ||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | ▶ | my ($self, $pkg_type) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calc_setdest: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | my $destenv = ( $pkg_type eq 'src' ? 'SRCPKGDEST' : 'PKGDEST' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | ▶ | my $destdir = ( $ENV{ $destenv } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ENV{$destenv} || ($pkg_type eq 'src' ? $CPANPLUS::Dist::Arch::SRCPKGDEST : $CPANPLUS::Dist::Arch::PKGDEST) || $self->_fallback_destdir
$ENV{$destenv} or $pkg_type eq "src" ? $CPANPLUS::Dist::Arch::SRCPKGDEST : $CPANPLUS::Dist::Arch::PKGDEST
MC/DC0%0/3
$ENV{$destenv} || ($pkg_type eq 'src' ? $CPANPLUS::Dist::Arch::SRCPKGDEST : $CPANPLUS::Dist::Arch::PKGDEST) || $self->_fallback_destdir
$ENV{$destenv}
$pkg_type eq "src" ? $CPANPLUS::Dist::Arch::SRCPKGDEST : $CPANPLUS::Dist::Arch::PKGDEST
$self->_fallback_destdir
Truth table0%0/4
A or B || C
A= $ENV{$destenv}B= $pkg_type eq "src" ? $CPANPLUS::Dist::Arch::SRCPKGDEST : $CPANPLUS::Dist::Arch::PKGDESTC= $self->_fallback_destdir
| |||||||||||||||||||||||||||||||||||||||||||
| 836 | || ( $pkg_type eq 'src' ? $SRCPKGDEST : $PKGDEST ) | ||||||||||||||||||||||||||||||||||||||||||
| 837 | || $self->_fallback_destdir ); | ||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | return ( $destenv, $destdir ); | |||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | #---HELPER METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 843 | # Returns the default base directory that our separate build and | ||||||||||||||||||||||||||||||||||||||||||
| 844 | # package cache directories append themselves to. | ||||||||||||||||||||||||||||||||||||||||||
| 845 | # Example: ~/.cpanplus/5.12.1/pacman | ||||||||||||||||||||||||||||||||||||||||||
| 846 | sub _cpanp_user_basedir | ||||||||||||||||||||||||||||||||||||||||||
| 847 | { | ||||||||||||||||||||||||||||||||||||||||||
| 848 | 5 | ▶ | my $conf = shift->parent->parent->configure_object; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cpanp_user_basedir: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 849 | 5 | return catdir( $conf->get_conf('base'), | |||||||||||||||||||||||||||||||||||||||||
| 850 | ( sprintf '%vd', $PERL_VERSION ), | ||||||||||||||||||||||||||||||||||||||||||
| 851 | 'pacman' ); | ||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | #---HELPER METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 855 | # Returns the default package cache directory when no other directory | ||||||||||||||||||||||||||||||||||||||||||
| 856 | # is specified by many other means. This directory is inside the | ||||||||||||||||||||||||||||||||||||||||||
| 857 | # $HOME/.cpanplus directory for each different user. | ||||||||||||||||||||||||||||||||||||||||||
| 858 | sub _fallback_destdir | ||||||||||||||||||||||||||||||||||||||||||
| 859 | { | ||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | catdir( shift->_cpanp_user_basedir, 'pkg' ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fallback_destdir: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 865 | # PACKAGE RELATIONSHIP FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 866 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | #---HELPER FUNCTION-- | ||||||||||||||||||||||||||||||||||||||||||
| 869 | # Merge two version operators, if possible. | ||||||||||||||||||||||||||||||||||||||||||
| 870 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 871 | sub _cmpvops | ||||||||||||||||||||||||||||||||||||||||||
| 872 | { | ||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | my ($op, $x, $y) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmpvops: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | return 0 if ($x eq $y); # specs are identical | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ($x, $y) = (version->new($x), version->new($y)); | |||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | ▶ | if ($op =~ /^</) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | return ($x < $y ? -1 : 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 879 | } elsif ( $op =~ /^>/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | return ($x > $y ? -1 : 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 882 | # We cannot merge specs other than <, <=, >, and >=. | ||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 888 | # Perform very simple comparison of version specs. | ||||||||||||||||||||||||||||||||||||||||||
| 889 | # Returns undef if no merging is possible, | ||||||||||||||||||||||||||||||||||||||||||
| 890 | # 0 if the specs are equal, | ||||||||||||||||||||||||||||||||||||||||||
| 891 | # -1 if the first spec is dominant, | ||||||||||||||||||||||||||||||||||||||||||
| 892 | # or 1 if the second specs is dominant. | ||||||||||||||||||||||||||||||||||||||||||
| 893 | # | ||||||||||||||||||||||||||||||||||||||||||
| 894 | # Checks for undefined versions which indicate a dependency on a module | ||||||||||||||||||||||||||||||||||||||||||
| 895 | # which is not the main module of the distribution. Version specs which define | ||||||||||||||||||||||||||||||||||||||||||
| 896 | # a version replace other specs with identical names, operators, and no version. | ||||||||||||||||||||||||||||||||||||||||||
| 897 | # | ||||||||||||||||||||||||||||||||||||||||||
| 898 | # We use the version module so this only works with perl/CPAN/numerical versions. | ||||||||||||||||||||||||||||||||||||||||||
| 899 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 900 | sub _cmpspecs | ||||||||||||||||||||||||||||||||||||||||||
| 901 | { | ||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | my ($a, $b) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmpspecs: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | my ($x, $y, $z); | |||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | if ($a->[0] ne $b->[0] || $a->[1] ne $b->[1]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$a->[0] ne $b->[0] or $a->[1] ne $b->[1]
MC/DC0%0/2
$a->[0] ne $b->[0] or $a->[1] ne $b->[1]
$a->[0] ne $b->[0]
$a->[1] ne $b->[1]
Truth table0%0/3
A or B
A= $a->[0] ne $b->[0]B= $a->[1] ne $b->[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 906 | # The most common case is that names won't even match. | ||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 908 | ▶ | } elsif (defined ($x = $a->[2]) && defined ($y = $b->[2])) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined($x = $a->[2]) and defined($y = $b->[2])
MC/DC0%0/2
defined($x = $a->[2]) and defined($y = $b->[2])
defined($x = $a->[2])
defined($y = $b->[2])
Truth table0%0/3
A and B
A= defined($x = $a->[2])B= defined($y = $b->[2])
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | return _cmpvops($a->[1], $x, $y); | |||||||||||||||||||||||||||||||||||||||||
| 910 | ▶ | } elsif (!defined $x && defined $y) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not defined $x and defined $y
MC/DC0%0/2
not defined $x and defined $y
not defined $x
defined $y
Truth table0%0/3
not(A) and B
A= not defined $xB= defined $y
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 912 | ▶ | } elsif (defined $x && !defined $y) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $x and not defined $y
MC/DC0%0/2
defined $x and not defined $y
defined $x
not defined $y
Truth table0%0/3
A and not(B)
A= defined $xB= not defined $y
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 915 | # Both specs are identical with undef versions. | ||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 921 | # Normalize perl/CPAN version specifications. (we use numeric version cmp) | ||||||||||||||||||||||||||||||||||||||||||
| 922 | # Each spec is an aref containing a name, operator, and value. | ||||||||||||||||||||||||||||||||||||||||||
| 923 | # Sorts them and remove redundancies such as specs with the same name | ||||||||||||||||||||||||||||||||||||||||||
| 924 | # and operator. | ||||||||||||||||||||||||||||||||||||||||||
| 925 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 926 | sub _normspecs | ||||||||||||||||||||||||||||||||||||||||||
| 927 | { | ||||||||||||||||||||||||||||||||||||||||||
| 928 | 80 | ▶ | my ($a) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normspecs: called CC=5 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 80 | ▶ | return if (@$a == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | 20 | @$a = sort _vspecs @$a; | |||||||||||||||||||||||||||||||||||||||||
| 932 | 20 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 933 | 20 | my $x; | |||||||||||||||||||||||||||||||||||||||||
| 934 | 20 | ▶ | while ($i < $#$a) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | my $x = _cmpspecs($a->[$i], $a->[$i+1]); | |||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | ▶ | if (!defined $x) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 938 | } elsif ($x <= 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | splice @$a, $i+1, 1; | |||||||||||||||||||||||||||||||||||||||||
| 940 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | splice @$a, $i, 1; | |||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||
| 944 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | #---SORTING FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 948 | # Provided for use by the sort builtin, for sorting version specifications. | ||||||||||||||||||||||||||||||||||||||||||
| 949 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 950 | sub _vspecs | ||||||||||||||||||||||||||||||||||||||||||
| 951 | { | ||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | our ($a, $b); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vspecs: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | $a->[0] cmp $b->[0] or $a->[1] cmp $b->[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | sub _yankspecs (&$) | ||||||||||||||||||||||||||||||||||||||||||
| 957 | { | ||||||||||||||||||||||||||||||||||||||||||
| 958 | 60 | ▶ | my ($sub, $a) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_yankspecs: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||
| 959 | 60 | my @b; | |||||||||||||||||||||||||||||||||||||||||
| 960 | 60 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 961 | 60 | local $_; | |||||||||||||||||||||||||||||||||||||||||
| 962 | 60 | ▶ | while ($i <= $#$a) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 963 | 30 | $_ = $a->[$i][0]; | |||||||||||||||||||||||||||||||||||||||||
| 964 | 30 | ▶ | if ($sub->(@{$a->[$i]})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | push @b, splice(@$a, $i, 1); | |||||||||||||||||||||||||||||||||||||||||
| 966 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 967 | 30 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||
| 970 | 60 | return @b; | |||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | sub _yanktestmods | ||||||||||||||||||||||||||||||||||||||||||
| 974 | { | ||||||||||||||||||||||||||||||||||||||||||
| 975 | 10 | ▶ | _yankspecs { /^Test|^Pod::Coverage/ } shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
_yanktestmods: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||
| 978 | sub _yankmakemods | ||||||||||||||||||||||||||||||||||||||||||
| 979 | { | ||||||||||||||||||||||||||||||||||||||||||
| 980 | 10 | ▶ | _yankspecs { /^ExtUtils-/ } shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
_yankmakemods: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | sub _yankcoremods | ||||||||||||||||||||||||||||||||||||||||||
| 984 | { | ||||||||||||||||||||||||||||||||||||||||||
| 985 | _yankspecs { | ||||||||||||||||||||||||||||||||||||||||||
| 986 | 10 | ▶ | my $v = $Module::CoreList::version{0+$]}{$_[0]}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 10 | ▶ | return ($v && (version->new($v) >= version->new($_[2]))); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$v && 'version'->new($v) >= 'version'->new($_[2])
MC/DC0%0/2
$v && 'version'->new($v) >= 'version'->new($_[2])
$v
'version'->new($v) >= 'version'->new($_[2])
Truth table33%1/3
A && B
A= $vB= 'version'->new($v) >= 'version'->new($_[2])
| |||||||||||||||||||||||||||||||||||||||||||
| 988 | 40 | ▶ | } shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_yankcoremods: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||
| 991 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 992 | # Decide if the module is named after the distribution. | ||||||||||||||||||||||||||||||||||||||||||
| 993 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 994 | sub _ismainmod | ||||||||||||||||||||||||||||||||||||||||||
| 995 | { | ||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | ▶ | my ($m, $d) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ismainmod: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | $m =~ tr/:/-/s; | |||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | return (lc $m) eq (lc $d); | |||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | # Converts specifications upon modules into specifications upon distributions. | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | sub _distspecs | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | 40 | ▶ | my ($be, $a) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_distspecs: called CC=6 SCAR=30.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | 40 | for my $i ( 0 .. $#$a ) { | |||||||||||||||||||||||||||||||||||||||||
| 1008 | 10 | my $mod = $a->[$i][0]; | |||||||||||||||||||||||||||||||||||||||||
| 1009 | 10 | ▶ | next if ($mod eq 'perl'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | my ($x, $y); | |||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | if (!($x = $be->module_tree($mod)) || !($y = $x->package_name)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$x = $be->module_tree($mod) and $y = $x->package_name
MC/DC0%0/2
$x = $be->module_tree($mod) and $y = $x->package_name
$x = $be->module_tree($mod)
$y = $x->package_name
Truth table0%0/3
A and B
A= $x = $be->module_tree($mod)B= $y = $x->package_name
| |||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | die "failed to find a CPAN distribution containing: $mod"; | |||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | ▶ | if (!_ismainmod($mod, $y)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | undef $a->[$i][2]; | |||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | $a->[$i][0] = $y; | |||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | # Converts specifications upon distributions into specifications upon packages. | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | sub _pkgspecs | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | 40 | ▶ | my ($a) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pkgspecs: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 40 | for my $i (0 .. $#$a) { | |||||||||||||||||||||||||||||||||||||||||
| 1029 | 10 | $a->[$i][0] = dist_pkgname($a->[$i][0]); | |||||||||||||||||||||||||||||||||||||||||
| 1030 | 10 | my $v = $a->[$i][2]; | |||||||||||||||||||||||||||||||||||||||||
| 1031 | 10 | ▶ | if (!defined $v) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | $v = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | } elsif ($a->[$i][0] eq 'perl') { | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | 10 | $v = _transperlver($v); | |||||||||||||||||||||||||||||||||||||||||
| 1035 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | $v = dist_pkgver($v); | |||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | 10 | $a->[$i][2] = $v; | |||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | # Converts a decimal perl version (like $]) into the dotted decimal | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | # form that the official ArchLinux perl package uses. | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | sub _transperlver | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | 18 | ▶ | my ($perlver) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_transperlver: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | # Fix perl-style vstrings which have a leading "v". | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | 18 | ▶ | return $perlver if ($perlver =~ s/\Av//); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | 17 | ▶ | return $perlver unless ($perlver =~ /\A(\d+)[.](\d{3})(\d{1,3})\z/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||
| 1055 | # Re-apply the missing trailing zeroes. | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | 3 | my $patch = $3; | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 3 | $patch .= q{0} x (3 - length($patch)); | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 3 | return sprintf '%d.%d.%d', $1, $2, $patch; | |||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||
| 1061 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | # Translate a single CPAN dependency version specification. | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | sub _scanvspec | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | my ($vspec) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scanvspec: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | ## The module author forgot to specify a version in the (one) dependency. | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | ▶ | return 0 if (!defined $vspec); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | ## The simplest case is a version string. | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | return $vspec if ($vspec =~ /^[0-9a-zA-Z._-]+$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||
| 1073 | ## Combinations of complicated version specifications are also possible. | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | my @specs; | |||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | for my $opver (split /\s*,\s*/, $vspec) { | |||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | ▶ | if ($opver !~ /^([<>]=?|[!=]=) +([0-9a-zA-Z._-]+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | die "invalid META version spec: $vspec" | |||||||||||||||||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | my ($op, $ver) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | push @specs, [ $op, $ver ]; | |||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | if (@specs == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1084 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | return \@specs; | |||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | sub _scanvspecs | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | my ($specs, $deps, $cons) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scanvspecs: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | ▶ | while (my ($k, $v) = each %$specs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | my $vs = _scanvspec($v); # $vs is either a version string or an array-ref. | |||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | unless (ref $vs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | push @$deps, [ $k, '>=', $vs ]; | |||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1097 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | for my $x (@$vs) { | |||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | my ($op, $ver) = @$x; | |||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | ▶ | if ($op eq '!=') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1101 | ## When $cons is elided, that means we are scanning conflict version specs. | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | ## The '!=' spec specifies a conflict. What is a conflict of a conflict? | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | ▶ | unless (defined $cons) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | die qq{unable to process "$k != $ver" in a conficts list}; | |||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | push @$cons, [ $k, '=', $ver ]; | |||||||||||||||||||||||||||||||||||||||||
| 1107 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | push @$deps, [ $k, $op, $ver ]; | |||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||
| 1115 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | sub _scanstage | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | ▶ | my ($s, $r, $c) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scanstage: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | _scanvspecs($s->{'requires'}, $r, $c); | |||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | _scanvspecs($s->{'conflicts'}, $c, undef); | |||||||||||||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||
| 1123 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | # Clean up deps for the sake of humans. | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | sub _pruneperldep | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | 30 | ▶ | my ($d) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pruneperldep: called CC=3 SCAR=15.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 30 | ▶ | if ((grep { $_->[0] =~ /^perl/ } @$d) > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1130 | # Remove a redundant dependency on perl itself if a perl- package is | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | # depended on. | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | @$d = grep { $_->[0] ne 'perl' || $_->[2] } @$d; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||
| 1136 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | # Remove duplicate dependencies. If a package verspec is in depends, then the identical | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | # verspec does not need to be in makedepends or checkdepends. | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | # Given A and B, remove any duplicates from the array B. | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | sub _prunedups | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | 20 | ▶ | my ($a, $b) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prunedups: called CC=4 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1145 | 20 | for my $x (@$a) { | |||||||||||||||||||||||||||||||||||||||||
| 1146 | 20 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1147 | 20 | ▶ | while ($i <= $#$b) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1148 | # remember that _cmpspecs may be undef | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | if (eval { _cmpspecs($x, $b->[$i]) == 0 }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | splice @$b, $i, 1; | |||||||||||||||||||||||||||||||||||||||||
| 1151 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 1153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||
| 1159 | #---PRIVATE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | # Purpose : Converts our CPAN requirements and conflicts into PKGBUILD | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | # checkdepends, makedepends, depends, and conflicts | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | # Returns : A hashref of package relations. | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | # Top level keys are 'makedepends', 'depends', and 'conflicts'. | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | # The values of these keys are arrayrefs. Every three elements | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | # specify a package name, operator (e.g. <=, =, etc) and version. | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | sub _get_pkg_rels | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | 10 | ▶ | croak 'Invalid arguments to _get_pkg_rels method' if (@_ != 1); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_pkg_rels: called CC=11 SCAR=26.3
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1170 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | 10 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 1173 | 10 | my (@deps, @mkdeps, @chdeps, @cons); | |||||||||||||||||||||||||||||||||||||||||
| 1174 | 10 | ▶ | if (defined $self->status->metareqs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | my $r = $self->status->metareqs; | |||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | _scanstage($r->{'configure'}, \@mkdeps, \@cons); | |||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | _scanstage($r->{'build'}, \@mkdeps, \@cons); | |||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | _scanstage($r->{'test'}, \@chdeps, \@cons); | |||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | _scanstage($r->{'runtime'}, \@deps, \@cons); | |||||||||||||||||||||||||||||||||||||||||
| 1180 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | 10 | my $reqs = $module->status->prereqs; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | 10 | ▶ | while (my ($k, $v) = each %$reqs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1183 | 10 | push @deps, [ $k, '>=', $v ]; | |||||||||||||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | 10 | my $d = $module->package_name; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 10 | ▶ | unless ($d =~ /^ExtUtils-/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1187 | 10 | @mkdeps = _yankmakemods(\@deps); | |||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | 10 | ▶ | unless ($d =~ /^Test-/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1190 | 10 | @chdeps = _yanktestmods(\@deps); | |||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||
| 1194 | 10 | my $be = $module->parent; # $module->parent is a CPANPLUS::Backend | |||||||||||||||||||||||||||||||||||||||||
| 1195 | 10 | for my $a (\@deps, \@mkdeps, \@chdeps, \@cons) { | |||||||||||||||||||||||||||||||||||||||||
| 1196 | 40 | _yankcoremods($a); | |||||||||||||||||||||||||||||||||||||||||
| 1197 | 40 | _normspecs($a); | |||||||||||||||||||||||||||||||||||||||||
| 1198 | 40 | _distspecs($be, $a); # specs are now on dist. names | |||||||||||||||||||||||||||||||||||||||||
| 1199 | 40 | _normspecs($a); | |||||||||||||||||||||||||||||||||||||||||
| 1200 | 40 | _pkgspecs($a); # specs are now on package names | |||||||||||||||||||||||||||||||||||||||||
| 1201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | # Merge in the XS package deps if they exist. | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | 10 | my $xsdeps = $self->_transxsdeps(); | |||||||||||||||||||||||||||||||||||||||||
| 1205 | 10 | ▶ | if (@$xsdeps) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | push @deps, @$xsdeps; | |||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | @deps = sort _vspecs @deps; | |||||||||||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 10 | _pruneperldep($_) for (\@deps, \@mkdeps, \@chdeps); | |||||||||||||||||||||||||||||||||||||||||
| 1211 | 10 | ▶ | if (!grep { $_->[0] =~ /^perl/ } @deps) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1212 | # Require perl unless we have a dependency on a module or perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | unshift @deps, [ 'perl', '>=', '0' ]; | |||||||||||||||||||||||||||||||||||||||||
| 1214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1215 | 10 | _prunedups(\@deps, $_) for (\@mkdeps, \@chdeps); | |||||||||||||||||||||||||||||||||||||||||
| 1216 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | 10 | 'depends' => \@deps, | |||||||||||||||||||||||||||||||||||||||||
| 1218 | 'makedepends' => \@mkdeps, | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | 'checkdepends' => \@chdeps, | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | 'conflicts' => \@cons, | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1226 | # XS module library dependency hunting | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | # Purpose : Attempts to find non-perl dependencies in XS modules. | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | # Returns : A hashref of 'package name' => 'minimum version'. | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | # (Minimum version will be the current installed version | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | # of the library) | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | sub _transxsdeps | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_transxsdeps: called CC=2 SCAR=7.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | 10 | my $modstat = $self->parent->status; | |||||||||||||||||||||||||||||||||||||||||
| 1240 | 10 | my $inst_type = $modstat->installer_type; | |||||||||||||||||||||||||||||||||||||||||
| 1241 | 10 | my $distcpan = $modstat->dist_cpan; | |||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | # Delegate to the other methods depending on the dist type... | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | 10 | ▶ | my $libs_ref = ( $inst_type eq 'CPANPLUS::Dist::MM' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1245 | ? $self->_get_mm_xs_deps($distcpan) : [] ); | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | # TODO: figure out how to do this with Module::Build | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | # Turn the linker flags into package deps... | ||||||||||||||||||||||||||||||||||||||||||
| 1249 | return [ map { | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | 10 | my ($pkg, $ver) = $self->_get_lib_pkg($_); | |||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | [ $pkg, '>=', $ver ] | |||||||||||||||||||||||||||||||||||||||||
| 1252 | } @$libs_ref ]; | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | # Usage : %pkg = $self->_get_lib_pkg($lib) | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | # Params : $lib - Can be a dynamic library name, with/without lib prefix | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | # or the -l<name> flag that is passed to the linker. | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | # (anything DynaLoader::dl_findfile accepts) | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | # Returns : A hash (or two element list) of: | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | # 'package name' => 'installed version' | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | # or an empty list if the lib/package owner could not be found. | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | sub _get_lib_pkg | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | ▶ | my ($self, $libname) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_lib_pkg: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | ▶ | my $lib_fqp = DynaLoader::dl_findfile($libname) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1269 | or return (); | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | $lib_fqp =~ s/([\\\$"`])/\\$1/g; | |||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | my $result = `LC_ALL=C pacman -Qo "$lib_fqp"`; | |||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | chomp $result; | |||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | ▶ | if ( $CHILD_ERROR != 0 || !($result =~ s/$PACMAN_FINDOWN//) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$CPANPLUS::Dist::Arch::CHILD_ERROR != 0 or not $result =~ s/$PACMAN_FINDOWN//
MC/DC0%0/2
$CPANPLUS::Dist::Arch::CHILD_ERROR != 0 or not $result =~ s/$PACMAN_FINDOWN//
$CPANPLUS::Dist::Arch::CHILD_ERROR != 0
not $result =~ s/$PACMAN_FINDOWN//
Truth table0%0/3
A or not(B)
A= $CPANPLUS::Dist::Arch::CHILD_ERROR != 0B= not $result =~ s/$PACMAN_FINDOWN//
| |||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | if ( $CHILD_ERROR == 127 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | error q{C-library dep lookup failed. Pacman is missing!?}; | |||||||||||||||||||||||||||||||||||||||||
| 1277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | error qq{Could not find owner of linked library } | |||||||||||||||||||||||||||||||||||||||||
| 1280 | . qq{"$libname", ignoring.}; | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 1283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | my ($pkgname, $pkgver) = split / /, $result; | |||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | $pkgver =~ s/-\d+\z//; # remove the package revision number | |||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | return ($pkgname, $pkgver); | |||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | sub _unique(@) | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | ▶ | my %seen; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unique: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | ▶ | return map { $seen{$_}++ ? () : $_ } @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | # Usage : my $deps_ref = $self->_get_mm_xs_deps($dist_obj); | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | # Params : $dist_obj - A CPANPLUS::Dist::MM object | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | # Returns : Arrayref of library flags (-l...) passed to the linker on build. | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | sub _get_mm_xs_deps | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | ▶ | my ($self, $dist) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_mm_xs_deps: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | my $field_srch = '\A(?:EXTRALIBS|LDLOADLIBS|BSLOADLIBS) = (.+)\z'; | |||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | 0 | ▶ | my $mkfile_fqp = $dist->status->makefile | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1308 | or die "Internal error: makefile() path is unset in our object"; | ||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | ▶ | open my $mkfile, '<', $mkfile_fqp | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1311 | or die "Internal error: failed to open Makefile at $mkfile_fqp ... $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | my @libs = _unique map { chomp; (/$field_srch/o) } <$mkfile>; | |||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | close $mkfile; | |||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | 0 | return [ grep { /\A-l/ } map { split } @libs ]; | |||||||||||||||||||||||||||||||||||||||||
| 1316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||
| 1318 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | sub _find_xs_files | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | 0 | ▶ | my ($dirpath) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_xs_files: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | ▶ | return -f "$dirpath/typemap" || scalar glob "$dirpath/*.xs"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
-f "$dirpath/typemap" || scalar glob("$dirpath/*.xs")
MC/DC0%0/1
-f "$dirpath/typemap" || scalar glob("$dirpath/*.xs")
-f "$dirpath/typemap"
Truth table0%0/2
A
A= -f "$dirpath/typemap"
| |||||||||||||||||||||||||||||||||||||||||||
| 1323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||
| 1326 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | # CPAN Distribution Scraping | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | sub _pod_pkgdesc | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | ▶ | my ($mod_obj) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pod_pkgdesc: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | my $podselect = Pod::Select->new; | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | my $modname = $mod_obj->name; | |||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | $podselect->select('NAME'); | |||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||
| 1339 | =for POD Search | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | We use the package name because there is usually a module file | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | with the exact same name as the package file. | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | We want the main module's description, just in case the user requested | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | a lesser module in the same package file. | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | Assume the main .pm or .pod file is under lib/Module/Name/Here.pm | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | my $mainmod_path = $mod_obj->package_name; | |||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | $mainmod_path =~ tr{-}{/}s; | |||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | my $mainmod_file = $mainmod_path; | |||||||||||||||||||||||||||||||||||||||||
| 1354 | 0 | $mainmod_file =~ s{\A.*/}{}; | |||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | $mainmod_path =~ s{/$mainmod_file}{}; | |||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | my $base_path = $mod_obj->status->extract; | |||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | # First check under lib/ for a "properly" pathed module, with | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | # nested directories. Then search desperately for a .pm file that | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | # matches the module's last name component. | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | my @possible_pods = ( glob "$base_path/{lib/,}{$mainmod_path/,}" | |||||||||||||||||||||||||||||||||||||||||
| 1364 | . "$mainmod_file.{pod,pm}" ); | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||||||||||
| 1366 | PODSEARCH: | ||||||||||||||||||||||||||||||||||||||||||
| 1367 | 0 | for my $podfile_path ( @possible_pods ) { | |||||||||||||||||||||||||||||||||||||||||
| 1368 | 0 | ▶ | next PODSEARCH unless ( -e $podfile_path ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||
| 1370 | 0 | _DEBUG "Searching the POD inside $podfile_path for pkgdesc..."; | |||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | my $name_section = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | ▶ | open my $podfile, '<', $podfile_path | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1375 | or next PODSEARCH; | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | 0 | ▶ | open my $podout, '>', \$name_section | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1378 | or die "failed open on filehandle to string: $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | $podselect->parse_from_filehandle( $podfile, $podout ); | |||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | close $podfile; | |||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | ▶ | close $podout or die "failed close on filehandle to string: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | 0 | ▶ | next PODSEARCH unless ( $name_section ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||
| 1386 | # Remove formatting codes. | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | 0 | $name_section =~ s{ [IBCLEFSXZ] <(.*?)> }{$1}gxms; | |||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | $name_section =~ s{ [IBCLEFSXZ] <<(.*?)>> }{$1}gxms; | |||||||||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||||||||||
| 1390 | # The short desc is on a line beginning with 'Module::Name - ' | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | ▶ | if ( $name_section =~ / ^ \s* $modname [ -]+ ([^\n]+) /xms ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1392 | 0 | _DEBUG qq{Found pkgdesc "$1" in POD}; | |||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 1394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||
| 1397 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||
| 1400 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | sub _readme_pkgdesc | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | 0 | ▶ | my ($mod_obj) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_readme_pkgdesc: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1404 | 0 | my $mod_name = $mod_obj->name; | |||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | ▶ | open my $readme, '<', catfile( $mod_obj->status->extract, 'README' ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1407 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||||||||||||
| 1409 | LINE: | ||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | ▶ | while ( <$readme> ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||
| 1413 | # limit ourselves to a NAME section | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | next LINE unless ( ( /^NAME/ ... /^[A-Z]+/ ) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
/^NAME/ ... /^[A-Z]+/ and / ^ \s* $mod_name [\s\-]+ (.+) $ /mosx
MC/DC0%0/2
/^NAME/ ... /^[A-Z]+/ and / ^ \s* $mod_name [\s\-]+ (.+) $ /mosx
/^NAME/ ... /^[A-Z]+/
/ ^ \s* $mod_name [\s\-]+ (.+) $ /mosx
Truth table0%0/3
A and B
A= /^NAME/ ... /^[A-Z]+/B= / ^ \s* $mod_name [\s\-]+ (.+) $ /mosx
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | / ^ \s* ${mod_name} [\s\-]+ (.+) $ /oxms ); | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | _DEBUG qq{Found pkgdesc "$1" in README}; | |||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 1419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||
| 1421 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | #---PRIVATE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | # Try to find out if this distribution has any XS files. | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | # If it does, then the arch PKGBUILD field should be ('i686', 'x86_64'). | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | # If it doesn't, then the arch field should be ('any'). | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | sub _prepare_arch | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_arch: called CC=9 SCAR=38.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | 5 | my $dist_cpan = $self->parent->status->dist_cpan; | |||||||||||||||||||||||||||||||||||||||||
| 1433 | 5 | my $dist_dir = $dist_cpan->status->distdir; | |||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||
| 1435 | 5 | ▶ | unless ( $dist_dir && -d $dist_dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dist_dir and -d $dist_dir
MC/DC0%0/2
$dist_dir and -d $dist_dir
$dist_dir
-d $dist_dir
Truth table33%1/3
A and B
A= $dist_dirB= -d $dist_dir
| |||||||||||||||||||||||||||||||||||||||||||
| 1436 | 5 | return $self->status->arch( q{'any'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | # Only search the top distribution directory and then go | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | # one directory-level deep. .xs files are usually at the top | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | # or in a subdir. Don't use File::Find, that could be really slow. | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | my $found_xs; | |||||||||||||||||||||||||||||||||||||||||
| 1444 | 0 | ▶ | if ( _find_xs_files( $dist_dir )) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1445 | 0 | $found_xs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | ▶ | opendir my $basedir, $dist_dir or die "opendir: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | ▶ | my @childdirs = grep { !/^./ && -d $_ } readdir $basedir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | DIR_LOOP: | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | 0 | for my $childdir ( @childdirs ) { | |||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | ▶ | next DIR_LOOP unless _find_xs_files( $childdir ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | $found_xs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | last DIR_LOOP; | |||||||||||||||||||||||||||||||||||||||||
| 1456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||
| 1458 | 0 | closedir $basedir; | |||||||||||||||||||||||||||||||||||||||||
| 1459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||||||||||||||||
| 1461 | 0 | ▶ | return $self->status->arch( $found_xs | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1462 | ? q{'i686' 'x86_64'} : q{'any'} ); | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||
| 1465 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | # Usage : $pkgdesc = $self->_prepare_pkgdesc(); | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | # Purpose : Tries to find a module's "abstract" short description for | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | # use as a package description. | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | # Postcond : Sets the $self->status->pkgdesc accessor to the found | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | # package description. | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | # Returns : The package short description. | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | # Comments : We search through the META.yml file, the main module's .pm file, | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | # .pod file, and then the README file. | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | sub _prepare_pkgdesc | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | 5 | ▶ | croak 'Invalid arguments to _prepare_pkgdesc method' if @_ != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_pkgdesc: called CC=5 SCAR=16.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||
| 1479 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1480 | 5 | my ($status, $module, $pkgdesc) = ($self->status, $self->parent); | |||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||
| 1482 | my @pkgdesc_srcs = | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | # 1. We checked the META.yml earlier in the _scanmeta method. | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | # 2. Registered modules have their description stored in the object. | ||||||||||||||||||||||||||||||||||||||||||
| 1487 | 5 | ▶ | sub { $module->description }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | # 3. Parse the source file or pod file for a NAME section. | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | 5 | \&_pod_pkgdesc, | |||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||
| 1492 | # 4. Try to find it in in the README file. | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | \&_readme_pkgdesc, | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | PKGDESC_LOOP: | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | 5 | for my $pkgdesc_src ( @pkgdesc_srcs ) { | |||||||||||||||||||||||||||||||||||||||||
| 1499 | 5 | ▶ | $pkgdesc = $pkgdesc_src->( $module ) and last PKGDESC_LOOP; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||||||||||||||||
| 1502 | 5 | ▶ | if ( $pkgdesc ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1503 | # Avoid CR chars because of CRLF line endings in sources. | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | 5 | $pkgdesc =~ tr/\r//d; | |||||||||||||||||||||||||||||||||||||||||
| 1505 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | $pkgdesc = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 1507 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | 5 | $status->pkgdesc( $pkgdesc ); | |||||||||||||||||||||||||||||||||||||||||
| 1509 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | |||||||||||||||||||||||||||||||||||||||||||
| 1512 | #---------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | # META Spec File Functions | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | #---------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | sub _metapath | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | 5 | ▶ | my ($mod) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_metapath: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1519 | 5 | my $metapath; | |||||||||||||||||||||||||||||||||||||||||
| 1520 | 5 | for my $ext (qw/json yml/) { | |||||||||||||||||||||||||||||||||||||||||
| 1521 | 10 | my $p = catfile($mod->status->extract, "META.$ext"); | |||||||||||||||||||||||||||||||||||||||||
| 1522 | 10 | ▶ | if (-f $p) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | $metapath = $p; | |||||||||||||||||||||||||||||||||||||||||
| 1524 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 1525 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | 5 | return $metapath; | |||||||||||||||||||||||||||||||||||||||||
| 1528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | # Smooth over differences between incompatible META specs. | ||||||||||||||||||||||||||||||||||||||||||
| 1531 | sub _metareqs | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | ▶ | my ($meta) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_metareqs: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | my $r; | |||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | ▶ | if (defined $meta->{'meta-spec'} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $meta->{"meta-spec"} and $meta->{"meta-spec"}{"url"} =~ /cpan[.]org/
MC/DC0%0/2
defined $meta->{"meta-spec"} and $meta->{"meta-spec"}{"url"} =~ /cpan[.]org/
defined $meta->{"meta-spec"}
$meta->{"meta-spec"}{"url"} =~ /cpan[.]org/
Truth table0%0/3
A and B
A= defined $meta->{"meta-spec"}B= $meta->{"meta-spec"}{"url"} =~ /cpan[.]org/
| |||||||||||||||||||||||||||||||||||||||||||
| 1536 | $meta->{'meta-spec'}{'url'} =~ /cpan[.]org/) { | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | 0 | $r = $meta->{'prereqs'}; | |||||||||||||||||||||||||||||||||||||||||
| 1538 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | 0 | for (qw/configure build/) { | |||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | $r->{$_}{'requires'} = $meta->{"${_}_requires"}; | |||||||||||||||||||||||||||||||||||||||||
| 1541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | 0 | $r->{'runtime'}{'requires'} = $meta->{'requires'}; | |||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | $r->{'build'}{'conflicts'} = $meta->{'conflicts'}; | |||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | # When upgrading, try to detect testing requirements. | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | ▶ | if ($meta->{'name'} !~ /^Test-/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1547 | 0 | for my $m (keys %{$r->{'build'}{'requires'}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1548 | 0 | ▶ | if ($m =~ /^Test::/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | $r->{'test'}{'requires'}{$m} = delete $r->{'build'}{'requires'}{$m}; | |||||||||||||||||||||||||||||||||||||||||
| 1550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||
| 1555 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||
| 1557 | sub _metadesc | ||||||||||||||||||||||||||||||||||||||||||
| 1558 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | my ($meta) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_metadesc: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | ▶ | my $d = $meta->{'abstract'} or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||||||||||||||||
| 1562 | # META.yml abstract entries we should ignore. | ||||||||||||||||||||||||||||||||||||||||||
| 1563 | 0 | my @bad = ( q{~}, 'Module abstract (<= 44 characters) goes here' ); | |||||||||||||||||||||||||||||||||||||||||
| 1564 | 0 | for my $b ( @bad ) { | |||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | ▶ | return if ( $d eq $b ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | return $d; | |||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||
| 1569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||
| 1571 | #--- PRIVATE METHOD --- | ||||||||||||||||||||||||||||||||||||||||||
| 1572 | # We read the META.json or META.yml file with Parse::CPAN::META and extract | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | # data needed for makedepends and pkgdesc if we can. | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | #---------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | sub _scanmeta | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scanmeta: called CC=3 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1578 | 5 | my ($status, $modobj) = ($self->status, $self->parent); | |||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | # Leave metareqs undef if there is no META.yml/META.json. | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | 5 | ▶ | my $path = _metapath($modobj) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my $meta = eval { Parse::CPAN::Meta::LoadFile($path) }; | |||||||||||||||||||||||||||||||||||||||||
| 1583 | 0 | ▶ | return unless ($meta); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||
| 1585 | 0 | my $reqs = _metareqs($meta); | |||||||||||||||||||||||||||||||||||||||||
| 1586 | 0 | my $desc = _metadesc($meta); | |||||||||||||||||||||||||||||||||||||||||
| 1587 | 0 | $status->metareqs($reqs); | |||||||||||||||||||||||||||||||||||||||||
| 1588 | 0 | $status->pkgdesc($desc); | |||||||||||||||||||||||||||||||||||||||||
| 1589 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||
| 1592 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | # Usage : $self->_prepare_status() | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | # Purpose : Prepares all the package-specific accessors in our $self->status | ||||||||||||||||||||||||||||||||||||||||||
| 1595 | # accessor object (of the class Object::Accessor). | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | # Postcond : Accessors assigned to: pkgname pkgver pkgbase arch destdir | ||||||||||||||||||||||||||||||||||||||||||
| 1597 | # Returns : The object's status accessor. | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | sub _prepare_status | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | 5 | ▶ | croak 'Invalid arguments to _prepare_status method' if @_ != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_status: called CC=5 SCAR=16.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1604 | 5 | my $status = $self->status; # Private hash | |||||||||||||||||||||||||||||||||||||||||
| 1605 | 5 | my $module = $self->parent; # CPANPLUS::Module | |||||||||||||||||||||||||||||||||||||||||
| 1606 | 5 | my $conf = $module->parent->configure_object; | |||||||||||||||||||||||||||||||||||||||||
| 1607 | |||||||||||||||||||||||||||||||||||||||||||
| 1608 | 5 | my ($pkgver, $pkgname) | |||||||||||||||||||||||||||||||||||||||||
| 1609 | = ( dist_pkgver( $module->package_version ), | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | dist_pkgname( $module->package_name)); | ||||||||||||||||||||||||||||||||||||||||||
| 1611 | |||||||||||||||||||||||||||||||||||||||||||
| 1612 | 5 | my $pkgbase = catdir( $self->_cpanp_user_basedir, | |||||||||||||||||||||||||||||||||||||||||
| 1613 | 'build', "$pkgname-$pkgver" ); | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||
| 1615 | 5 | foreach ( $pkgname, $pkgver, $pkgbase ) { | |||||||||||||||||||||||||||||||||||||||||
| 1616 | 15 | ▶ | die "A package variable is invalid" unless defined; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1617 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||
| 1619 | 5 | $status->pkgname( $pkgname ); | |||||||||||||||||||||||||||||||||||||||||
| 1620 | 5 | $status->pkgver ( $pkgver ); | |||||||||||||||||||||||||||||||||||||||||
| 1621 | 5 | $status->pkgbase( $pkgbase ); | |||||||||||||||||||||||||||||||||||||||||
| 1622 | 5 | $status->pkgrel ( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||
| 1624 | 5 | $status->tt_init_args( {} ); | |||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||
| 1626 | 5 | $self->_prepare_arch(); | |||||||||||||||||||||||||||||||||||||||||
| 1627 | 5 | $self->_scanmeta(); | |||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||
| 1629 | # _scanmeta() might find a pkgdesc for us | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | 5 | ▶ | $self->_prepare_pkgdesc() unless $status->pkgdesc(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||
| 1632 | 5 | return $status; | |||||||||||||||||||||||||||||||||||||||||
| 1633 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||
| 1635 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | # Usage : my $pkgurl = $self->_get_disturl() | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | # Purpose : Creates a nice, version agnostic homepage URL for the | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | # distribution. | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | # Returns : URL to the distribution's web page on CPAN. | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | sub _get_disturl | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | 10 | ▶ | croak 'Invalid arguments to _get_disturl method' if @_ != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_disturl: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1644 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1645 | 10 | my $dist = $self->parent->package_name; | |||||||||||||||||||||||||||||||||||||||||
| 1646 | 10 | return "https://metacpan.org/release/$dist"; | |||||||||||||||||||||||||||||||||||||||||
| 1647 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||
| 1649 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | # Usage : my $srcurl = $self->_get_srcurl() | ||||||||||||||||||||||||||||||||||||||||||
| 1651 | # Purpose : Generates the standard cpan download link for the source tarball. | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | # Returns : URL to the distribution's tarball on CPAN. | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | sub _get_srcurl | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | 10 | ▶ | croak 'Invalid arguments to _get_srcurl method' if @_ != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_srcurl: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1657 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1658 | 10 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 1659 | |||||||||||||||||||||||||||||||||||||||||||
| 1660 | 10 | return join '/', $CPANURL, 'CPAN', $module->path, $module->package; | |||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||
| 1663 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | # Usage : my $md5hex = $self->calc_tarballmd5() | ||||||||||||||||||||||||||||||||||||||||||
| 1665 | # Purpose : Returns the hex md5 string for the source (dist) tarball | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | # of the module. | ||||||||||||||||||||||||||||||||||||||||||
| 1667 | # Throws : failed to get md5 of <filename>: ... | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | # Returns : The MD5 sum of the .tar.gz file in hex string form. | ||||||||||||||||||||||||||||||||||||||||||
| 1669 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | sub _calc_tarballmd5 | ||||||||||||||||||||||||||||||||||||||||||
| 1671 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calc_tarballmd5: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | my $tarball_fqp = $module->_status->fetch; | |||||||||||||||||||||||||||||||||||||||||
| 1676 | 0 | ▶ | open my $distfile, '<', $tarball_fqp | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1677 | or die "failed to get md5 of $tarball_fqp: $OS_ERROR"; | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | binmode $distfile; | |||||||||||||||||||||||||||||||||||||||||
| 1679 | |||||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | my $md5 = Digest::MD5->new; | |||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | $md5->addfile($distfile); | |||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | close $distfile; | |||||||||||||||||||||||||||||||||||||||||
| 1683 | |||||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | return $md5->hexdigest; | |||||||||||||||||||||||||||||||||||||||||
| 1685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | # Usage : my $shasum = $self->calc_shasum(512); | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | # Params : The bitsizes to use for the SHA digest calculated. | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | # Throws : failed to get sha<size>sum of <tarball>:\n... | ||||||||||||||||||||||||||||||||||||||||||
| 1691 | # Returns : Hex-string checksum of the tarball for the bit size | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | # provided as a parameter. | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | sub _calc_shasum | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calc_shasum: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | my $module = $self->parent; | |||||||||||||||||||||||||||||||||||||||||
| 1698 | 0 | my $fqp = $module->_status->fetch; | |||||||||||||||||||||||||||||||||||||||||
| 1699 | 0 | my $sum = eval { | |||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | Digest::SHA->new( $size )->addfile( $fqp, q{b} )->hexdigest; | |||||||||||||||||||||||||||||||||||||||||
| 1701 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | ▶ | return $sum if $sum; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1703 | 0 | die "failed to get sha${size}sum of $fqp:\n$EVAL_ERROR"; | |||||||||||||||||||||||||||||||||||||||||
| 1704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | |||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | # Purpose : Split the text into everything before the tags, inside tags, and | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | # after the tags. Inner nested tags are skipped. | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | sub _extract_nested | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | 4 | ▶ | croak 'Invalid arguments to _extract_nested' unless ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_extract_nested: called CC=6 SCAR=18.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||
| 1715 | 4 | my ($text, $begin_match, $end_match) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | 4 | my ($before_end, $middle_start, $middle_end, $after_start); | |||||||||||||||||||||||||||||||||||||||||
| 1718 | 4 | ▶ | croak qq{could not find beginning match "$begin_match"} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1719 | unless ( $text =~ /$begin_match/ ); | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||
| 1721 | 4 | $before_end = $LAST_MATCH_START[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1722 | 4 | $middle_start = $LAST_MATCH_END [0]; | |||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | 4 | my $search_pos = $middle_start; | |||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||
| 1726 | END_SEARCH: | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | 4 | pos $text = $search_pos; | |||||||||||||||||||||||||||||||||||||||||
| 1729 | 4 | ▶ | croak sprintf <<'END_ERR', substr $text, $search_pos, 30 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1730 | could not find ending match starting at: | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | %s... | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | END_ERR | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | unless ( $text =~ /$end_match/go ); | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||
| 1735 | 4 | $middle_end = $LAST_MATCH_START[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1736 | 4 | $after_start = $LAST_MATCH_END[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1737 | |||||||||||||||||||||||||||||||||||||||||||
| 1738 | 4 | pos $text = $search_pos; | |||||||||||||||||||||||||||||||||||||||||
| 1739 | 4 | ▶ | if ( $text =~ /$begin_match/go && pos($text) < $after_start ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$text =~ /$begin_match/go and pos $text < $after_start
MC/DC0%0/2
$text =~ /$begin_match/go and pos $text < $after_start
$text =~ /$begin_match/go
pos $text < $after_start
Truth table33%1/3
A and B
A= $text =~ /$begin_match/goB= pos $text < $after_start
| |||||||||||||||||||||||||||||||||||||||||||
| 1740 | 0 | $search_pos = $after_start; | |||||||||||||||||||||||||||||||||||||||||
| 1741 | 0 | redo END_SEARCH; | |||||||||||||||||||||||||||||||||||||||||
| 1742 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1743 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||||||||||||||||
| 1745 | 4 | my $before = substr $text, 0, $before_end; | |||||||||||||||||||||||||||||||||||||||||
| 1746 | 4 | my $middle = substr $text, $middle_start, $middle_end-$middle_start; | |||||||||||||||||||||||||||||||||||||||||
| 1747 | 4 | my $after = substr $text, $after_start; | |||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | 4 | return ($before, $middle, $after); | |||||||||||||||||||||||||||||||||||||||||
| 1750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||||||||||||||||
| 1752 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1753 | # Purpose : Removes IF blocks whose variables are not true. | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | # Params : $templ - The template as a string. | ||||||||||||||||||||||||||||||||||||||||||
| 1755 | # $templ_vars - A hashref to template variables. | ||||||||||||||||||||||||||||||||||||||||||
| 1756 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | sub _prune_if_blocks | ||||||||||||||||||||||||||||||||||||||||||
| 1758 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | 9 | ▶ | my ($templ, $templ_vars) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prune_if_blocks: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1760 | |||||||||||||||||||||||||||||||||||||||||||
| 1761 | 9 | ▶ | while (my ($varname) = $templ =~ $TT_IF_MATCH) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1762 | 4 | ▶ | croak "Invalid template given.\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1763 | . 'Must provide a variable name in an IF block' unless $varname; | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | |||||||||||||||||||||||||||||||||||||||||||
| 1765 | 4 | my @chunks = _extract_nested($templ, $TT_IF_MATCH, $TT_END_MATCH); | |||||||||||||||||||||||||||||||||||||||||
| 1766 | 4 | ▶ | unless ($templ_vars->{$varname}) { splice @chunks, 1, 1; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1767 | 4 | $templ = join q{}, @chunks; | |||||||||||||||||||||||||||||||||||||||||
| 1768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | 9 | return $templ; | |||||||||||||||||||||||||||||||||||||||||
| 1771 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | #---HELPER FUNCTION--- | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | # Purpose : Load a template module and store its name for later use. | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | # Postcond : Stores the template name into $TT_MOD_NAME. | ||||||||||||||||||||||||||||||||||||||||||
| 1776 | # Returns : Nothing. | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1778 | sub _load_tt_module | ||||||||||||||||||||||||||||||||||||||||||
| 1779 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1780 | 1 | ▶ | _DEBUG "Searching for template modules..."; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_tt_module: called CC=3 SCAR=12.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1781 | TT_SEARCH: | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | 1 | for my $ttmod ( @TT_MOD_SEARCH ) { | |||||||||||||||||||||||||||||||||||||||||
| 1783 | 3 | ▶ | eval "require $ttmod; 1;" or next TT_SEARCH; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1784 | 0 | _DEBUG "Loaded template module: $ttmod"; | |||||||||||||||||||||||||||||||||||||||||
| 1785 | 0 | $TT_MOD_NAME = $ttmod; | |||||||||||||||||||||||||||||||||||||||||
| 1786 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||
| 1789 | 1 | _DEBUG "None found!"; | |||||||||||||||||||||||||||||||||||||||||
| 1790 | 1 | $TT_MOD_NAME = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1791 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | #---HELPER METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | # Purpose : Create our template module object and process our template text. | ||||||||||||||||||||||||||||||||||||||||||
| 1796 | # Params : $templ - A string of template text. | ||||||||||||||||||||||||||||||||||||||||||
| 1797 | # $templ_vars - A hashref of template variable names and their | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | # values. | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | # Returns : The template module's processed text. | ||||||||||||||||||||||||||||||||||||||||||
| 1800 | #------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | sub _tt_process | ||||||||||||||||||||||||||||||||||||||||||
| 1802 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | 1 | ▶ | my ($self, $templ, $templ_vars) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tt_process: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||||||||||||||||
| 1805 | 1 | ▶ | confess 'Internal Error: $TT_MOD_NAME not set' unless $TT_MOD_NAME; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1806 | |||||||||||||||||||||||||||||||||||||||||||
| 1807 | 1 | _DEBUG "Processing template using $TT_MOD_NAME"; | |||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||
| 1809 | 1 | my ($tt_obj, $tt_output, $tt_init_args); | |||||||||||||||||||||||||||||||||||||||||
| 1810 | 1 | $tt_init_args = $self->status->tt_init_args(); | |||||||||||||||||||||||||||||||||||||||||
| 1811 | 1 | $tt_output = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 1812 | 1 | ▶ | $tt_obj = $TT_MOD_NAME->new( $TT_MOD_NAME eq 'Template' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1813 | ? $tt_init_args : %$tt_init_args ); | ||||||||||||||||||||||||||||||||||||||||||
| 1814 | # TT takes a hashref, others take the hash | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | 1 | $tt_obj->process( \$templ, $templ_vars, \$tt_output ); | |||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||
| 1818 | croak "$TT_MOD_NAME failed to process PKGBUILD template:\n" | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | 1 | ▶ | . $tt_obj->error if ( eval { $tt_obj->error } ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||
| 1821 | 1 | return $tt_output; | |||||||||||||||||||||||||||||||||||||||||
| 1822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | #---INSTANCE METHOD--- | ||||||||||||||||||||||||||||||||||||||||||
| 1825 | # Usage : $self->_process_template( $templ, $templ_vars ); | ||||||||||||||||||||||||||||||||||||||||||
| 1826 | # Purpose : Process template text with a template module or our builtin | ||||||||||||||||||||||||||||||||||||||||||
| 1827 | # template code. | ||||||||||||||||||||||||||||||||||||||||||
| 1828 | # Params : templ - A string containing the template text. | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | # templ_vars - A hashref of template variables that you can | ||||||||||||||||||||||||||||||||||||||||||
| 1830 | # refer to in the template to insert the | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | # variable's value. | ||||||||||||||||||||||||||||||||||||||||||
| 1832 | # Throws : 'Template variable %s was not provided' is thrown if a template | ||||||||||||||||||||||||||||||||||||||||||
| 1833 | # variable is used in $templ but not provided in $templ_vars, | ||||||||||||||||||||||||||||||||||||||||||
| 1834 | # OR IF IT IS UNDEF! | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | # Returns : String of the template result. | ||||||||||||||||||||||||||||||||||||||||||
| 1836 | #--------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | sub _process_template | ||||||||||||||||||||||||||||||||||||||||||
| 1838 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1839 | 10 | ▶ | croak "Invalid arguments to _process_template" if @_ != 3; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_template: called CC=6 SCAR=18.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1840 | 10 | my ($self, $templ, $templ_vars) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||
| 1842 | 10 | ▶ | croak 'templ_var parameter must be a hashref' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1843 | if ( ref $templ_vars ne 'HASH' ); | ||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||
| 1845 | # Try to find a TT module if this is our first time called... | ||||||||||||||||||||||||||||||||||||||||||
| 1846 | 10 | ▶ | _load_tt_module() unless defined $TT_MOD_NAME; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||
| 1848 | # Use the TT module if we have found one earlier... | ||||||||||||||||||||||||||||||||||||||||||
| 1849 | 10 | ▶ | return $self->_tt_process( $templ, $templ_vars ) if $TT_MOD_NAME; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1850 | |||||||||||||||||||||||||||||||||||||||||||
| 1851 | 9 | _DEBUG "Processing PKGBUILD template with built-in code..."; | |||||||||||||||||||||||||||||||||||||||||
| 1852 | |||||||||||||||||||||||||||||||||||||||||||
| 1853 | # Fall back on our own primitive little template engine... | ||||||||||||||||||||||||||||||||||||||||||
| 1854 | 9 | $templ = _prune_if_blocks( $templ, $templ_vars ); | |||||||||||||||||||||||||||||||||||||||||
| 1855 | 9 | $templ =~ s{ $TT_VAR_MATCH } | |||||||||||||||||||||||||||||||||||||||||
| 1856 | 6 | ▶ | { (defined $templ_vars->{$1} ? $templ_vars->{$1} : "") }xmseg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||
| 1858 | 9 | return $templ; | |||||||||||||||||||||||||||||||||||||||||
| 1859 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1860 | |||||||||||||||||||||||||||||||||||||||||||
| 1861 | 7 | 1; # End of CPANPLUS::Dist::Arch | |||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||