diff options
author | Norbert Preining <preining@logic.at> | 2017-11-14 08:45:15 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-11-14 08:45:15 +0000 |
commit | 06e737558e409a7cf2daacd88b2e6bbe3f4fdd76 (patch) | |
tree | 218043947afae52dafba1215859447e0a64c7bad /Master/tlpkg/TeXLive | |
parent | 471d3a9f2891620433afd016d281adb38a84ae64 (diff) |
tlmgr paper: use tlmgr in msgs, report file, break when --json is unsupported
git-svn-id: svn://tug.org/texlive/trunk@45794 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPaper.pm | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/Master/tlpkg/TeXLive/TLPaper.pm b/Master/tlpkg/TeXLive/TLPaper.pm index 70bd55ef501..ffb3b1d2fc6 100644 --- a/Master/tlpkg/TeXLive/TLPaper.pm +++ b/Master/tlpkg/TeXLive/TLPaper.pm @@ -28,6 +28,8 @@ BEGIN { @EXPORT = @EXPORT_OK; } +my $prg = ($::prg ? $::prg : TeXLive::TLUtils::basename($0)); + =pod =head1 NAME @@ -232,7 +234,7 @@ sub do_paper { my $sub = $paper{$prog}{'sub'}; return(&$sub($texmfsysconfig, @args)); } else { - tlwarn("$0: unknown paper program $prog ($texmfsysconfig,@args)\n"); + tlwarn("$prg: unknown paper program $prog ($texmfsysconfig,@args)\n"); return($F_ERROR); } return ($F_OK); # not reached @@ -274,7 +276,7 @@ sub find_paper_file { } } - debug("$0: found no paper file for $progname (from $cmd)\n") if ! $ret; + debug("$prg: found no paper file for $progname (from $cmd)\n") if ! $ret; return $ret; } @@ -341,7 +343,7 @@ sub paper_pdftex { return($F_ERROR) unless $inp; - open(FOO, "<$inp") || die "$0: open($inp) failed: $!"; + open(FOO, "<$inp") || die "$prg: open($inp) failed: $!"; my @lines = <FOO>; close(FOO); @@ -455,23 +457,23 @@ sub paper_pdftex { $lines[$#lines] = $addlines; } } - info("$0: setting paper size for pdftex to $newpaper.\n"); + info("$prg: setting paper size for pdftex to $newpaper: $outfile\n"); mkdirhier(dirname($outfile)); # if we create the outfile we have to call mktexlsr TeXLive::TLUtils::announce_execute_actions("files-changed") unless (-r $outfile); if (!open(TMP, ">$outfile")) { - tlwarn("$0: Cannot write to $outfile: $!\n"); + tlwarn("$prg: Cannot write to $outfile: $!\n"); tlwarn("Not setting paper size for pdftex.\n"); return($F_ERROR); } for (@lines) { print TMP; } - close(TMP) || warn "$0: close(>$outfile) failed: $!"; + close(TMP) || warn "$prg: close(>$outfile) failed: $!"; TeXLive::TLUtils::announce_execute_actions("regenerate-formats"); # TODO should we return the value of announce_execute action? return($F_OK); } else { - tlwarn("$0: Not a valid paper size for pdftex: $newpaper\n"); + tlwarn("$prg: Not a valid paper size for pdftex: $newpaper\n"); return($F_WARNING); } } @@ -520,7 +522,7 @@ sub paper_dvips { return($F_ERROR) unless $inp; - open(FOO, "<$inp") || die "$0: open($inp) failed: $!"; + open(FOO, "<$inp") || die "$prg: open($inp) failed: $!"; my @lines = <FOO>; close(FOO); @@ -587,20 +589,20 @@ sub paper_dvips { } push @newlines, $lines[$idx]; } - info("$0: setting paper size for dvips to $newpaper.\n"); + info("$prg: setting paper size for dvips to $newpaper: $outfile\n"); mkdirhier(dirname($outfile)); # if we create the outfile we have to call mktexlsr TeXLive::TLUtils::announce_execute_actions("files-changed") unless (-r $outfile); if (!open(TMP, ">$outfile")) { - tlwarn("$0: Cannot write to $outfile: $!\n"); + tlwarn("$prg: Cannot write to $outfile: $!\n"); tlwarn("Not setting paper size for dvips.\n"); return ($F_ERROR); } for (@newlines) { print TMP; } - close(TMP) || warn "$0: close(>$outfile) failed: $!"; + close(TMP) || warn "$prg: close(>$outfile) failed: $!"; } else { - tlwarn("$0: Not a valid paper size for dvips: $newpaper\n"); + tlwarn("$prg: Not a valid paper size for dvips: $newpaper\n"); return($F_WARNING); } } @@ -684,7 +686,7 @@ sub paper_context { return($F_ERROR) unless $inp; - open(FOO, "<$inp") || die "$0: open($inp) failed: $!"; + open(FOO, "<$inp") || die "$prg: open($inp) failed: $!"; my @lines = <FOO>; close(FOO); @@ -762,23 +764,23 @@ sub paper_context { $lines[$#lines] = $addlines; } } - info("$0: setting paper size for context to $newpaper.\n"); + info("$prg: setting paper size for context to $newpaper: $outfile\n"); mkdirhier(dirname($outfile)); # if we create the outfile we have to call mktexlsr TeXLive::TLUtils::announce_execute_actions("files-changed") unless (-r $outfile); if (!open(TMP, ">$outfile")) { - tlwarn("$0: Cannot write to $outfile: $!\n"); + tlwarn("$prg: Cannot write to $outfile: $!\n"); tlwarn("Not setting paper size for context.\n"); return($F_ERROR); } for (@lines) { print TMP; } - close(TMP) || warn "$0: close(>$outfile) failed: $!"; + close(TMP) || warn "$prg: close(>$outfile) failed: $!"; TeXLive::TLUtils::announce_execute_actions("regenerate-formats"); # TODO should we return the value of announce_execute action? return($F_OK); } else { - tlwarn("$0: Not a valid paper size for context: $newpaper\n"); + tlwarn("$prg: Not a valid paper size for context: $newpaper\n"); return($F_WARNING); } } @@ -931,23 +933,23 @@ sub paper_do_simple { if (!$foundcfg) { push @newlines, &$bl($defaultline, $newpaper); } - info("$0: setting paper size for $prog to $newpaper.\n"); + info("$prg: setting paper size for $prog to $newpaper: $outfile\n"); mkdirhier(dirname($outp)); # if we create the outfile we have to call mktexlsr TeXLive::TLUtils::announce_execute_actions("files-changed") unless (-r $outp); if (!open(TMP, ">$outp")) { - tlwarn("$0: Cannot write to $outp: $!\n"); + tlwarn("$prg: Cannot write to $outp: $!\n"); tlwarn("Not setting paper size for $prog.\n"); return ($F_ERROR); } for (@newlines) { print TMP; } - close(TMP) || warn "$0: close(>$outp) failed: $!"; + close(TMP) || warn "$prg: close(>$outp) failed: $!"; TeXLive::TLUtils::announce_execute_actions("regenerate-formats") if ($prog eq "context"); return($F_OK); } else { - tlwarn("$0: Not a valid paper size for $prog: $newpaper\n"); + tlwarn("$prg: Not a valid paper size for $prog: $newpaper\n"); return($F_WARNING); } } |