| Filename | /usr/libdata/perl5/OpenBSD/PackageLocator.pm |
| Statements | Executed 28 statements in 1.33ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 10.3ms | 10.3ms | OpenBSD::PackageLocator::BEGIN@23 |
| 1 | 1 | 1 | 6.38ms | 66.1ms | OpenBSD::PackageLocator::BEGIN@24 |
| 1 | 1 | 1 | 50µs | 6.18ms | OpenBSD::PackageLocator::add_default |
| 1 | 1 | 1 | 47µs | 2.07s | OpenBSD::PackageLocator::match_locations |
| 1 | 1 | 1 | 30µs | 38µs | OpenBSD::State::BEGIN@18.8 |
| 1 | 1 | 1 | 27µs | 6.22ms | OpenBSD::PackageLocator::build_default_path |
| 1 | 1 | 1 | 18µs | 6.23ms | OpenBSD::PackageLocator::default_path |
| 1 | 1 | 1 | 16µs | 36µs | OpenBSD::State::BEGIN@19.9 |
| 2 | 2 | 1 | 7µs | 7µs | OpenBSD::PackageLocator::CORE:subst (opcode) |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocator::find |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocator::grabPlist |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocator::path_parse |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocator::printable_default_path |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # ex:ts=8 sw=4: | ||||
| 2 | # $OpenBSD: PackageLocator.pm,v 1.110 2017/05/29 12:28:54 espie Exp $ | ||||
| 3 | # | ||||
| 4 | # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> | ||||
| 5 | # | ||||
| 6 | # Permission to use, copy, modify, and distribute this software for any | ||||
| 7 | # purpose with or without fee is hereby granted, provided that the above | ||||
| 8 | # copyright notice and this permission notice appear in all copies. | ||||
| 9 | # | ||||
| 10 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||||
| 11 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||||
| 12 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||||
| 13 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||||
| 14 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||||
| 15 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||||
| 16 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
| 17 | |||||
| 18 | 2 | 46µs | 2 | 46µs | # spent 38µs (30+8) within OpenBSD::State::BEGIN@18.8 which was called:
# once (30µs+8µs) by OpenBSD::State::locator at line 18 # spent 38µs making 1 call to OpenBSD::State::BEGIN@18.8
# spent 8µs making 1 call to strict::import |
| 19 | 2 | 48µs | 2 | 56µs | # spent 36µs (16+20) within OpenBSD::State::BEGIN@19.9 which was called:
# once (16µs+20µs) by OpenBSD::State::locator at line 19 # spent 36µs making 1 call to OpenBSD::State::BEGIN@19.9
# spent 20µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::PackageLocator; | ||||
| 22 | |||||
| 23 | 2 | 270µs | 1 | 10.3ms | # spent 10.3ms (10.3+49µs) within OpenBSD::PackageLocator::BEGIN@23 which was called:
# once (10.3ms+49µs) by OpenBSD::State::locator at line 23 # spent 10.3ms making 1 call to OpenBSD::PackageLocator::BEGIN@23 |
| 24 | 2 | 811µs | 1 | 66.1ms | # spent 66.1ms (6.38+59.7) within OpenBSD::PackageLocator::BEGIN@24 which was called:
# once (6.38ms+59.7ms) by OpenBSD::State::locator at line 24 # spent 66.1ms making 1 call to OpenBSD::PackageLocator::BEGIN@24 |
| 25 | |||||
| 26 | 1 | 700ns | my $default_path; | ||
| 27 | |||||
| 28 | sub add_default | ||||
| 29 | # spent 6.18ms (50µs+6.13) within OpenBSD::PackageLocator::add_default which was called:
# once (50µs+6.13ms) by OpenBSD::PackageLocator::build_default_path at line 61 | ||||
| 30 | 1 | 900ns | my ($self, $state, $p) = @_; | ||
| 31 | 1 | 600ns | my $w; | ||
| 32 | |||||
| 33 | 1 | 2µs | if (defined $ENV{TRUSTED_PKG_PATH}) { | ||
| 34 | my $v = $ENV{TRUSTED_PKG_PATH}; | ||||
| 35 | $v =~ s/^\:+//o; | ||||
| 36 | $v =~ s/\:+$//o; | ||||
| 37 | while (my $o = OpenBSD::PackageRepository->parse(\$v, $state)) { | ||||
| 38 | $o->{trusted} = 1; | ||||
| 39 | $p->add($o); | ||||
| 40 | } | ||||
| 41 | } else { | ||||
| 42 | 1 | 900ns | $w = "./:installpath"; | ||
| 43 | } | ||||
| 44 | 1 | 900ns | if (defined $ENV{PKG_PATH}) { | ||
| 45 | $w = $ENV{PKG_PATH}; | ||||
| 46 | } | ||||
| 47 | 1 | 16µs | if (defined $w) { | ||
| 48 | 1 | 9µs | 1 | 3µs | $w =~ s/^\:+//o; # spent 3µs making 1 call to OpenBSD::PackageLocator::CORE:subst |
| 49 | 1 | 8µs | 1 | 4µs | $w =~ s/\:+$//o; # spent 4µs making 1 call to OpenBSD::PackageLocator::CORE:subst |
| 50 | 1 | 26µs | 5 | 6.13ms | while (my $o = OpenBSD::PackageRepository->parse(\$w, $state)) { # spent 6.06ms making 3 calls to OpenBSD::PackageRepository::parse, avg 2.02ms/call
# spent 60µs making 2 calls to OpenBSD::PackageRepositoryList::add, avg 30µs/call |
| 51 | $p->add($o); | ||||
| 52 | } | ||||
| 53 | } | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | sub build_default_path | ||||
| 57 | # spent 6.22ms (27µs+6.19) within OpenBSD::PackageLocator::build_default_path which was called:
# once (27µs+6.19ms) by OpenBSD::PackageLocator::default_path at line 67 | ||||
| 58 | 1 | 800ns | my ($self, $state) = @_; | ||
| 59 | 1 | 4µs | 1 | 7µs | $default_path = OpenBSD::PackageRepositoryList->new($state); # spent 7µs making 1 call to OpenBSD::PackageRepositoryList::new |
| 60 | |||||
| 61 | 1 | 16µs | 1 | 6.18ms | $self->add_default($state, $default_path); # spent 6.18ms making 1 call to OpenBSD::PackageLocator::add_default |
| 62 | } | ||||
| 63 | |||||
| 64 | sub default_path | ||||
| 65 | # spent 6.23ms (18µs+6.22) within OpenBSD::PackageLocator::default_path which was called:
# once (18µs+6.22ms) by OpenBSD::PackageLocator::match_locations at line 128 | ||||
| 66 | 1 | 800ns | my ($self, $state) = @_; | ||
| 67 | 1 | 4µs | 1 | 6.22ms | if (!defined $default_path) { # spent 6.22ms making 1 call to OpenBSD::PackageLocator::build_default_path |
| 68 | $self->build_default_path($state); | ||||
| 69 | } | ||||
| 70 | 1 | 18µs | return $default_path; | ||
| 71 | } | ||||
| 72 | |||||
| 73 | sub printable_default_path | ||||
| 74 | { | ||||
| 75 | my ($self, $state) = @_; | ||||
| 76 | |||||
| 77 | return join(':', $self->default_path($state)->do_something('url')); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | sub path_parse | ||||
| 81 | { | ||||
| 82 | my ($self, $pkgname, $state, $path) = (@_, './'); | ||||
| 83 | if ($pkgname =~ m/^(.*[\/\:])(.*)/) { | ||||
| 84 | ($pkgname, $path) = ($2, $1); | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | return (OpenBSD::PackageRepository->new($path, $state), $pkgname); | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | sub find | ||||
| 91 | { | ||||
| 92 | my ($self, $url, $state) = @_; | ||||
| 93 | |||||
| 94 | my $package; | ||||
| 95 | if ($url =~ m/[\/\:]/o) { | ||||
| 96 | my ($repository, $pkgname) = $self->path_parse($url, $state); | ||||
| 97 | $package = $repository->find($pkgname); | ||||
| 98 | if (defined $package) { | ||||
| 99 | $self->default_path($state)->add($repository); | ||||
| 100 | } | ||||
| 101 | } else { | ||||
| 102 | $package = $self->default_path($state)->find($url); | ||||
| 103 | } | ||||
| 104 | return $package; | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | sub grabPlist | ||||
| 108 | { | ||||
| 109 | my ($self, $url, $code, $state) = @_; | ||||
| 110 | |||||
| 111 | my $plist; | ||||
| 112 | if ($url =~ m/[\/\:]/o) { | ||||
| 113 | my ($repository, $pkgname) = $self->path_parse($url, $state); | ||||
| 114 | $plist = $repository->grabPlist($pkgname, $code); | ||||
| 115 | if (defined $plist) { | ||||
| 116 | $self->default_path($state)->add($repository); | ||||
| 117 | } | ||||
| 118 | } else { | ||||
| 119 | $plist = $self->default_path($state)->grabPlist($url, $code); | ||||
| 120 | } | ||||
| 121 | return $plist; | ||||
| 122 | } | ||||
| 123 | |||||
| 124 | sub match_locations | ||||
| 125 | # spent 2.07s (47µs+2.07) within OpenBSD::PackageLocator::match_locations which was called:
# once (47µs+2.07s) by OpenBSD::PackageRepositoryFactory::match_locations at line 65 of OpenBSD/State.pm | ||||
| 126 | 1 | 2µs | my ($self, @search) = @_; | ||
| 127 | 1 | 13µs | my $state = pop @search; | ||
| 128 | 1 | 25µs | 2 | 2.07s | return $self->default_path($state)->match_locations(@search); # spent 2.06s making 1 call to OpenBSD::PackageRepositoryList::match_locations
# spent 6.23ms making 1 call to OpenBSD::PackageLocator::default_path |
| 129 | } | ||||
| 130 | |||||
| 131 | 1 | 4µs | 1; | ||
sub OpenBSD::PackageLocator::CORE:subst; # opcode |