diff options
author | Karl Berry <karl@freefriends.org> | 2009-01-01 02:01:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-01-01 02:01:27 +0000 |
commit | 861d7ba8a08c63e42284d86a73bc7fdd795dda36 (patch) | |
tree | 2a654400bb0b2daf01e30e55ec401ce765e2200c /Master/texmf | |
parent | bd36ab79b831cabded89ff0328c7c0e410872997 (diff) |
(BEGIN): prepend our own directory to PATH, so
some subprograms can automatically find the right
thing.
(action_paper): error checking.
git-svn-id: svn://tug.org/texlive/trunk@11775 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr2.pl | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index 441521c677d..86617874366 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -33,8 +33,13 @@ our $Master; BEGIN { $^W = 1; - $Master = `kpsewhich -var-value=SELFAUTOPARENT`; - chomp($Master); + # make subprograms (including kpsewhich) have the right path: + ($mydir = $0) =~ s,/[^/]*$,,; + $ENV{"PATH"} = "$mydir:$ENV{PATH}"; + # + chomp($Master = `kpsewhich -var-value=SELFAUTOPARENT`); + # + # make Perl find our packages first: unshift (@INC, "$Master/tlpkg"); unshift (@INC, "$Master/texmf/scripts/texlive"); } @@ -56,6 +61,7 @@ TeXLive::TLUtils->import(qw(member info give_ctan_mirror win32 dirname require("papersize-setting.pl"); our %papersetting_subs; +#use TeXLive::TLPaper; binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -203,7 +209,7 @@ if ($opts{"help"}) { # unify arguments so that the $action contains paper in all cases # and push the first arg back to @ARGV for action_paper processing -if ($action =~ /paper|dvips|xdvi|pdftex|dvipdfmx?|context/) { +if ($action =~ /^(paper|xdvi|pdftex|dvips|dvipdfmx?|context)$/) { unshift(@ARGV, $action); $action = "paper"; } @@ -400,11 +406,12 @@ sub handle_ret_hash { chomp (my $TEXMFLOCAL = `kpsewhich -var-value=TEXMFLOCAL`); if (defined($ret{'format'})) { - info("regenerating fmtutil.cnf\n"); + info("regenerating fmtutil.cnf in $TEXMFSYSVAR\n"); TeXLive::TLUtils::create_fmtutil($localtlpdb, "$TEXMFSYSVAR/web2c/fmtutil.cnf", "$TEXMFLOCAL/web2c/fmtutil-local.cnf"); # run fmtutil-sys only if the option for building formats is set. + my $fmt = $localtlpdb->option_create_formats; if ($localtlpdb->option_create_formats) { info("running fmtutil-sys --missing\n"); $errors += system("fmtutil-sys", "--missing"); @@ -708,7 +715,7 @@ sub action_paper { my $newpaper = shift @ARGV; if (!defined($newpaper) || $newpaper !~ /^(a4|letter)$/) { $newpaper = "the empty string." if !defined($newpaper); - tlwarn("tlmgr: paper expects a4 or letter, not $newpaper\n"); + tlwarn("tlmgr: paper expects `a4' or `letter', not $newpaper\n"); return; } # output is done to the path components as given in @@ -716,16 +723,19 @@ sub action_paper { # in %default_paper_config_path_component; # together with the tree as given in the first argument of paper_* merge_into(\%ret, paper_all($texmfsysconfig, $newpaper)); - #karl: merge_into(\%ret, TeXLive::TLPaper:paper_all($texmfsysconfig, $newpaper)); + #karl merge_into(\%ret, TeXLive::TLPaper::paper_all($texmfsysconfig, $newpaper)); } else { - my $prog = $action; # first argument is the program to change - shift @ARGV; # get rid of useless "paper" argument + my $prog = $action; # first argument is the program to change + my $arg = shift @ARGV; # get "paper" argument + if (!defined($arg) || $arg ne "paper") { + $arg = "the empty string." if ! $arg; + tlwarn("tlmgr: expected `paper' after $prog, not $arg\n"); + return; + } merge_into(\%ret, &{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV)); - #karl: merge_into(\%ret,TeXLive::TLPaper::do_paper($prog,$texmfsysconfig,@ARGV)); - } - if ($localtlpdb->option_create_formats) { - $ret{"format"} = 1; + #karl merge_into(\%ret,TeXLive::TLPaper::do_paper($prog,$texmfsysconfig,@ARGV)); } + $ret{"format"} = 1 if ($localtlpdb->option_create_formats); return \%ret; } @@ -3050,7 +3060,7 @@ directories specified by the respective options (see above). =item B<paper letter> -=item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|I<papersize>|--list]> +=item B<[xdvi|pdftex|dvips|dvipdfmx|dvipdfm|context] paper [help|I<papersize>|--list]> =back |