From: Ian Jackson Date: Mon, 9 Jan 2012 03:33:39 +0000 (+0000) Subject: better reporting; update mode X-Git-Tag: debian/1.2~35 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=xfonts-traditional.git;a=commitdiff_plain;h=c8ba454e8f57574bc479ce64a43e4c03ae2b9603 better reporting; update mode --- diff --git a/update-xfonts-traditional b/update-xfonts-traditional index 4b71d14..d34157f 100755 --- a/update-xfonts-traditional +++ b/update-xfonts-traditional @@ -214,18 +214,20 @@ sub processfontdir ($) { die "$fontdir $!" unless $!==&ENOENT; return; } + my $changed = 0; my $olddone = do "$fontdir/$donefile"; if (!$olddone) { die "$fontdir $! $@ " unless $!==&ENOENT; $olddone = { }; + $changed = 1; } my $newdone = { }; my $log = new IO::File "$fontdir/$logfile", "w" or die "$fontdir/$logfile $!"; my %outfiles; # bitmask: 1 /*exists*/ | 2 /*wanted*/ - my $changed; my $updated=0; my $reported=0; + my $anypcfs=0; flush $reportfh or die $!; while (my $dent = scalar readdir FD) { @@ -245,6 +247,8 @@ sub processfontdir ($) { next; } die "$fontdir $dent" unless -f _; + $anypcfs++; + my $stats = join ' ', ((stat _)[1,7,9,10]); my $tdone = $olddone->{$dent}; my $outdent = $fontprefix.$dent; @@ -265,9 +269,9 @@ sub processfontdir ($) { or die "$fontdir $outdent $!"; $updated++; $outfiles{$outdent} |= 3; - $changed = 1; } $newdone->{$dent} = $stats; + $changed = 1; } my $affected=0; foreach my $olddent (keys %outfiles) { @@ -279,7 +283,7 @@ sub processfontdir ($) { unlink "$fontdir/$olddent" or die "$fontdir $olddent $!"; $changed = 1; } - if (!%$newdone) { + if (!$anypcfs) { unlink "$fontdir/$logfile" or die "$fontdir $!"; unlink "$fontdir/$donefile" or $!==&ENOENT or die "$fontdir $!"; } elsif ($changed) { @@ -366,6 +370,14 @@ define_mode('process-fonttrees', sub { } }); +define_mode('update', sub { + die "no arguments allowed with --postinst\n" unless !@ARGV; + loadfoundries(); + foreach my $d (@fonttrees) { + processfonttree($d); + } +}); + Getopt::Long::Configure(qw(bundling)); GetOptions(@options) or exit 127;