summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-14 19:50:45 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-14 19:50:45 +0000
commite0e50c28d6fcf5dedfad8be9176fa74ca818c452 (patch)
tree23c1a95c14412345178e31b018db7a0350512b08 /usr.sbin
parent7c7a7160046710d8238862131f6d2e7dad75bb90 (diff)
pass full item to CollisionReport, so that it can compute md5 for files
not registered with any package, and tell you if the file differs or not.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/CollisionReport.pm18
2 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index d0a60e66984..a0eee8feddd 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.19 2004/11/13 12:33:01 espie Exp $
+# $OpenBSD: Add.pm,v 1.20 2004/11/14 19:50:44 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -77,7 +77,7 @@ sub validate_plist($$)
next unless $item->IsFile();
my $fname = $destdir.$item->fullname();
if (OpenBSD::Vstat::vexists($fname)) {
- push(@$colliding, $fname);
+ push(@$colliding, $item);
$problems++;
}
$totsize += $item->{size} if defined $item->{size};
diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
index d1e8b4470a3..20e806bca3c 100644
--- a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
+++ b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: CollisionReport.pm,v 1.2 2004/11/13 23:13:39 espie Exp $
+# $OpenBSD: CollisionReport.pm,v 1.3 2004/11/14 19:50:44 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -25,7 +25,7 @@ use OpenBSD::PackageInfo;
sub collision_report($$)
{
my ($list, $state) = @_;
- my %todo = map {($_, 1)} @$list;
+ my %todo = map {($_->fullname(), $_->{md5})} @$list;
my $bypkg = {};
@@ -52,8 +52,18 @@ sub collision_report($$)
print "\t$item ($pkg)\n";
}
}
- for my $item (sort keys %todo) {
- print "\t$item\n";
+ if (%todo) {
+ require OpenBSD::md5;
+ my $destdir = $state->{destdir};
+
+ for my $item (sort keys %todo) {
+ my $md5 = OpenBSD::md5::fromfile($destdir.$item);
+ if ($md5 eq $todo{$item}) {
+ print "\t$item (same md5)\n";
+ } else {
+ print "\t$item (different md5)\n";
+ }
+ }
}
}