- fix an "invisible bug": checking for suffixes shouldn't try for !fileobjects
(noticed while adding strip_redundant_absolute, as ::Cwd does not have cwd) - generalize removal of redundant prefixes to all objects with a path that can be absolute.
This commit is contained in:
parent
ced2196a44
commit
e900e5d9fa
@ -1,5 +1,5 @@
|
||||
#! /usr/bin/perl
|
||||
# $OpenBSD: update-plist,v 1.155 2018/05/31 09:14:12 espie Exp $
|
||||
# $OpenBSD: update-plist,v 1.156 2018/05/31 09:33:38 espie Exp $
|
||||
# Copyright (c) 2018 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
@ -516,6 +516,17 @@ sub check_suffix
|
||||
return $error;
|
||||
}
|
||||
|
||||
# helper method
|
||||
# @extra and friends may have unneeded ${PREFIX} prepended to them
|
||||
sub strip_redundant_absolute
|
||||
{
|
||||
my ($self, $p) = @_;
|
||||
# remove unneeded absolute paths
|
||||
if ($self->name =~ m/^\// && $self->cwd eq $p->{state}{prefix}) {
|
||||
$self->{name} = $p->strip_prefix($self->name);
|
||||
}
|
||||
}
|
||||
|
||||
sub unsubst
|
||||
{
|
||||
my $a = shift;
|
||||
@ -578,19 +589,6 @@ sub show_unknown
|
||||
{
|
||||
}
|
||||
|
||||
# objects are (mostly) stuff with paths that can get substs...
|
||||
package OpenBSD::PackingElement::Object;
|
||||
sub last_check
|
||||
{
|
||||
my ($self, $p, $state) = @_;
|
||||
|
||||
# don't care if it's already in a PLIST
|
||||
return if defined $self->{comesfrom};
|
||||
my $error = $self->check_suffix($state);
|
||||
print STDERR "Warning: ", $p->nlist->pkgname, " contains ",
|
||||
$self->fullstring, " ($error ?)\n" if defined $error;
|
||||
}
|
||||
|
||||
package OpenBSD::PackingElement::Dependency;
|
||||
sub process_dependency
|
||||
{
|
||||
@ -739,6 +737,7 @@ sub last_check
|
||||
{
|
||||
my ($self, $p, $state) = @_;
|
||||
|
||||
$self->strip_redundant_absolute($p);
|
||||
return if !defined $self->{tagged_along};
|
||||
my $error = $self->check_suffix($state);
|
||||
print STDERR "Warning: ", $p->nlist->pkgname, " still contains ",
|
||||
@ -847,6 +846,19 @@ sub known_object
|
||||
package OpenBSD::PackingElement::FileObject;
|
||||
use File::Basename;
|
||||
|
||||
# FileObjects are (mostly) stuff with paths that can get substs...
|
||||
sub last_check
|
||||
{
|
||||
my ($self, $p, $state) = @_;
|
||||
|
||||
$self->strip_redundant_absolute($p);
|
||||
# don't care if it's already in a PLIST
|
||||
return if defined $self->{comesfrom};
|
||||
my $error = $self->check_suffix($state);
|
||||
print STDERR "Warning: ", $p->nlist->pkgname, " contains ",
|
||||
$self->fullstring, " ($error ?)\n" if defined $error;
|
||||
}
|
||||
|
||||
sub known_object
|
||||
{
|
||||
my ($self, $o) = @_;
|
||||
@ -990,15 +1002,6 @@ sub may_tag_along
|
||||
$self->attach_to_lastobject($plist);
|
||||
}
|
||||
|
||||
sub last_check
|
||||
{
|
||||
my ($self, $p, $state) = @_;
|
||||
# some people write extra with unneeded absolute paths.
|
||||
if ($self->cwd eq $p->{state}{prefix}) {
|
||||
$self->{name} = $p->strip_prefix($self->name);
|
||||
}
|
||||
}
|
||||
|
||||
sub rebless_okay() { 0 }
|
||||
|
||||
package OpenBSD::PackingElement::Extradir;
|
||||
@ -1009,11 +1012,6 @@ sub copy_extra
|
||||
&OpenBSD::PackingElement::Extra::copy_extra;
|
||||
}
|
||||
|
||||
sub last_check
|
||||
{
|
||||
&OpenBSD::PackingElement::Extra::last_check;
|
||||
}
|
||||
|
||||
package OpenBSD::PackingElement::Manpage;
|
||||
|
||||
sub check_suffix
|
||||
|
Loading…
x
Reference in New Issue
Block a user