chiark
/
gitweb
/
~ian
/
xfonts-traditional.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
packaging fixes
[xfonts-traditional.git]
/
update-xfonts-traditional
diff --git
a/update-xfonts-traditional
b/update-xfonts-traditional
index 4b71d1407038430a5f44e304c8406741ec1ec3a2..e2fb14fb762f90a696bb07a60dcd647151a6b1e4 100755
(executable)
--- a/
update-xfonts-traditional
+++ b/
update-xfonts-traditional
@@
-20,12
+20,17
@@
our $mode;
our %foundrymap;
our $verbose=0;
our $reportfh;
our %foundrymap;
our $verbose=0;
our $reportfh;
+our $foundryinfo;
sub reportloaded {
return unless $verbose;
print $reportfh @_,"\n" or die $!;
}
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;
sub loadrules ($) {
my ($key) = @_;
our %cache;
@@
-119,7
+124,14
@@
sub processbdf ($$$$) {
}
sub loadfoundries () {
}
sub loadfoundries () {
+ $foundryinfo = '';
foreach my $path (@rulespath) {
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) {
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;
}
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/^\#/;
while (<$f>) {
s/^\s*//; s/\s+$//;
next if m/^\#/;
@@
-148,7
+161,7
@@
sub processpcfgz ($$$$) {
my ($usread,$uswrite);
my ($reader,$writer);
my @children;
my ($usread,$uswrite);
my ($reader,$writer);
my @children;
- foreach my $proc (['
zcat
'], ['pcf2bdf'], [],
+ foreach my $proc (['
gunzip
'], ['pcf2bdf'], [],
['bdftopcf'],['',qw(gzip -1)]) {
my $isfinal = (@$proc && $proc->[0] eq '');
if (!$isfinal) {
['bdftopcf'],['',qw(gzip -1)]) {
my $isfinal = (@$proc && $proc->[0] eq '');
if (!$isfinal) {
@@
-214,18
+227,27
@@
sub processfontdir ($) {
die "$fontdir $!" unless $!==&ENOENT;
return;
}
die "$fontdir $!" unless $!==&ENOENT;
return;
}
+ my $changed = 0;
my $olddone = do "$fontdir/$donefile";
if (!$olddone) {
die "$fontdir $! $@ " unless $!==&ENOENT;
my $olddone = do "$fontdir/$donefile";
if (!$olddone) {
die "$fontdir $! $@ " unless $!==&ENOENT;
+ } elsif ($olddone->{''} ne $foundryinfo) {
+ our $repro_reported;
+ print $reportfh "reprocessing fonts (rules updated)\n" or die $!
+ unless $repro_reported++;
+ $olddone = undef;
+ }
+ if (!$olddone) {
$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*/
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 $updated=0;
my $reported=0;
+ my $anypcfs=0;
flush $reportfh or die $!;
while (my $dent = scalar readdir FD) {
flush $reportfh or die $!;
while (my $dent = scalar readdir FD) {
@@
-245,7
+267,9
@@
sub processfontdir ($) {
next;
}
die "$fontdir $dent" unless -f _;
next;
}
die "$fontdir $dent" unless -f _;
- my $stats = join ' ', ((stat _)[1,7,9,10]);
+ $anypcfs++;
+
+ my $stats = statsummary();
my $tdone = $olddone->{$dent};
my $outdent = $fontprefix.$dent;
if (defined $tdone && $tdone eq $stats) {
my $tdone = $olddone->{$dent};
my $outdent = $fontprefix.$dent;
if (defined $tdone && $tdone eq $stats) {
@@
-265,9
+289,9
@@
sub processfontdir ($) {
or die "$fontdir $outdent $!";
$updated++;
$outfiles{$outdent} |= 3;
or die "$fontdir $outdent $!";
$updated++;
$outfiles{$outdent} |= 3;
- $changed = 1;
}
$newdone->{$dent} = $stats;
}
$newdone->{$dent} = $stats;
+ $changed = 1;
}
my $affected=0;
foreach my $olddent (keys %outfiles) {
}
my $affected=0;
foreach my $olddent (keys %outfiles) {
@@
-278,13
+302,18
@@
sub processfontdir ($) {
}
unlink "$fontdir/$olddent" or die "$fontdir $olddent $!";
$changed = 1;
}
unlink "$fontdir/$olddent" or die "$fontdir $olddent $!";
$changed = 1;
+ $updated++;
}
}
- if (!%$newdone) {
+ if (!stat "$fontdir/fonts.dir") {
+ $!==&ENOENT or die "$fontdir $!";
+ } else {
+ $!=0; $?=0; system 'mkfontdir',$fontdir;
+ die "$fontdir $? $!" if $? or $!;
+ }
+ if (!$anypcfs) {
unlink "$fontdir/$logfile" or die "$fontdir $!";
unlink "$fontdir/$donefile" or $!==&ENOENT or die "$fontdir $!";
} elsif ($changed) {
unlink "$fontdir/$logfile" or die "$fontdir $!";
unlink "$fontdir/$donefile" or $!==&ENOENT or die "$fontdir $!";
} elsif ($changed) {
- $!=0; $?=0; system 'mkfontdir',$fontdir;
- die "$fontdir $? $!" if $? or $!;
my $newdoneh = new IO::File "$fontdir/$donefile.new", 'w'
or die "$fontdir $!";
print $newdoneh Dumper($newdone) or die "$fontdir $!";
my $newdoneh = new IO::File "$fontdir/$donefile.new", 'w'
or die "$fontdir $!";
print $newdoneh Dumper($newdone) or die "$fontdir $!";
@@
-366,6
+395,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;
Getopt::Long::Configure(qw(bundling));
GetOptions(@options) or exit 127;