From 46b9d23df8f44a97673fc060cb76c3fa560c8471 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 8 Dec 2008 20:47:44 +0000 Subject: fixes and new features autoback start for tlmgr2 git-svn-id: svn://tug.org/texlive/trunk@11557 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr2.pl | 9 ++++---- .../texmf/scripts/texlive/tlmgrgui/gui-config2.pl | 24 ++++++++++++++++++++++ Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl | 11 +++++++++- 3 files changed, 39 insertions(+), 5 deletions(-) (limited to 'Master') diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index e19b341296a..d6be9c053f2 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -183,12 +183,12 @@ if (!open(PACKAGELOG, ">>$packagelogfile")) { } my $loadmediasrcerror = "Cannot load TeX Live database from "; -my %ret; execute_action($action, @ARGV); sub execute_action { my ($action, @argv) = @_; + my %ret; # we have to set @ARGV to the @argv since many of the action_* subs # use GetOption @@ -747,6 +747,7 @@ sub action_show { sub action_search { my $opt_global = 0; my $opt_file = 0; + my %ret; Getopt::Long::Configure(@getopt_configure_subopts); GetOptions("global" => \$opt_global, "file" => \$opt_file) or pod2usage(2); @@ -800,6 +801,7 @@ sub action_restore { GetOptions("backupdir=s" => \$opt_backupdir, "n|dry-run" => \$opt_dry, "force" => \$opt_force) or pod2usage(2); + my %ret; # check the backup dir argument if ($opt_backupdir) { my $ob = abs_path($opt_backupdir); @@ -838,7 +840,6 @@ sub action_restore { next if ($dirent !~ m/^(.*)\.r([0-9]+)\.tar\.lzma$/); $backups{$1}->{$2} = 1; } - my $ret; my ($pkg, $rev) = @ARGV; if (!defined($pkg)) { if (keys %backups) { @@ -882,13 +883,13 @@ sub action_restore { my $tlpobj = TeXLive::TLPOBJ->new; $tlpobj->from_file($localtlpdb->root . "/tlpkg/tlpobj/$pkg.tlpobj"); $localtlpdb->add_tlpobj($tlpobj); - $ret = $localtlpdb->get_package($pkg)->make_return_hash_from_executes("enable"); + merge_into(\%ret, $localtlpdb->get_package($pkg)->make_return_hash_from_executes("enable")); $localtlpdb->save; } } else { print "revision $rev for $pkg is not present in $opt_backupdir\n"; } - return $ret; + return \%ret; } sub action_backup { diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl index 13a5dd84638..f160c993431 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl @@ -13,6 +13,8 @@ my $default_location = $localtlpdb->option_location; my $default_formats = ($localtlpdb->option_create_formats ? ___"yes" : ___"no"); my $default_docfiles = ($localtlpdb->option_install_docfiles ? ___"yes" : ___"no"); my $default_srcfiles = ($localtlpdb->option_install_srcfiles ? ___"yes" : ___"no"); +my $default_backupdir = $localtlpdb->option("backupdir"); +my $default_autobackup = $localtlpdb->option("autobackup"); # this will be loaded only on unix systems! # @@ -40,6 +42,16 @@ my $back_config_set_m4 = $back_config_set->Label(-textvariable => \$default_srcf my $back_config_set_r4 = $back_config_set->Button(-text => ___"toggle", -command => sub { toggle_setting("srcfiles"); }); +my $back_config_set_l5 = $back_config_set->Label(-text => ___"backupdir", -anchor => "w"); +my $back_config_set_m5 = $back_config_set->Label(-textvariable => \$default_backupdir); +my $back_config_set_r5 = $back_config_set->Button(-text => ___"change", + -command => sub { info("Not implemented!\n"); return; change_backupdir(); }); + +my $back_config_set_l6 = $back_config_set->Label(-text => ___"autobackup", -anchor => "w"); +my $back_config_set_m6 = $back_config_set->Label(-textvariable => \$default_autobackup); +my $back_config_set_r6 = $back_config_set->Button(-text => ___"change", + -command => sub { info("Not implemented!\n"); return; change_autobackup(); }); + $back_config_set_l1->grid(-row => 1, -column => 1, -padx => "2m", -pady => "2m", -sticky => "nwe"); @@ -65,6 +77,18 @@ $back_config_set_m4->grid(-row => 4, -column => 2, -padx => "2m", -pady => "2m", -sticky => "nwe"); $back_config_set_r4->grid(-row => 4, -column => 3, -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_l5->grid(-row => 5, -column => 1, + -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_m5->grid(-row => 5, -column => 2, + -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_r5->grid(-row => 5, -column => 3, + -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_l6->grid(-row => 6, -column => 1, + -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_m6->grid(-row => 6, -column => 2, + -padx => "2m", -pady => "2m", -sticky => "nwe"); +$back_config_set_r6->grid(-row => 6, -column => 3, + -padx => "2m", -pady => "2m", -sticky => "nwe"); ############# diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl index f765a0df31c..b67ca1b7238 100755 --- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl @@ -102,6 +102,9 @@ $TRANS{'en'} = { warningnonetupdate => "No updates found.\n\nYour installation is set up to look on the disk for updates.\n\nIf you want to install from the Internet for this one time only, click on the \"Change\" button above and select \"Default Net Location\" (or any other network location you know to be working).\n\nIf you want to change it permanently, go to the \"Configuration\" Tab and change the default installation source.", pleaseclick => "Please click on an item on the left for details", alluptodate => "Everything up-to-date!", + # new ones + backupdir => "Default backup directory", + autobackup => "Auto backup setting", }; @@ -272,8 +275,14 @@ $balloon->attach( $top->Button(-text => ___"change", -command => sub { menu_edit_location(); })->pack(-side => 'left'), -balloonmsg => ___"changesrclong"); +# here we add a bit of trickery to make sure that the verbosity level +# as set on the cmd line (-v or -v -v) is kept during pressing the +# debug button on and off. If -v is *not* given activating it afterwards +# defaults to one -v, while if -v -v is given on the cmd line, we keep +# it that way $balloon->attach( - $top->Checkbutton(-text => ___"debug", + $top->Checkbutton(-text => ___"debug", + -onvalue => ($opt_verbosity == 0 ? 1 : $opt_verbosity), -variable => \$::opt_verbosity)->pack(-side => 'left'), -balloonmsg => ___"debugballoon"); -- cgit v1.2.3