| 1 | 3 | ▶ | use 5.006; # our | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Gentoo::VDB::Portage; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | our $VERSION = '0.001001'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # ABSTRACT: VDB Query Implementation for Portage/Emerge | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # AUTHORITY | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub new { | ||||||||||||||||||||||||||||
| 16 | 3 | ▶ | my ( $class, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 3 | ▶ | my $config = { ref $args[0] ? %{ $args[0] } : @args }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 3 | return bless $config, $class; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | sub _path { | ||||||||||||||||||||||||||||
| 22 | 160 | ▶ | return ( $_[0]->{path} ||= '/var/db/pkg' ); | ||||||||||||||||||||||||||
|
Subroutine
_path: called CC=2 SCAR=7.6
Condition50%1/2
$_[0]{"path"} ||= "/var/db/pkg"
MC/DC0%0/1
$_[0]{"path"} ||= "/var/db/pkg"
$_[0]{"path"}
Truth table50%1/2
A
A= $_[0]{"path"}
| |||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub _abspath { | ||||||||||||||||||||||||||||
| 26 | 73 | ▶ | my $root = path( $_[0]->_path )->absolute->realpath; | ||||||||||||||||||||||||||
|
Subroutine
_abspath: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 27 | 73 | my $path = path( $_[0]->_path, @_[ 1 .. $#_ ] )->absolute->realpath; | |||||||||||||||||||||||||||
| 28 | 73 | ▶ | die "Illegal path, outside of VDB" unless $root->subsumes($path); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 73 | return $path->stringify; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub __dir_iterator { | ||||||||||||||||||||||||||||
| 33 | 45 | ▶ | my ($path) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__dir_iterator: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 34 | 45 | my $handle; | |||||||||||||||||||||||||||
| 35 | 45 | ▶ | ( -d $path and opendir $handle, $path ) or return sub { return undef }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.7
Branch: 1 branch
Condition33%1/3
-d $path and opendir $handle, $path
MC/DC0%0/2
-d $path and opendir $handle, $path
-d $path
opendir $handle, $path
Truth table33%1/3
A and B
A= -d $pathB= opendir $handle, $path
| |||||||||||||||||||||||||||||
| 36 | return sub { | ||||||||||||||||||||||||||||
| 37 | 105 | ▶ | while (1) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 38 | 195 | my $dir = readdir $handle; | |||||||||||||||||||||||||||
| 39 | 195 | ▶ | return undef unless defined $dir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 166 | ▶ | next if $dir eq '.' or $dir eq '..'; # skip hidden entries | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$dir eq "." or $dir eq ".."
MC/DC100%2/2
$dir eq "." or $dir eq ".."
$dir eq "."
$dir eq ".."
Truth table100%3/3
A or B
A= $dir eq "."B= $dir eq ".."
| |||||||||||||||||||||||||||||
| 41 | 76 | return $dir; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | 45 | }; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub _category_iterator { | ||||||||||||||||||||||||||||
| 47 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_category_iterator: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 48 | 6 | my $root = $self->_path; | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | return sub { return undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 50 | 6 | ▶ | unless -d $root; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 6 | my $_cat_iterator = __dir_iterator($root); | |||||||||||||||||||||||||||
| 52 | return sub { | ||||||||||||||||||||||||||||
| 53 | 12 | ▶ | while (1) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | # Category possible | ||||||||||||||||||||||||||||
| 56 | 18 | my $category = $_cat_iterator->(); | |||||||||||||||||||||||||||
| 57 | 18 | ▶ | return undef if not defined $category; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # Skip hidden categories | ||||||||||||||||||||||||||||
| 60 | 12 | ▶ | next if $category =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | # Validate category to have at least one package with a file | ||||||||||||||||||||||||||||
| 63 | 12 | my $_pkg_iterator = __dir_iterator( $self->_abspath($category) ); | |||||||||||||||||||||||||||
| 64 | 12 | ▶ | while ( my $package = $_pkg_iterator->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 12 | ▶ | next if $package =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 12 | my $_file_iterator = | |||||||||||||||||||||||||||
| 67 | __dir_iterator( $self->_abspath( $category, $package ) ); | ||||||||||||||||||||||||||||
| 68 | 12 | ▶ | while ( my $file = $_file_iterator->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 6 | ▶ | next if $file =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | ## Found one package with one file, category is valid | ||||||||||||||||||||||||||||
| 71 | 6 | return $category; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | 6 | }; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub categories { | ||||||||||||||||||||||||||||
| 79 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
categories: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | 6 | my $it = $self->_category_iterator; | |||||||||||||||||||||||||||
| 81 | 6 | my @cats; | |||||||||||||||||||||||||||
| 82 | 6 | ▶ | while ( my $entry = $it->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 6 | push @cats, $entry; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 6 | return @cats; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub _package_iterator { | ||||||||||||||||||||||||||||
| 89 | 8 | ▶ | my ( $self, $config ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_package_iterator: called CC=5 SCAR=24.4
| |||||||||||||||||||||||||||||
| 90 | 8 | my $root = $self->_path; | |||||||||||||||||||||||||||
| 91 | 8 | ▶ | if ( $config->{in} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 8 | my $catdir = $self->_abspath( $config->{in} ); | |||||||||||||||||||||||||||
| 93 | 2 | ▶ | return sub { return undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 94 | 8 | ▶ | unless -d $catdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 6 | my $_pkg_iterator = __dir_iterator($catdir); | |||||||||||||||||||||||||||
| 96 | return sub { | ||||||||||||||||||||||||||||
| 97 | 10 | ▶ | while (1) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||
| 98 | 14 | my $package = $_pkg_iterator->(); | |||||||||||||||||||||||||||
| 99 | 14 | ▶ | return undef if not defined $package; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 8 | ▶ | next if $package =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | my $_file_iterator = | ||||||||||||||||||||||||||||
| 102 | 8 | __dir_iterator( $self->_abspath( $config->{in}, $package ) ); | |||||||||||||||||||||||||||
| 103 | 8 | ▶ | while ( my $file = $_file_iterator->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 4 | ▶ | next if $file =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | ## Found one package with one file, package is valid | ||||||||||||||||||||||||||||
| 106 | 4 | return $config->{in} . '/' . $package; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | 6 | }; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return sub { return undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | unless -d $root; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | my $_cat_iterator = __dir_iterator($root); | |||||||||||||||||||||||||||
| 116 | 0 | my $category = $_cat_iterator->(); | |||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | return sub { return undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | unless defined $category; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 0 | my $_pkg_iterator = __dir_iterator( $self->_abspath($category) ); | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | return sub { | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | while (1) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return undef if not defined $category; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | my $package = $_pkg_iterator->(); | |||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( not defined $package ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | $category = $_cat_iterator->(); | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | return undef if not defined $category; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if ( defined $category ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 0 | $_pkg_iterator = | |||||||||||||||||||||||||||
| 132 | __dir_iterator( $self->_abspath($category) ); | ||||||||||||||||||||||||||||
| 133 | 0 | next; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | next; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | 0 | ▶ | next if $package =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 0 | my $_file_iterator = | |||||||||||||||||||||||||||
| 139 | __dir_iterator( $self->_abspath( $category, $package ) ); | ||||||||||||||||||||||||||||
| 140 | 0 | ▶ | while ( my $file = $_file_iterator->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | next if $file =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | ## Found one package with one file, package is valid | ||||||||||||||||||||||||||||
| 143 | 0 | return $category . '/' . $package; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | 0 | }; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | sub packages { | ||||||||||||||||||||||||||||
| 150 | 8 | ▶ | my ( $self, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
packages: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 151 | 8 | ▶ | my $config = { ref $args[0] ? %{ $args[0] } : @args }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 8 | my $iterator = $self->_package_iterator($config); | |||||||||||||||||||||||||||
| 153 | 8 | my (@packages); | |||||||||||||||||||||||||||
| 154 | 8 | ▶ | while ( my $result = $iterator->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 4 | push @packages, $result; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | 8 | return @packages; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | sub _property_files_iterator { | ||||||||||||||||||||||||||||
| 161 | 1 | ▶ | my ( $self, $config ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_property_files_iterator: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | return sub { undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 163 | 1 | ▶ | unless $config->{'for'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 1 | my $catdir = $self->_abspath( $config->{'for'} ); | |||||||||||||||||||||||||||
| 165 | 0 | ▶ | return sub { undef } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 166 | 1 | ▶ | unless -d $catdir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 1 | my $iterator = __dir_iterator($catdir); | |||||||||||||||||||||||||||
| 168 | return sub { | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 35 | ▶ | while (1) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 171 | 35 | my $file = $iterator->(); | |||||||||||||||||||||||||||
| 172 | 35 | ▶ | return undef if not defined $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 34 | ▶ | next if $file =~ /\A[.]/x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | 34 | return $file; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | 1 | }; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 3 | my $ENATIVE = { | |||||||||||||||||||||||||||
| 180 | BUILD_TIME => 'timestamp', | ||||||||||||||||||||||||||||
| 181 | CATEGORY => 'string', | ||||||||||||||||||||||||||||
| 182 | CBUILD => 'string', | ||||||||||||||||||||||||||||
| 183 | CC => 'string', | ||||||||||||||||||||||||||||
| 184 | CFLAGS => 'string', | ||||||||||||||||||||||||||||
| 185 | CHOST => 'string', | ||||||||||||||||||||||||||||
| 186 | CONTENTS => 'contents', | ||||||||||||||||||||||||||||
| 187 | COUNTER => 'number', | ||||||||||||||||||||||||||||
| 188 | CTARGET => 'string', | ||||||||||||||||||||||||||||
| 189 | CXX => 'string', | ||||||||||||||||||||||||||||
| 190 | CXXFLAGS => 'string', | ||||||||||||||||||||||||||||
| 191 | DEBUGBUILD => 'flag-file', | ||||||||||||||||||||||||||||
| 192 | DEFINED_PHASES => 'space-separated-list', | ||||||||||||||||||||||||||||
| 193 | DEPEND => 'dependencies', | ||||||||||||||||||||||||||||
| 194 | DESCRIPTION => 'string', | ||||||||||||||||||||||||||||
| 195 | EAPI => 'string', | ||||||||||||||||||||||||||||
| 196 | FEATURES => 'use-list', | ||||||||||||||||||||||||||||
| 197 | 'environment.bz2' => { | ||||||||||||||||||||||||||||
| 198 | type => 'file', | ||||||||||||||||||||||||||||
| 199 | encoding => 'application/x-bzip2', | ||||||||||||||||||||||||||||
| 200 | content => 'text/plain' | ||||||||||||||||||||||||||||
| 201 | }, | ||||||||||||||||||||||||||||
| 202 | HOMEPAGE => 'url-list', | ||||||||||||||||||||||||||||
| 203 | INHERITED => 'space-separated-list', | ||||||||||||||||||||||||||||
| 204 | IUSE => 'use-list', | ||||||||||||||||||||||||||||
| 205 | IUSE_EFFECTIVE => 'use-list', | ||||||||||||||||||||||||||||
| 206 | KEYWORDS => 'keywords', | ||||||||||||||||||||||||||||
| 207 | LDFLAGS => 'string', | ||||||||||||||||||||||||||||
| 208 | LICENSE => 'licenses', | ||||||||||||||||||||||||||||
| 209 | NEEDED => 'elf-dependency-map', | ||||||||||||||||||||||||||||
| 210 | 'NEEDED.ELF.2' => 'arch-elf-dependency-map', | ||||||||||||||||||||||||||||
| 211 | PDEPEND => 'dependencies', | ||||||||||||||||||||||||||||
| 212 | PF => 'string', | ||||||||||||||||||||||||||||
| 213 | PKGUSE => 'use-list', | ||||||||||||||||||||||||||||
| 214 | PROVIDES => 'arch-so-map', | ||||||||||||||||||||||||||||
| 215 | QA_CONFIGURE_OPTIONS => 'string', | ||||||||||||||||||||||||||||
| 216 | QA_PREBUILT => 'space-separated-list', | ||||||||||||||||||||||||||||
| 217 | RDEPEND => 'dependencies', | ||||||||||||||||||||||||||||
| 218 | repository => 'string', | ||||||||||||||||||||||||||||
| 219 | REQUIRES => 'arch-so-map', | ||||||||||||||||||||||||||||
| 220 | REQUIRES_EXCLUDE => 'space-separated-list', | ||||||||||||||||||||||||||||
| 221 | RESTRICT => 'space-seperated-list', | ||||||||||||||||||||||||||||
| 222 | SIZE => 'bytecount', | ||||||||||||||||||||||||||||
| 223 | SLOT => 'string', | ||||||||||||||||||||||||||||
| 224 | USE => 'use-list', | ||||||||||||||||||||||||||||
| 225 | }; | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | my @ERULES = ( | ||||||||||||||||||||||||||||
| 228 | [ | ||||||||||||||||||||||||||||
| 229 | 34 | ▶ | sub { $_[0] =~ /\.ebuild\z/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 230 | { | ||||||||||||||||||||||||||||
| 231 | 3 | label => 'special:source_ebuild', | |||||||||||||||||||||||||||
| 232 | type => 'file', | ||||||||||||||||||||||||||||
| 233 | content => 'text/plain' | ||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | ], | ||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | sub properties { | ||||||||||||||||||||||||||||
| 239 | 1 | ▶ | my ( $self, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
properties: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 240 | 1 | ▶ | my $config = { ref $args[0] ? %{ $args[0] } : @args }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 1 | my (@proplist); | |||||||||||||||||||||||||||
| 242 | 1 | my $it = $self->_property_files_iterator($config); | |||||||||||||||||||||||||||
| 243 | 1 | ▶ | while ( my $entry = $it->() ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 34 | my $matched = 0; | |||||||||||||||||||||||||||
| 245 | 34 | ▶ | if ( exists $ENATIVE->{$entry} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 33 | $matched = 1; | |||||||||||||||||||||||||||
| 247 | push @proplist, | ||||||||||||||||||||||||||||
| 248 | { | ||||||||||||||||||||||||||||
| 249 | property => $entry, | ||||||||||||||||||||||||||||
| 250 | label => $entry, | ||||||||||||||||||||||||||||
| 251 | for => $config->{for}, | ||||||||||||||||||||||||||||
| 252 | ( | ||||||||||||||||||||||||||||
| 253 | ref $ENATIVE->{$entry} | ||||||||||||||||||||||||||||
| 254 | 1 | ? %{ $ENATIVE->{$entry} } | |||||||||||||||||||||||||||
| 255 | 33 | ▶ | : ( type => $ENATIVE->{$entry} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | ), | ||||||||||||||||||||||||||||
| 257 | }; | ||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | 34 | for my $rule (@ERULES) { | |||||||||||||||||||||||||||
| 260 | 34 | ▶ | next unless $rule->[0]->($entry); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 261 | 1 | $matched = 1; | |||||||||||||||||||||||||||
| 262 | push @proplist, | ||||||||||||||||||||||||||||
| 263 | { | ||||||||||||||||||||||||||||
| 264 | property => $entry, | ||||||||||||||||||||||||||||
| 265 | label => $entry, | ||||||||||||||||||||||||||||
| 266 | for => $config->{for}, | ||||||||||||||||||||||||||||
| 267 | ( | ||||||||||||||||||||||||||||
| 268 | ref $rule->[1] | ||||||||||||||||||||||||||||
| 269 | 1 | ▶ | ? %{ $rule->[1] } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | : ( type => $rule->[1] ) | ||||||||||||||||||||||||||||
| 271 | ), | ||||||||||||||||||||||||||||
| 272 | }; | ||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | 34 | ▶ | if ( not $matched ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | push @proplist, | ||||||||||||||||||||||||||||
| 276 | { | ||||||||||||||||||||||||||||
| 277 | property => $entry, | ||||||||||||||||||||||||||||
| 278 | label => 'unknown:' . $entry, | ||||||||||||||||||||||||||||
| 279 | for => $config->{for}, | ||||||||||||||||||||||||||||
| 280 | 0 | type => 'file', | |||||||||||||||||||||||||||
| 281 | content => 'application/octet-stream', | ||||||||||||||||||||||||||||
| 282 | }; | ||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | 1 | return @proplist; | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | sub get_property { | ||||||||||||||||||||||||||||
| 289 | 32 | ▶ | my ( $self, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
get_property: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 290 | 32 | ▶ | my $config = { ref $args[0] ? %{ $args[0] } : @args }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | return undef | ||||||||||||||||||||||||||||
| 292 | 32 | ▶ | unless exists $config->{for} and exists $config->{property}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $config->{"for"} and exists $config->{"property"}
MC/DC0%0/2
exists $config->{"for"} and exists $config->{"property"}
exists $config->{"for"}
exists $config->{"property"}
Truth table33%1/3
A and B
A= exists $config->{"for"}B= exists $config->{"property"}
| |||||||||||||||||||||||||||||
| 293 | 32 | my $content; | |||||||||||||||||||||||||||
| 294 | open my $fh, '<', $self->_abspath( $config->{for}, $config->{property} ) | ||||||||||||||||||||||||||||
| 295 | 32 | ▶ | or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 296 | { | ||||||||||||||||||||||||||||
| 297 | 32 | local $/ = undef; | |||||||||||||||||||||||||||
| 298 | 32 | $content = <$fh>; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | 32 | close $fh; | |||||||||||||||||||||||||||
| 301 | 32 | chomp $content; | |||||||||||||||||||||||||||
| 302 | 32 | return $content; | |||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 3 | 1; | |||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | =head1 NAME | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | Gentoo::VDB::Portage - VDB Query Implementation for Portage/Emerge | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | Kent Fredric <kentnl@cpan.org> | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | This software is copyright (c) 2016 by Kent Fredric. | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =cut | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | ## Please see file perltidy.ERR | ||||||||||||||||||||||||||||