diff options
author | Norbert Preining <preining@logic.at> | 2008-05-02 10:29:01 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-02 10:29:01 +0000 |
commit | 98bdd450c0f0d139f7304c0f67c1b9163610d2c5 (patch) | |
tree | 7d2e6f0cdcfa5f4edbb9576e79db1a0df8d1aa88 | |
parent | 610cc78b64b7124448d3a7140e5a7fd0911563cb (diff) |
support tlmgr default show, tlmgr default docfiles 1 etc
git-svn-id: svn://tug.org/texlive/trunk@7803 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tl-package-manager.pl | 77 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 12 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 24 |
3 files changed, 91 insertions, 22 deletions
diff --git a/Master/texmf/scripts/texlive/tl-package-manager.pl b/Master/texmf/scripts/texlive/tl-package-manager.pl index f140b78f02e..0978a69a8a7 100755 --- a/Master/texmf/scripts/texlive/tl-package-manager.pl +++ b/Master/texmf/scripts/texlive/tl-package-manager.pl @@ -205,7 +205,7 @@ if ($action =~ m/^generate$/i) { if ($opt_dry) { print "Installing $pkg.$a\n"; } else { - $ret |= $tlmediasrc->install_package("$pkg.$a", $localtlpdb, $opt_nodepends); + $ret |= $tlmediasrc->install_package("$pkg.$a", $localtlpdb, $opt_nodepends, 1); } } } @@ -213,8 +213,8 @@ if ($action =~ m/^generate$/i) { } if (TeXLive::TLUtils::member('win32', @todoarchs)) { # install the necessary win32 stuff - $ret |= $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, $opt_nodepends); - $ret |= $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, $opt_nodepends); + $ret |= $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, $opt_nodepends, 1); + $ret |= $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, $opt_nodepends, 1); } } else { die "Unknown option for arch: $what"; @@ -225,10 +225,48 @@ if ($action =~ m/^generate$/i) { if ($what =~ m/^location$/i) { # changes the default location my $loc = shift; - die("defaultlocation needs an argument") unless defined($loc); - print "Setting default location to $loc!\n"; - $localtlpdb->option_location($loc); - $localtlpdb->save; + if ($loc) { + print "Setting default location to $loc!\n"; + $localtlpdb->option_location($loc); + $localtlpdb->save; + } else { + print "Default installation source: ", $localtlpdb->option_location, "\n"; + } + } elsif ($what =~ m/^docfiles$/i) { + # changes the default docfiles + my $loc = shift; + if (defined($loc)) { + print "Defaulting to", ($loc ? "" : " not"), " install documentation files!\n"; + $localtlpdb->option_docfiles($loc); + $localtlpdb->save; + } else { + print "Install documentation files: ", $localtlpdb->option_docfiles, "\n"; + } + } elsif ($what =~ m/^srcfiles$/i) { + # changes the default srcfiles + my $loc = shift; + if (defined($loc)) { + print "Defaulting to", ($loc ? "" : " not"), " install source files!\n"; + $localtlpdb->option_srcfiles($loc); + $localtlpdb->save; + } else { + print "Install source files: ", $localtlpdb->option_srcfiles, "\n"; + } + } elsif ($what =~ m/^formats$/i) { + # changes the default formats + my $loc = shift; + if (defined($loc)) { + print "Defaulting to", ($loc ? "" : " not"), " generate format files on installation!\n"; + $localtlpdb->option_formats($loc); + $localtlpdb->save; + } else { + print "Create formats on installation: ", $localtlpdb->option_formats, "\n"; + } + } elsif ($what =~ m/^show$/i) { + print "Default installation location: ", $localtlpdb->option_location, "\n"; + print "Create formats on installation: ", ($localtlpdb->option_formats ? "yes": "no"), "\n"; + print "Install documentation files: ", ($localtlpdb->option_docfiles ? "yes": "no"), "\n"; + print "Install source files: ", ($localtlpdb->option_srcfiles ? "yes": "no"), "\n"; } else { warn "Setting other options currently not supported, please edit texlive.tlpdb!"; } @@ -262,7 +300,8 @@ if ($action =~ m/^generate$/i) { if ($opt_dry) { print "Installing $pkg\n"; } else { - $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends); + # install the packages and run postinstall actions (that is the 1) + $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1); } } } elsif ($action =~ m/^update$/i) { @@ -287,7 +326,7 @@ if ($action =~ m/^generate$/i) { # this way we get rid of useless files # force the deinstallation since we will reinstall it $ret |= &remove_package($pkg, $localtlpdb, 1); - $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends); + $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1); } } elsif ($rev > $mediarev) { print "revision in $location is less then local revision, not updating!\n"; @@ -589,7 +628,10 @@ sub removed_dirs # files/dirs in that directory. for my $f (@files) { my $abs_f = abs_path ($f); - die ("oops, no abs_path($f) from " . `pwd`) unless $abs_f; + if (!$abs_f) { + warn ("oops, no abs_path($f) from " . `pwd`); + next; + } (my $d = $abs_f) =~ s,/[^/]*$,,; my @a = exists $by_dir{$d} ? @{$by_dir{$d}} : (); push (@a, $abs_f); @@ -669,10 +711,19 @@ remove all dependencies, too, unless with option B<-no-depends>. Removing a package which is referenced as a dependency in another collection or scheme will not succeed unless the B<-force> option is given. -=item B<default C<key> C<value>> +=item B<default show> + +=item B<default C<key> [C<value>]> + +The first form shows the default settings as saved in the TeX Live Database. + +In the second form if the C<value> is missing the setting is showed, while +with C<value> present the setting is set to C<value>. -This command allows to set the defaults as saved in the local texlive.tlpdb. -Possible values for C<key> are: C<location>. (Will be extended). +Possible values for C<key> are: C<location> (default installation source), +C<formats> (create formats at installation time), +C<docfiles> (install documentation files), +C<srcfiles> (install source files). =item B<paper a4> diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index e9d0666970f..ff98271e0dc 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -82,7 +82,7 @@ sub new # BuildLanguageDat: 0x1000 fmtutil-sys --by-hyphen language.dat # sub install_package { - my ($self, $pkg, $totlpdb, $nodepends, $fallbackmedia) = @_; + my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_; my $fromtlpdb = $self->tlpdb; my $ret; die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb)); @@ -225,10 +225,12 @@ sub install_package { } } } - # do the postinstallation actions - if (defined($PostInstall{$pkg})) { - tllog($::LOG_NORMAL, "running post install action for $pkg\n"); - &{$PostInstall{$pkg}}($totlpdb->root); + if (!$nopostinstall) { + # do the postinstallation actions + if (defined($PostInstall{$pkg})) { + tllog($::LOG_NORMAL, "running post install action for $pkg\n"); + &{$PostInstall{$pkg}}($totlpdb->root); + } } return $ret; } diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index ad97970de46..f70cdeca60a 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -776,13 +776,18 @@ sub _set_option_value { $tlp->category("TLCore"); push @newdeps, "$key/$value"; } else { + my $found = 0; foreach my $d ($pkg->depends) { if ($d =~ m!^$key/!) { + $found = 1; push @newdeps, "$key/$value"; } else { push @newdeps, $d; } } + if (!$found) { + push @newdeps, "$key/$value"; + } } $pkg->depends(@newdeps); $self->{'tlps'}{'00texlive-installation.config'} = $pkg; @@ -813,15 +818,26 @@ sub _set_option_setting { push @newdeps, "$key"; } } else { + my $found = 0; foreach my $d ($pkg->depends) { - if (($d =~ m!^$key$!) && (!$value)) { - # key is present, but we should clear it, so do nothing + if ($d =~ m!^$key$!) { + # we have already the setting to true because it is present + $found = 1; + if ($value) { + # we have to keep it true, so push it to the newdeps + push @newdeps, $d; + } else { + # nothing to be done because the setting should be cleared + } } else { - # either the key is already present and we should set it (again) to on - # or it is something else + # this is a different setting, so keep it push @newdeps, $d; } } + if (!$found && $value) { + # the setting is not present but we want to have it + push @newdeps, "$key"; + } } $pkg->depends(@newdeps); $self->{'tlps'}{'00texlive-installation.config'} = $pkg; |