# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocation.pm,v 1.59 2022/05/08 13:21:04 espie Exp $
+# $OpenBSD: PackageLocation.pm,v 1.60 2022/05/08 13:31:40 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
!defined $state->defines("CACHING_RECHECK")) {
return $info;
}
- my $result = $self->plist(\&OpenBSD::PackingList::UpdateInfoOnly,
- sub {
- return 0 if $_[0] =~ m/^\@option\s+always-update\b/m;
- return 1 if $_[0] =~ m/^\@(?:newgroup|newuser|cwd)\b/m;
- return 0;
- });
+ my $result = $self->plist(\&OpenBSD::PackingList::UpdateInfoOnly);
if (defined $info) {
my $s1 = OpenBSD::Signature->from_plist($info);
my $s2 = OpenBSD::Signature->from_plist($result);
sub find_contents
{
- my ($self, $extra) = @_;
+ my $self = shift;
while (my $e = $self->next) {
if ($e->isFile && is_info_name($e->{name})) {
if ($e->{name} eq CONTENTS ) {
- my $v = $e->contents($extra);
+ my $v = $e->contents;
return $v;
}
} else {
sub contents
{
- my ($self, $extra) = @_;
+ my $self = shift;
if (!defined $self->{contents}) {
if (!$self->_opened) {
return;
}
- if (defined $extra) {
- my $contents = $self->find_contents($extra);
- if ($contents) {
- $self->unput;
- }
- return $contents;
- }
$self->{contents} = $self->find_contents;
}
sub plist
{
- my ($self, $code, $extra) = @_;
+ my ($self, $code) = @_;
require OpenBSD::PackingList;
if (defined $self->{dir} && -f $self->{dir}.CONTENTS) {
$plist->set_infodir($self->{dir});
return $plist;
}
- if (my $value = $self->contents($extra)) {
+ if (my $value = $self->contents) {
return OpenBSD::PackingList->fromfile(\$value, $code);
}
# hopeless
# ex:ts=8 sw=4:
-# $OpenBSD: Ustar.pm,v 1.89 2021/08/09 16:40:20 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.90 2022/05/08 13:31:41 espie Exp $
#
# Copyright (c) 2002-2014 Marc Espie <espie@openbsd.org>
#
sub contents
{
- my ($self, $lookfor) = @_;
+ my $self = shift;
my $toread = $self->{size};
my $buffer;
my $offset = 0;
while ($toread != 0) {
my $sz = $toread;
- if (defined $lookfor) {
- last if (defined $buffer) and &$lookfor($buffer);
- $sz = 1024 if $sz > 1024;
- }
my $actual = read($self->{archive}{fh}, $buffer, $sz, $offset);
if (!defined $actual) {
$self->fatal("Error reading from archive: #1", $!);