1
# $Id: TLUtils.pm 26100 2012-04-23 04:20:08Z preining $
1
# $Id: TLUtils.pm 26320 2012-05-13 03:53:19Z preining $
2
2
# TeXLive::TLUtils.pm - the inevitable utilities for TeX Live.
3
3
# Copyright 2007, 2008, 2009, 2010, 2011 Norbert Preining, Reinhard Kotucha
4
4
# This file is licensed under the GNU General Public License version 2
2684
2683
sub create_updmap {
2685
my ($tlpdb,$dest,$localconf) = @_;
2686
my @tlpdblines = $tlpdb->updmap_cfg_lines(
2687
get_disabled_local_configs($localconf, '#'));
2688
# we do not use _create_config_files here because we want to
2689
# parse the $localconf file for the five options in updmap.cfg
2690
#_create_config_files($tlpdb, "texmf/web2c/updmap-hdr.cfg", $dest,
2691
# $localconf, 0, '#', \@tlpdblines);
2692
my $headfile = "texmf/web2c/updmap-hdr.cfg";
2693
my $root = $tlpdb->root;
2697
if (-r "$localconf") {
2699
# this should be done more intelligently, but for now only add those
2700
# lines without any duplication check ...
2701
open FOO, "<$localconf"
2702
or die "strange, -r ok but cannot open $localconf: $!";
2706
my ($k, $v, @rest) = split(' ', $l);
2707
if (check_updmap_config_value($k, $v, $localconf)) {
2710
push @localconflines, $l;
2715
# read the -hdr file and replace the options if given in the local
2717
open(INFILE,"<$root/$headfile") or die("Cannot open $root/$headfile");
2718
for my $l (<INFILE>) {
2719
my ($k, $v, @rest) = split(' ', $l);
2720
if (check_updmap_config_value($k, $v, "$root/$headfile")) {
2721
if (defined($configs{$k})) {
2722
push @lines, "$k $configs{$k}\n";
2732
# add the lines from the tlpdb
2733
push @lines, @tlpdblines;
2735
# add additional local config lines
2736
push @lines, @localconflines;
2739
open(OUTFILE,">$dest")
2740
or die("Cannot open $dest for writing: $!");
2742
printf OUTFILE "# Generated by %s on %s\n", "$0", scalar localtime;
2743
print OUTFILE @lines;
2744
close(OUTFILE) || warn "close(>$dest) failed: $!";
2684
my ($tlpdb,$dest) = @_;
2685
my @tlpdblines = $tlpdb->updmap_cfg_lines();
2686
_create_config_files($tlpdb, "texmf/web2c/updmap-hdr.cfg", $dest,
2687
undef, 0, '#', \@tlpdblines);
2748
2690
sub check_updmap_config_value {