diff options
author | Norbert Preining <preining@logic.at> | 2011-09-24 14:42:51 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2011-09-24 14:42:51 +0000 |
commit | 54aaaeae8a91ae3f70ada46c5b4baf3430ded227 (patch) | |
tree | 8ff7ad56ecf1b191f0551cb64de240e3a739ba14 /Master/tlpkg/dev | |
parent | 43f4cb92870ce672dacae8a6210a954b8fd31155 (diff) |
fixes for running on windows, seems to be functional now also on windows
git-svn-id: svn://tug.org/texlive/trunk@24078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/dev')
-rw-r--r-- | Master/tlpkg/dev/multi-updmap.pl | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/Master/tlpkg/dev/multi-updmap.pl b/Master/tlpkg/dev/multi-updmap.pl index 36b08994c53..add0a101e99 100644 --- a/Master/tlpkg/dev/multi-updmap.pl +++ b/Master/tlpkg/dev/multi-updmap.pl @@ -32,12 +32,21 @@ my $version = '$Id$'; use Getopt::Long qw(:config no_autoabbrev ignore_case_always); use strict; -use TeXLive::TLUtils qw(mkdirhier mktexupd win32 basename sort_uniq member); +use TeXLive::TLUtils qw(mkdirhier mktexupd win32 basename dirname + sort_uniq member); -chomp(my $TEXMFMAIN =`kpsewhich --var-value=TEXMFMAIN`); +chomp(my $TEXMFMAIN = `kpsewhich --var-value=TEXMFMAIN`); chomp(my $TEXMFVAR = `kpsewhich -var-value=TEXMFVAR`); chomp(my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`); +# make sure that on windows *everything* is in lower case for comparison +if (win32()) { + $TEXMFMAIN = lc($TEXMFMAIN); + $TEXMFVAR = lc($TEXMFVAR); + $TEXMFCONFIG = lc($TEXMFCONFIG); + $TEXMFROOT = lc($TEXMFROOT); +} + my $prg = basename($0); my %opts = ( quiet => 0, nohash => 0, nomkmap => 0 ); @@ -125,6 +134,8 @@ sub main { chomp(@all_files); my @used_files; for my $f (@all_files) { + # make sure that all file names are lower case on windows for comparison + $f = lc($f) if win32(); if ($f =~ m!$TEXMFROOT/texmf/web2c/updmap.cfg!) { warning("Ignoring $f, it is only a sample file!\n"); } else { @@ -137,7 +148,22 @@ sub main { # after TEXMFCONFIG TEXMFVAR and TEXMFHOME chomp(my $TEXMFLOCAL =`kpsewhich --var-value=TEXMFLOCAL`); chomp(my $TEXMFHOME =`kpsewhich --var-value=TEXMFHOME`); - if (grep($TEXMFLOCAL, @used_files)) { + if (win32()) { + $TEXMFLOCAL = lc($TEXMFLOCAL); + $TEXMFHOME = lc($TEXMFHOME); + } + my $found = 0; + my $TMLabs = Cwd::abs_path($TEXMFLOCAL); + if ($TMLabs) { + for my $f (@used_files) { + my $absf = Cwd::abs_path($f); #should always work + if ($absf =~ m/^$TMLabs/) { + $found = 1; + last; + } + } + } + if ($found) { my @tmp; my $local_pushed = 0; for my $f (@used_files) { @@ -399,7 +425,7 @@ sub SymlinkOrCopy { . "cp -p \"$dir/$src\" \"$dir/$dest\""); } # remember for "Files generated" in &mkMaps. - return ($src, $dest); + return ($dest, $src); } @@ -785,7 +811,7 @@ sub mkMaps { @pdftex_dl14_map = &to_pdftex(@pdftex_dl14_map); &writeLines(">$pdftexoutputdir/pdftex_dl14.map", @pdftex_dl14_map); - my $link = &setupSymlinks($dvipsPreferOutline, $dvipsoutputdir, $pdftexDownloadBase14, $pdftexoutputdir); + our $link = &setupSymlinks($dvipsPreferOutline, $dvipsoutputdir, $pdftexDownloadBase14, $pdftexoutputdir); print_and_log ("\nFiles generated:\n"); sub dir { @@ -803,7 +829,7 @@ sub mkMaps { my $lnk=sprintf " -> %s\n", readlink ("$d/$f"); print_and_log ($lnk); } elsif ($f eq $target) { - if (&files_are_identical("$d/$f", "$d/$link->{$target}")) { + if (&files_are_identical("$d/$f", "$d/" . $link->{$target})) { print_and_log (" = $link->{$target}\n"); } else { print_and_log (" = ?????\n"); # This shouldn't happen. @@ -817,6 +843,7 @@ sub mkMaps { unless $opts{'dry-run'}; } } + my $d; $d = "$dvipsoutputdir"; print_and_log(" $d:\n"); @@ -1019,6 +1046,7 @@ sub save_updmap { return if $opts{'dry-run'}; my %upd = %{$alldata->{'updmap'}{$fn}}; if ($upd{'changed'}) { + mkdirhier(dirname($fn)); open (FN, ">$fn") || die "$prg: can't write to $fn: $!"; my @lines = @{$upd{'lines'}}; if (!@lines) { @@ -1139,6 +1167,26 @@ sub copyFile { } ############################################################################### +# files_are_identical(file_A, file_B) +# compare two files. Same as cmp(1). +# +sub files_are_identical { + my $file_A=shift; + my $file_B=shift; + my $retval=0; + + open IN, "$file_A"; + my $A=(<IN>); + close IN; + open IN, "$file_B"; + my $B=(<IN>); + close IN; + + $retval=1 if ($A eq $B); + return $retval; +} + +############################################################################### # files_are_different(file_A, file_B[, comment_char]) # compare two equalized files. # |