summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-12-09 23:59:30 +0000
committerNorbert Preining <preining@logic.at>2008-12-09 23:59:30 +0000
commitc9c16153e516cc427e1ac87d9cb4af5d62c571a7 (patch)
treef13e6ed6c395b5c8f5790296a2a028b0f9efeead
parentca1867b161ce8cc70c23d5b05ef8c3cc173f0f34 (diff)
fix finding of files, call mktexlsr, use correct regexp for context
git-svn-id: svn://tug.org/texlive/trunk@11573 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf/scripts/texlive/papersize-setting.pl33
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr2.pl4
2 files changed, 27 insertions, 10 deletions
diff --git a/Master/texmf/scripts/texlive/papersize-setting.pl b/Master/texmf/scripts/texlive/papersize-setting.pl
index 0cbd01731ab..f69ad3aab1b 100644
--- a/Master/texmf/scripts/texlive/papersize-setting.pl
+++ b/Master/texmf/scripts/texlive/papersize-setting.pl
@@ -104,10 +104,12 @@ my %dvipdfm_papersize = ( 'letter' => 1, 'legal' => 1, 'ledger' => 1,
our %papersetting_subs;
sub paper_all {
+ my %ret;
for my $p (keys %papersetting_subs) {
#info("setting paper size for $p to @_\n");
- &{$papersetting_subs{$p}}(@_);
+ merge_into(\%ret, &{$papersetting_subs{$p}}(@_));
}
+ return \%ret;
}
sub get_paper_list {
@@ -128,6 +130,7 @@ sub get_paper_list {
# Writing is done to TEXMFSYSCONFIG/tex/generic/config/pdftexconfig.tex
#
sub paper_pdftex {
+ my %ret;
my $outtree = shift;
my $outcomp = $paper_config_path_component{"pdftex"};
$outcomp || ($outcomp = $default_paper_config_path_component{"pdftex"});
@@ -223,6 +226,8 @@ sub paper_pdftex {
}
info("Setting paper for pdftex to $newpaper.\n");
mkdirhier(dirname($outfile));
+ # if we create the outfile we have to call mktexlsr
+ $ret{"mktexlsr"} = 1 unless (-r $outfile);
if (!open(TMP, ">$outfile")) {
tlwarn("Cannot write to $outfile: $!\n");
tlwarn("Not setting paper for pdftex.\n");
@@ -238,6 +243,7 @@ sub paper_pdftex {
# just print the current value
info("current pdftex paper size: $currentpaper\n");
}
+ return \%ret;
}
$papersetting_subs{"pdftex"} = \&paper_pdftex;
@@ -271,6 +277,7 @@ $papersetting_subs{"pdftex"} = \&paper_pdftex;
# Writing is done to TEXMFSYSCONFIG/dvips/config/config.ps
#
sub paper_dvips {
+ my %ret;
my $outtree = shift;
my $outcomp = $paper_config_path_component{"dvips"};
$outcomp || ($outcomp = $default_paper_config_path_component{"dvips"});
@@ -343,6 +350,8 @@ sub paper_dvips {
}
info("Setting paper for dvips to $newpaper.\n");
mkdirhier(dirname($outfile));
+ # if we create the outfile we have to call mktexlsr
+ $ret{"mktexlsr"} = 1 unless (-r $outfile);
if (!open(TMP, ">$outfile")) {
tlwarn("Cannot write to $outfile: $!\n");
tlwarn("Not setting paper for dvips.\n");
@@ -358,6 +367,7 @@ sub paper_dvips {
# just print the current value
info("current dvips paper size: $papersizes[0]\n");
}
+ return \%ret;
}
$papersetting_subs{"dvips"} = \&paper_dvips;
@@ -393,11 +403,13 @@ sub paper_context {
chomp($inp);
}
my @bla = keys %pdftex_papersize;
- paper_do_simple($inp, "context", '^\s*\\setuppapersize\s*',
- '^\s*\\setuppapersize\s*\[([^][]*)\]',
+ # take care here, the \\\\ are necessary in some places and not in
+ # some others because there is no intermediate evaluation
+ return &paper_do_simple($inp, "context", '^\s*\\\\setuppapersize\s*',
+ '^\s*\\\\setuppapersize\s*\[([^][]*)\].*$',
sub {
my ($ll,$np) = @_;
- if ($ll =~ m/^\s*\\setuppapersize\s*/) {
+ if ($ll =~ m/^\s*\\setuppapersize\s*/) {
return("\\setuppapersize[$np][$np]\n");
} else {
return($ll);
@@ -428,7 +440,7 @@ sub paper_xdvi {
my $xdvi = `kpsewhich --progname=xdvi --format="other text files" XDvi`;
chomp($xdvi);
my @bla = keys %xdvi_papersize;
- paper_do_simple($xdvi, "xdvi", '^\*paper: ', '^\*paper:\s+(\w+)\s*$',
+ return &paper_do_simple($xdvi, "xdvi", '^\*paper: ', '^\*paper:\s+(\w+)\s*$',
sub {
my ($ll,$np) = @_;
$ll =~ s/^\*paper:\s+(\w+)\s*$/\*paper: $np\n/;
@@ -458,7 +470,7 @@ sub do_dvipdfm_and_x {
my $outcomp = $paper_config_path_component{$prog};
$outcomp || ($outcomp = $default_paper_config_path_component{$prog});
my $outfile = "$outtree/$outcomp";
- paper_do_simple($inp, $prog, '^p\s+', '^p\s+(\w+)\s*$',
+ return &paper_do_simple($inp, $prog, '^p\s+', '^p\s+(\w+)\s*$',
sub {
my ($ll,$np) = @_;
$ll =~ s/^p\s+(\w+)\s*$/p $np\n/;
@@ -472,7 +484,7 @@ sub paper_dvipdfm {
my $inp = `kpsewhich --progname=dvipdfm --format="other text files" config`;
chomp($inp);
my @bla = keys %dvipdfm_papersize;
- do_dvipdfm_and_x($inp, "dvipdfm", $outtree, \@bla, $newpaper);
+ return &do_dvipdfm_and_x($inp, "dvipdfm", $outtree, \@bla, $newpaper);
}
$papersetting_subs{"dvipdfm"} = \&paper_dvipdfm;
@@ -482,7 +494,7 @@ sub paper_dvipdfmx {
my $inp = `kpsewhich --progname=dvipdfmx --format="other text files" dvipdfmx.cfg`;
chomp($inp);
my @bla = keys %dvipdfm_papersize;
- do_dvipdfm_and_x($inp, "dvipdfmx", $outtree, \@bla, $newpaper);
+ return &do_dvipdfm_and_x($inp, "dvipdfmx", $outtree, \@bla, $newpaper);
}
$papersetting_subs{"dvipdfmx"} = \&paper_dvipdfmx;
@@ -511,6 +523,8 @@ $papersetting_subs{"dvipdfmx"} = \&paper_dvipdfmx;
sub paper_do_simple {
my ($inp, $prog, $firstre, $secondre, $bl, $outp, $paplist, $defaultpaper, $defaultline, $newpaper) = @_;
+ my %ret;
+
debug("file used for $prog: $inp\n");
open(FOO, "<$inp") or die("cannot open file $inp: $!");
@@ -569,6 +583,8 @@ sub paper_do_simple {
}
info("Setting paper for $prog to $newpaper.\n");
mkdirhier(dirname($outp));
+ # if we create the outfile we have to call mktexlsr
+ $ret{"mktexlsr"} = 1 unless (-r $outp);
if (!open(TMP, ">$outp")) {
tlwarn("Cannot write to $outp: $!\n");
tlwarn("Not setting paper for $prog.\n");
@@ -584,6 +600,7 @@ sub paper_do_simple {
# just return the current value
info("Current paper setting for $prog: $currentpaper\n");
}
+ return \%ret;
}
1;
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl
index d6be9c053f2..a0ee8c565f1 100755
--- a/Master/texmf/scripts/texlive/tlmgr2.pl
+++ b/Master/texmf/scripts/texlive/tlmgr2.pl
@@ -641,7 +641,7 @@ sub action_paper {
# our %paper_config_path_component, and if not present the defaults
# in %default_paper_config_path_component;
# together with the tree as given in the first argument of paper_*
- paper_all($texmfsysconfig, $newpaper);
+ merge_into(\%ret, paper_all($texmfsysconfig, $newpaper));
} else {
# now we have as first argument a program
my $prog = $action;
@@ -651,7 +651,7 @@ sub action_paper {
# see above for the selection of the output
# if we want to change the output the value in %paper_config_path_component
# has to be changed
- &{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV);
+ merge_into( \%ret, &{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV));
}
if ($localtlpdb->option_create_formats) {
$ret{"format"} = 1;