do a bit more magic: in case of a fatal change, don't write the new

packing-list "as if", but transform back the non-fatal pieces into what
was in the old packing-list, in order to minimize noise in the diff.
This commit is contained in:
espie 2010-07-19 17:40:17 +00:00
parent 0def44df9a
commit dd4cfea122

View File

@ -1,6 +1,6 @@
#! /usr/bin/perl
# $OpenBSD: register-plist,v 1.22 2010/07/14 09:58:48 espie Exp $
# $OpenBSD: register-plist,v 1.23 2010/07/19 17:40:17 espie Exp $
# Copyright (c) 2005
# Marc Espie. All rights reserved.
# Redistribution and use in source and binary forms, with or without
@ -31,8 +31,29 @@ use OpenBSD::PackageInfo;
use OpenBSD::PackingList;
use OpenBSD::Paths;
package OpenBSD::PackingList;
sub write_mogrified
{
my ($self, $file, $state) = @_;
open (my $fh, '>', $file) or
$state->fatal("Can't write plist to #1: #2", $file, $!);
$self->visit('write_mogrified', $fh, $state);
}
package OpenBSD::PackingElement;
sub write_mogrified
{
my ($self, $fh, $state) = @_;
if ($state->{mogrified}{$self}) {
$state->{mogrified}{$self}->write($fh);
} else {
$self->write($fh);
}
}
sub forget_details
{
}
@ -300,6 +321,7 @@ sub my_compare
}
if ($r == 2) {
push(@{$state->{updates}}, [$e2, $e]);
$state->{mogrified}{$e} = $e2;
$final = 2;
}
# zap extra info-* files and man pages
@ -353,7 +375,7 @@ for my $pkgfile (@ARGV) {
my $r = my_compare($plist, $plist2 ,$state);
if ($r == 1) {
my $t = "$result-new";
$plist->tofile($t);
$plist->write_mogrified($t, $state);
$state->errsay("Error: change in plist between #1 and #2", $result, $t);
system {OpenBSD::Paths->diff} ('diff', '-u', $result, $t);
$error++;