summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-06-20 08:32:27 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-06-20 08:32:27 +0000
commitb63255e63f75dd7331790796fc6e80f624b819e4 (patch)
tree762674a3c96d364140ccd3789f1cb23adcedf1f6 /usr.sbin
parent30d3a76d00ee9353ad5f6c8441a15676cddc6ff9 (diff)
display bad symlinks by destination
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 49a2ad60ee9..5369b81c7a2 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.14 2010/06/14 22:08:24 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.15 2010/06/20 08:32:26 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -169,8 +169,7 @@ sub compute_checksum
if (!defined $chk) {
$state->error("bogus symlink: #1 (too deep)", $fname);
} elsif (!-e $chk) {
- $state->errsay("Warning: symlink #1 points to non-existent #2",
- $fname, $chk);
+ push(@{$state->{bad_symlinks}{$chk}}, $fname);
}
$result->make_symlink($value);
} elsif (-f _) {
@@ -785,6 +784,18 @@ sub create_package
}
}
+sub show_bad_symlinks
+{
+ my ($self, $state) = @_;
+ for my $dest (sort keys %{$state->{bad_symlinks}}) {
+ $state->errsay("Warning: symlink(s) point to non-existent #1",
+ $dest);
+ for my $link (@{$state->{bad_symlinks}{$dest}}) {
+ $state->errsay("\t#1", $link);
+ }
+ }
+}
+
sub parse_and_run
{
my ($self, $cmd) = @_;
@@ -886,6 +897,7 @@ sub parse_and_run
} else {
$plist = $self->make_plist_with_sum($state, $plist);
}
+ $self->show_bad_symlinks($state);
$state->end_status;
}