From 6dd0b06bb8ff014a315446417c91c7b5ce9e3132 Mon Sep 17 00:00:00 2001 Message-Id: <6dd0b06bb8ff014a315446417c91c7b5ce9e3132.1713589907.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 9 Jan 2012 21:16:16 +0000 Subject: [PATCH] reprocess when needed Organization: Straylight/Edgeware From: Ian Jackson --- update-xfonts-traditional | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/update-xfonts-traditional b/update-xfonts-traditional index df71fce..839cc18 100755 --- a/update-xfonts-traditional +++ b/update-xfonts-traditional @@ -20,12 +20,17 @@ our $mode; our %foundrymap; our $verbose=0; our $reportfh; +our $foundryinfo; sub reportloaded { return unless $verbose; print $reportfh @_,"\n" or die $!; } +sub statsummary () { + return join ' ', ((stat _)[1,7,9,10]); +} + sub loadrules ($) { my ($key) = @_; our %cache; @@ -119,7 +124,14 @@ sub processbdf ($$$$) { } sub loadfoundries () { + $foundryinfo = ''; foreach my $path (@rulespath) { + if (!stat $path) { + die "$path $!" unless $!==&ENOENT; + next; + } + $foundryinfo .= statsummary().' '.$path."\0\n"; + my $p = "$path/foundries"; my $f = new IO::File $p; if (!$f) { @@ -127,6 +139,7 @@ sub loadfoundries () { print $reportfh "foundries: none in $p\n" or die $! if $verbose; next; } + stat $f or die $!; while (<$f>) { s/^\s*//; s/\s+$//; next if m/^\#/; @@ -218,10 +231,18 @@ sub processfontdir ($) { my $olddone = do "$fontdir/$donefile"; if (!$olddone) { die "$fontdir $! $@ " unless $!==&ENOENT; + } + if ($olddone && $olddone->{''} ne $foundryinfo) { + our $repro_reported; + print $reportfh "reprocessing fonts (rules updated)\n" or die $! + unless $repro_reported++; + $olddone = undef; + } + if (!$olddone) { $olddone = { }; $changed = 1; } - my $newdone = { }; + my $newdone = { '' => $foundryinfo }; my $log = new IO::File "$fontdir/$logfile", "w" or die "$fontdir/$logfile $!"; my %outfiles; # bitmask: 1 /*exists*/ | 2 /*wanted*/ @@ -249,7 +270,7 @@ sub processfontdir ($) { die "$fontdir $dent" unless -f _; $anypcfs++; - my $stats = join ' ', ((stat _)[1,7,9,10]); + my $stats = statsummary(); my $tdone = $olddone->{$dent}; my $outdent = $fontprefix.$dent; if (defined $tdone && $tdone eq $stats) { -- [mdw]