diff options
author | Norbert Preining <preining@logic.at> | 2008-12-15 21:55:37 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-12-15 21:55:37 +0000 |
commit | 52c664adcaba5d606cd23141c7ed58faee2fb74e (patch) | |
tree | 71b1f2d0a1e1038da8c9f34ec809bb8ece94e3a5 /Master | |
parent | eb1f7332ba7de361285fd6e17ed7e43eba3fb6e7 (diff) |
add two patches in development, one for permutable arguments, one for using
podselect for selecting the right part of the doc when warning
git-svn-id: svn://tug.org/texlive/trunk@11625 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/etc/dev.permutable-arguments.patch | 394 | ||||
-rw-r--r-- | Master/tlpkg/etc/dev.usage-via-podselect.patch | 197 |
2 files changed, 591 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/dev.permutable-arguments.patch b/Master/tlpkg/etc/dev.permutable-arguments.patch new file mode 100644 index 00000000000..d5e1d156c90 --- /dev/null +++ b/Master/tlpkg/etc/dev.permutable-arguments.patch @@ -0,0 +1,394 @@ +--- /src/TeX/texlive-svn/Master/texmf/scripts/texlive/tlmgr2.pl 2008-12-15 15:19:14.000000000 +0100 ++++ tlmgr2.pl 2008-12-15 15:22:44.000000000 +0100 +@@ -71,7 +71,7 @@ + mkdirhier merge_into copy log debug)); + use Cwd qw/abs_path/; + use Pod::Usage; +-use Getopt::Long qw(:config no_autoabbrev require_order); ++use Getopt::Long qw(:config no_autoabbrev permute); + use strict; + + require("papersize-setting.pl"); +@@ -99,9 +99,6 @@ + # stubs for setting paper sizes + our %papersetting_subs; + +-# each action uses this. +-my @getopt_configure_subopts = qw(no_pass_through permute); +- + # flags for machine readable form + our $FLAG_REMOVE = "d"; + our $FLAG_FORCIBLE_REMOVED = "f"; +@@ -119,17 +116,90 @@ + my $opt_pause = 0; + $::machinereadable = 0; + ++my %globaloptions = ( ++ "location" => "=s", ++ "gui" => 1, ++ "gui-lang" => "=s", ++ "package-logfiles" => "=s", ++ "machine-readable" => 1, ++ "version" => 1, ++ "pause" => 1, ++ "help|h|?" => 1); ++ ++my %actionoptions = ( ++ "remove" => { "no-depends" => 1, ++ "no-depends-at-all" => 1, ++ "force" => 1, ++ "dry-run|n" => 1 }, ++ "show" => { "list" => 1 }, ++ "search" => { "global" => 1, ++ "file" => 1 }, ++ "restore" => { "backupdir" => "=s", ++ "dry-run|n" => 1, ++ "force" => 1 }, ++ "backup" => { "backupdir" => "=s", ++ "clean" => ":s", ++ "all" => 1, ++ "dry-run|n" => 1 }, ++ "update" => { "no-depends" => 1, ++ "no-depends-at-all" => 1, ++ "all" => 1, ++ "list" => 1, ++ "no-remove" => 1, ++ "force" => 1, ++ "backupdir" => "=s", ++ "backup" => 1, ++ "dry-run|n" => 1 }, ++ "install" => { "no-depends" => 1, ++ "no-depends-at-all" => 1, ++ "reinstall" => 1, ++ "force" => 1, ++ "dry-run|n" => 1 }, ++ "arch" => { "dry-run|n" => 1 }, ++ "generate" => { "localcfg" => "=s", ++ "dest" => "=s" }, ++ "uninstall"=> { "force" => 1 }, ++ "check" => { "use-svn" => 1 } ++ ); ++ ++my %optarg; ++for my $k (keys %globaloptions) { ++ if ($globaloptions{$k} eq "1") { ++ $optarg{$k} = 1; ++ } else { ++ $optarg{"$k" . $globaloptions{$k}} = 1; ++ } ++} ++for my $v (values %actionoptions) { ++ for my $k (keys %$v) { ++ if ($v->{$k} eq "1") { ++ $optarg{$k} = 1; ++ } else { ++ $optarg{"$k" . $v->{$k}} = 1; ++ } ++ } ++} + TeXLive::TLUtils::process_logging_options(); +-GetOptions("location=s" => \$opt_location, +- "gui" => \$opt_gui, +- "gui-lang=s" => \$opt_gui_lang, +- "package-logfile=s" => \$opt_packagelogfile, +- # for machine readable we use a global variable so that +- # the perl modules can check for that, too, more easily +- "machine-readable" => \$::machinereadable, +- "version" => \$opt_version, +- "pause" => \$opt_pause, +- "h|help|?" => \$opt_help) or pod2usage(2); ++ ++my %cmdopts; ++ ++GetOptions(\%cmdopts, keys(%optarg)) or pod2usage(2); ++ ++ ++$opt_location = $cmdopts{"location"} ++ if (defined($cmdopts{"location"})); ++$opt_gui = $cmdopts{"gui"} ++ if (defined($cmdopts{"gui"})); ++$opt_gui_lang = $cmdopts{"gui-lang"} ++ if (defined($cmdopts{"gui-lang"})); ++$opt_packagelogfile = $cmdopts{"package-logfile"} ++ if (defined($cmdopts{"package-logfile"})); ++$::machinereadable = $cmdopts{"machine-readable"} ++ if (defined($cmdopts{"machine-readable"})); ++$opt_version = $cmdopts{"version"} ++ if (defined($cmdopts{"version"})); ++$opt_help = $cmdopts{"help"} ++ if (defined($cmdopts{"help"})); + + my $action = shift; + +@@ -137,6 +207,14 @@ + $action = "gui"; + } + ++ddebug("action = $action\n"); ++for my $k (keys %cmdopts) { ++ ddebug("$k => $cmdopts{$k}\n"); ++} ++if (@ARGV) { ++ ddebug("arguments: @ARGV\n"); ++} ++ + sub give_version { + if (!defined($::version_string)) { + $::version_string = ""; +@@ -178,6 +256,40 @@ + } + } + ++# ++# check on supported arguments ++# ++my %suppargs; ++%suppargs = %{$actionoptions{$action}} ++ if defined($actionoptions{$action}); ++my @notvalidargs; ++for my $k (keys %cmdopts) { ++ my $kk = $k; ++ if ($k eq "n" || $k eq "dry-run") { ++ $kk = "dry-run|n"; ++ } ++ if (!defined($suppargs{$kk})) { ++ push @notvalidargs, $k; ++ } ++} ++if (@notvalidargs) { ++ my $msg = ++ "The following arguments are not supported for the action $action:\n"; ++ for my $c (@notvalidargs) { ++ $msg .= " $c"; ++ } ++ $msg .= "\n"; ++ # here we should call pod2usage actually with the argument ++ # -verbose => 99 ++ # -sections => "ACTIONS/$action.*" ++ # to show the correct invocation of the action ++ if (TeXLive::TLUtils::which("perldoc")) { ++ pod2usage(-msg => $msg, -exitstatus => 1, -verbose => 1); ++ } else { ++ pod2usage(-msg => $msg, -exitstatus => 1, -verbose => 1, -noperldoc => 1); ++ } ++} ++ + # besides doing normal logging if -logfile is specified, we try to log + # package related actions (install, remove, update) to + # the package-log file TEXMFSYSVAR/web2c/tlmgr.log +@@ -495,15 +607,14 @@ + # . remove the package + # + my %ret; +- my $opt_nodepends = 0; +- my $opt_reallynodepends = 0; +- my $opt_force = 0; +- my $opt_dry = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("no-depends" => \$opt_nodepends, +- "no-depends-at-all" => \$opt_reallynodepends, +- "force" => \$opt_force, +- "n|dry-run" => \$opt_dry) or pod2usage(2); ++ my $opt_nodepends = ++ defined($cmdopts{"no-depends"}) ? $cmdopts{"no-depends"} : 0; ++ my $opt_reallynodepends = ++ defined($cmdopts{"no-depends-at-all"}) ? $cmdopts{"no-depends-at-all"} : 0; ++ my $opt_force = ++ defined($cmdopts{"force"}) ? $cmdopts{"force"} : 0; ++ my $opt_dry = ++ defined($cmdopts{"dry-run"}) ? $cmdopts{"dry-run"} : 0; + $opt_nodepends = 1 if $opt_reallynodepends; + my %already_removed; + my @more_removal; +@@ -684,9 +795,7 @@ + } + tlwarn("machine-readable output not supported for show\n") + if $::machinereadble; +- my $opt_list = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("list" => \$opt_list) or pod2usage(2); ++ my $opt_list = defined($cmdopts{"list"}) ? $cmdopts{"list"} : 0; + init_local_db(); + my $tlmediatlpdb; + foreach my $pkg (@ARGV) { +@@ -765,14 +874,11 @@ + } + + sub action_search { +- my $opt_global = 0; +- my $opt_file = 0; ++ my $opt_global = defined($cmdopts{"global"}) ? $cmdopts{"global"} : 0; ++ my $opt_file = defined($cmdopts{"file"}) ? $cmdopts{"file"} : 0; + my %ret; + tlwarn("machine-readable output not supported for search\n") + if $::machinereadble; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("global" => \$opt_global, +- "file" => \$opt_file) or pod2usage(2); + my $r = shift @ARGV; + my $ret = ""; + my $tlpdb; +@@ -819,12 +925,9 @@ + tlwarn("machine-readable output not supported for restore\n") + if $::machinereadble; + my $opt_backupdir; +- my $opt_force; +- my $opt_dry = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("backupdir=s" => \$opt_backupdir, +- "n|dry-run" => \$opt_dry, +- "force" => \$opt_force) or pod2usage(2); ++ defined($cmdopts{"backupdir"}) && ( $opt_backupdir = $cmdopts{"backupdir"} ); ++ my $opt_force = defined($cmdopts{"force"}) ? $cmdopts{"force"} : 0; ++ my $opt_dry = defined($cmdopts{"dry"}) ? $cmdopts{"dry"} : 0; + my %ret; + # check the backup dir argument + if ($opt_backupdir) { +@@ -920,9 +1023,10 @@ + tlwarn("machine-readable output not supported for backup\n") + if $::machinereadble; + init_local_db(1); +- my $opt_dry = 0; +- my $opt_all = 0; ++ my $opt_dry = defined($cmdopts{"dry-run"}) ? $cmdopts{"dry-run"} : 0; ++ my $opt_all = defined($cmdopts{"all"}) ? $cmdopts{"all"} : 0; + my $opt_backupdir; ++ defined($cmdopts{"backupdir"}) && ( $opt_backupdir = $cmdopts{"backupdir"} ); + # --clean argument + # can be either -1 ... don't clean + # 0 ... remove all backups +@@ -937,12 +1041,7 @@ + # $opt_clean = -1, 0, N -> --clean=N given, check argument + # + my $opt_clean; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("all" => \$opt_all, +- "backupdir=s" => \$opt_backupdir, +- "clean:s" => \$opt_clean, +- "n|dry-run" => \$opt_dry, +- ) or pod2usage(2); ++ defined($cmdopts{"clean"}) && ( $opt_clean = $cmdopts{"clean"} ); + my $clean_mode = 0; + $clean_mode = 1 if defined($opt_clean); + if ($clean_mode) { +@@ -1200,25 +1299,18 @@ + } + init_local_db(1); + # initialize the TLMedia from $location +- my $opt_nodepends = 0; +- my $opt_reallynodepends = 0; +- my $opt_dry = 0; +- my $opt_all = 0; +- my $opt_list = 0; +- my $opt_noremove = 0; ++ my $opt_nodepends = ++ defined($cmdopts{"no-depends"}) ? $cmdopts{"no-depends"} : 0; ++ my $opt_reallynodepends = ++ defined($cmdopts{"no-depends-at-all"}) ? $cmdopts{"no-depends-at-all"} : 0; ++ my $opt_dry = defined($cmdopts{"dry-run"}) ? $cmdopts{"dry-run"} : 0; ++ my $opt_all = defined($cmdopts{"all"}) ? $cmdopts{"all"} : 0; ++ my $opt_list = defined($cmdopts{"list"}) ? $cmdopts{"list"} : 0; ++ my $opt_noremove = defined($cmdopts{"no-remove"}) ? $cmdopts{"no-remove"} : 0; + my $opt_backupdir; +- my $opt_backup = 0; +- my $opt_force = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("no-depends" => \$opt_nodepends, +- "no-depends-at-all" => \$opt_reallynodepends, +- "all" => \$opt_all, +- "list" => \$opt_list, +- "no-remove" => \$opt_noremove, +- "force" => \$opt_force, +- "backupdir=s" => \$opt_backupdir, +- "backup" => \$opt_backup, +- "n|dry-run" => \$opt_dry) or pod2usage(2); ++ defined($cmdopts{"backupdir"}) && ( $opt_backupdir = $cmdopts{"backupdir"} ); ++ my $opt_backup = defined($cmdopts{"backup"}) ? $cmdopts{"backup"} : 0; ++ my $opt_force = defined($cmdopts{"force"}) ? $cmdopts{"force"} : 0; + $opt_nodepends = 1 if $opt_reallynodepends; + my $nrupdated = 0; + my %ret; +@@ -1652,17 +1744,16 @@ + if $::machinereadble; + init_local_db(1); + # initialize the TLMedia from $location +- my $opt_nodepends = 0; +- my $opt_reallynodepends = 0; +- my $opt_dry = 0; +- my $opt_reinstall = 0; +- my $opt_force = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("no-depends" => \$opt_nodepends, +- "no-depends-at-all" => \$opt_reallynodepends, +- "reinstall" => \$opt_reinstall, +- "force" => \$opt_force, +- "n|dry-run" => \$opt_dry) or pod2usage(2); ++ my $opt_nodepends = ++ defined($cmdopts{"no-depends"}) ? $cmdopts{"no-depends"} : 0; ++ my $opt_reallynodepends = ++ defined($cmdopts{"no-depends-at-all"}) ? $cmdopts{"no-depends-at-all"} : 0; ++ my $opt_dry = ++ defined($cmdopts{"dry-run"}) ? $cmdopts{"dry-run"} : 0; ++ my $opt_reinstall = ++ defined($cmdopts{"reinstall"}) ? $cmdopts{"reinstall"} : 0; ++ my $opt_force = defined($cmdopts{"force"}) ? $cmdopts{"force"} : 0; ++ $opt_nodepends = 1 if $opt_reallynodepends; + my %ret; + init_tlmedia(); + my $tlmediatlpdb = $tlmediasrc->tlpdb; +@@ -1869,9 +1960,8 @@ + tlwarn("machine-readable output not supported for arch\n") + if $::machinereadble; + my %ret; +- my $opt_dry = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("n|dry-run" => \$opt_dry) or pod2usage(2); ++ my $opt_dry = ++ defined($cmdopts{"dry-run"}) ? $cmdopts{"dry-run"} : 0; + my $what = shift @ARGV; + init_local_db(1); + info("arch: dry run, no changes will be made\n") if $opt_dry; +@@ -1948,10 +2038,8 @@ + } + + sub action_generate { +- my $localconf = ""; +- my $dest = ""; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("localcfg=s" => \$localconf, "dest=s" => \$dest,) or pod2usage(2); ++ my $dest = defined($cmdopts{"dest"}) ? $cmdopts{"dest"} : ""; ++ my $localconf = defined($cmdopts{"localcfg"}) ? $cmdopts{"localcfg"} : ""; + my $what = shift @ARGV; + tlwarn("machine-readable output not supported for generate\n") + if $::machinereadble; +@@ -2114,9 +2202,7 @@ + if ($opt_gui) { + action_gui("uninstall"); + } +- my $force = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("force" => \$force) or pod2usage(2); ++ my $force = defined($cmdopts{"force"}) ? $cmdopts{"force"} : 0; + if (!$force) { + print("If you answer yes here the whole TeX Live installation will be removed!\n"); + print "Remove TeX Live (y/N): "; +@@ -2238,9 +2324,7 @@ + + + sub action_check { +- my $svn = 0; +- Getopt::Long::Configure(@getopt_configure_subopts); +- GetOptions("use-svn" => \$svn) or pod2usage(2); ++ my $svn = defined($cmdopts{"use-svn"}) ? $cmdopts{"use-svn"} : 0; + my $what = shift @ARGV; + $what || ($what = "all"); + init_local_db(); +@@ -2952,7 +3036,7 @@ + option value is used (if set). + + The C<autobackup> option (de)activates the automatic generation of +-backups. Its value is an integer. If C<autobackup> is C<-1<, backups ++backups. Its value is an integer. If C<autobackup> is C<-1>, backups + will not be removed by default. If C<autobackup> is 0 or positive, it + specifies the number of backups to be kept. Thus, backups are disabled + with 0 as the values. diff --git a/Master/tlpkg/etc/dev.usage-via-podselect.patch b/Master/tlpkg/etc/dev.usage-via-podselect.patch new file mode 100644 index 00000000000..c51e6157ddc --- /dev/null +++ b/Master/tlpkg/etc/dev.usage-via-podselect.patch @@ -0,0 +1,197 @@ +--- /src/TeX/texlive-svn/Master/texmf/scripts/texlive/tlmgr2.pl 2008-12-15 08:27:24.000000000 +0100 ++++ tlmgr2.pl 2008-12-15 08:57:06.000000000 +0100 +@@ -71,6 +71,7 @@ + mkdirhier merge_into copy log debug)); + use Cwd qw/abs_path/; + use Pod::Usage; ++use Pod::Select; + use Getopt::Long qw(:config no_autoabbrev require_order); + use strict; + +@@ -245,6 +246,22 @@ + $localtlpdb->save; + } + finish(0); ++ } elsif ($action =~ m/^pod-test$/i) { ++ # piping the output of that to pod2text (-t) works very nicely ++ #podselect( {-output => \*STDOUT, -sections => ['ACTIONS/update.*']}, ++ # qw:/home/norbert/tlfoo/2008/texmf/scripts/texlive/tlmgr2.pl:); ++ #exit(0); ++ # ++ # that would be the perfect solution, but somehow it always creates ++ # a very strange output, I guess due to automatic resetting of ++ # verbose to 1 in Pod/Usage.pm code after selecting the sections ++ # I have no idea how to debug that ... maybe copy Pod/Usage.pm to ++ # tlpkg/TeXLive and use that instead? ++ pod2usage( { ++ -exitval => 0, ++ -verbose => 99, ++ -sections => 'ACTIONS/update.*' ++ }); + } elsif ($action =~ m/^get-mirror$/i) { + my $loc = give_ctan_mirror(); + print("$loc\n"); +@@ -2669,21 +2686,19 @@ + + =head1 ACTIONS + +-=over 4 +- +-=item B<help> ++=head2 help + + Gives this help information (same as C<--help>). + +-=item B<version> ++=head2 version + + Gives version information (same as C<--version>). + +-=item B<gui> ++=head2 gui + + Start the graphical user interface. + +-=item B<install> [I<option>]... I<pkg>... ++=head2 install [I<option>]... I<pkg>... + + Install each I<pkg> given on the command line. By default this installs + all packages on which the given I<pkg>s are dependent, also. Options: +@@ -2726,7 +2741,7 @@ + =back + + +-=item B<update> [I<option>] [I<pkg>]... ++=head2 update [I<option>] [I<pkg>]... + + Updates the packages given as arguments to the latest version available + at the installation source. Either C<--all> or at least one I<pkg> name +@@ -2814,7 +2829,7 @@ + downgrade. Also, packages for uninstalled platforms are not installed. + + +-=item B<backup> [--clean[=I<N>]] [--backupdir I<dir>] [B<--all>] [I<pkg>]... ++=head2 backup [--clean[=I<N>]] [--backupdir I<dir>] [B<--all>] [I<pkg>]... + + If the B<--clean> option is not specified, this action makes a backup of + the given packages, or all packages given C<--all>. These backups are +@@ -2855,7 +2870,7 @@ + =back + + +-=item B<restore --backupdir> I<dir> [I<pkg> [I<rev>]] ++=head2 restore [--backupdir I<dir>] [I<pkg> [I<rev>]] + + Restore a package from a previously-made backup. + +@@ -2884,7 +2899,7 @@ + =back + + +-=item B<remove> [I<option>]... I<pkg>... ++=head2 remove [I<option>]... I<pkg>... + + Remove each I<pkg> specified. Removing a collection removes all package + dependencies, but not collection dependencies, in that collection +@@ -2915,9 +2930,9 @@ + =back + + +-=item B<option [show]> ++=head2 option [show] + +-=item B<option I<key> [I<value>]> ++=head2 option I<key> [I<value>] + + The first form shows the global TeX Live settings currently saved in the + TLPDB. +@@ -2956,11 +2971,11 @@ + In the C<--clean> mode of the C<backup> action this option also + specifies the number to be kept. + +-=item B<paper a4> ++=head2 paper a4 + +-=item B<paper letter> ++=head2 paper letter + +-=item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|I<papersize>|--list]> ++=head2 [xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|I<papersize>|--list] + + Configures the system wide paper settings, either for all programs at + once (first two forms), or just for the specified program (third +@@ -2968,7 +2983,7 @@ + specified program. + + +-=item B<arch list|add> I<arch>... ++=head2 arch list|add I<arch>... + + C<arch list> lists the TeX Live names of all the architectures + (C<i386-linux>, ...) available at the default install location. +@@ -2986,7 +3001,7 @@ + =back + + +-=item B<search [I<option>]... I<what>> ++=head2 search [I<option>]... I<what> + + By default searches the names, short and long descriptions of all + locally installed packages for the given argument (interpreted as +@@ -3006,7 +3021,7 @@ + =back + + +-=item B<show [--list] I<pkg>...> ++=head2 show [--list] I<pkg>... + + Shows information about I<pkg>: the name, category, installation status, + short and long description. Searches in the remote installation source +@@ -3016,7 +3031,7 @@ + shown, including those for architecture specific dependencies. + + +-=item B<list [collections|schemes|I<pkg>...]> ++=head2 list [collections|schemes|I<pkg>...] + + With no argument, lists all packages available at the default install + location, prefixing those already installed with C<i>. +@@ -3027,7 +3042,7 @@ + With anything else as arguments, operates as the C<show> action. + + +-=item B<check [I<option>]... [files|collections|all]> ++=head2 check [I<option>]... [files|collections|all] + + Executes one (or all) check(s) on the consistency of the installation. + +@@ -3070,15 +3085,15 @@ + =back + + +-=item B<generate language> ++=head2 generate language + +-=item B<generate language.dat> ++=head2 generate language.dat + +-=item B<generate language.def> ++=head2 generate language.def + +-=item B<generate fmtutil> ++=head2 generate fmtutil + +-=item B<generate updmap> ++=head2 generate updmap + + The I<generate> action overwrites any manual changes made in the + respective files: it recreates them from scratch. +@@ -3135,8 +3150,6 @@ + C<web2c/fmtutil.cnf> (and C<fmtutil-local.cnf>) + C<web2c/updmap.cfg> (and C<updmap-local.cfg>) + +-=back +- + + =head1 AUTHORS AND COPYRIGHT + |