From 861d7ba8a08c63e42284d86a73bc7fdd795dda36 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 1 Jan 2009 02:01:27 +0000 Subject: (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 --- Master/texmf/scripts/texlive/tlmgr2.pl | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'Master/texmf') 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 -=item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|I|--list]> +=item B<[xdvi|pdftex|dvips|dvipdfmx|dvipdfm|context] paper [help|I|--list]> =back -- cgit v1.2.3