diff options
author | Norbert Preining <preining@logic.at> | 2009-08-05 16:19:41 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-08-05 16:19:41 +0000 |
commit | edd31659b22ab4d3718918fca2ac2506fe118474 (patch) | |
tree | 55a9f86d0262db51a6e5c31c960c98ca1eeefbd1 | |
parent | 272f667ff1987bad105a0f13f0337e9813671862 (diff) |
move all the options from the .tlpsrc files to hashes in TLConfig
and initialize the respective tlpobjs (00texlive.installation and
00texlive.config) from the values in these hashes. Update tl-update-tlpdb
to use that, and add some comments to the tlpsrc files
git-svn-id: svn://tug.org/texlive/trunk@14542 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 37 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 48 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 27 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-tlpdb | 7 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2tlpdb | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/00texlive.config.tlpsrc | 8 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc | 19 |
7 files changed, 94 insertions, 55 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 5a18cab7203..0e544ebe073 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -2114,7 +2114,7 @@ sub action_option { next if ($o =~ m/^sys_/); } if (defined $TLPDBOptions{$o}) { - info("$TLPDBOptions{$o}->[2] ($TLPDBOptions{$o}->[1]): " . + info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . $localtlpdb->option($o) . "\n"); } else { tlwarn ("option $o not supported\n"); @@ -2123,20 +2123,20 @@ sub action_option { } elsif ($what =~ m/^showall$/i) { my %loc = %{$localtlpdb->options}; for my $o (keys %TLPDBOptions) { - info("$TLPDBOptions{$o}->[2] ($TLPDBOptions{$o}->[1]): " . + info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . (defined($loc{$o}) ? $loc{$o} : "(not set)") . "\n"); } } else { my $found = 0; for my $opt (keys %TLPDBOptions) { - if ($what eq $TLPDBOptions{$opt}->[1]) { + if ($what eq $TLPDBOptions{$opt}->[2]) { $found = 1; # the option argument matches the name my $val = shift @ARGV; if (defined($val)) { # set new value # here we have to care for some special cases - if ($what eq $TLPDBOptions{"location"}->[1]) { + if ($what eq $TLPDBOptions{"location"}->[2]) { # support "ctan" on the cmd line, and don't abs_path it! if ($val =~ m/^ctan$/i) { $val = "$TeXLive::TLConfig::TeXLiveURL"; @@ -2151,18 +2151,18 @@ sub action_option { } info("tlmgr: setting default installation location to $val\n"); $localtlpdb->option($opt, $val); - } elsif ($what eq $TLPDBOptions{"backupdir"}->[1]) { + } elsif ($what eq $TLPDBOptions{"backupdir"}->[2]) { info("tlmgr: setting option $what to $val.\n"); if (! -d $val) { info("tlmgr: the directory $val does not exists, it has to be created\n"); info("tlmgr: before backups can be done automatically.\n"); } $localtlpdb->option($opt, $val); - } elsif ($what eq $TLPDBOptions{"w32_multi_user"}->[1]) { + } elsif ($what eq $TLPDBOptions{"w32_multi_user"}->[2]) { # when running w32 do not allow that a non-admin users sets # this from false to true if (win32() && !admin() && !$val) { - tlwarn("tlmgr: non-admin user cannot set $TLPDBOptions{'w32_multi_user'}->[1] option to true\n"); + tlwarn("tlmgr: non-admin user cannot set $TLPDBOptions{'w32_multi_user'}->[2] option to true\n"); } else { if ($val) { info("tlmgr: setting option $what to 1.\n"); @@ -2221,7 +2221,7 @@ sub action_option { $localtlpdb->save; } else { # show current value - info ("$TLPDBOptions{$opt}->[2] ($TLPDBOptions{$opt}->[1]): " . + info ("$TLPDBOptions{$opt}->[3] ($TLPDBOptions{$opt}->[2]): " . $localtlpdb->option($opt) . "\n"); } last; @@ -2497,13 +2497,10 @@ sub action_recreate_tlpdb { $inst->name("00texlive.installation"); $inst->category("TLCore"); my @deps; - push @deps, "location:$TeXLive::TLConfig::TeXLiveURL"; - push @deps, "opt_create_formats:0"; - push @deps, "opt_sys_bin:/usr/local/bin"; - push @deps, "opt_sys_info:/usr/local/info"; - push @deps, "opt_sys_man:/usr/local/man"; - push @deps, "opt_install_docfiles:0"; - push @deps, "opt_install_srcfiles:0"; + # options are done further down with $tlpdb->reset_options() + #for my $k (keys %TeXLive::TLConfig::TLPDBOptions) { + # push @deps, "opt_$k:" . $TeXLive::TLConfig::TLPDBOptions{k}->[1]; + #} # find list of available archs my @archs; opendir (DIR, "$Master/bin") || die "opendir($Master/bin) failed: $!"; @@ -2518,7 +2515,7 @@ sub action_recreate_tlpdb { debug("Skipping directory $Master/bin/$dirent, no kpsewhich there\n"); } } - push @deps, "available_architectures:" . join(" ",@archs); + push @deps, "setting_available_architectures:" . join(" ",@archs); # we have to find out the default arch # if there is only one dir in $Master/bin then we are settled, # otherwise we expect the user to pass a correct arch string @@ -2528,11 +2525,11 @@ sub action_recreate_tlpdb { # if only one is installed use that one if ($#archs == 0) { # only one arch available, fine, use it as default - push @deps, "platform:$archs[0]"; + push @deps, "setting_platform:$archs[0]"; } else { if (defined($opts{"arch"})) { if (member($opts{"arch"}, @archs)) { - push @deps, "platform:" . $opts{"arch"}; + push @deps, "setting_platform:" . $opts{"arch"}; } else { tlwarn("The architecture you passed in with --arch is not present in $Master/bin\n"); tlwarn("Please specify one from the available ones: @archs\n"); @@ -2546,8 +2543,10 @@ sub action_recreate_tlpdb { } } $inst->depends(@deps); - # now we have all the stuff for 00texlive-installation.config done + # now we have all the stuff for 00texlive.installation done $tlpdb->add_tlpobj($inst); + # reset the options to default values + $tlpdb->reset_options(); # add the other stuff in $Master/tlpkg/tlpobj/*.tlpobj # we can ignore *.{source,doc}.tlpobj because they are already # included in the *.tlpobj parent one at install time diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index 0313be0bf81..73703489569 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -18,6 +18,7 @@ BEGIN { $MetaCategoriesRegexp $CategoriesRegexp $DefaultCategory + $DefaultContainerFormat $DefaultContainerExtension $InfraLocation $DatabaseName @@ -33,6 +34,7 @@ BEGIN { $RelocTree %TLPDBOptions %TLPDBSettings + %TLPDBConfigs ); @EXPORT = @EXPORT_OK; } @@ -64,7 +66,8 @@ our $DatabaseName = "texlive.tlpdb"; our $BlockSize = 4096; # the way we package things on the web -our $DefaultContainerExtension = "tar.xz"; +our $DefaultContainerFormat = "xz"; +our $DefaultContainerExtension = "tar.$DefaultContainerFormat"; our $Archive = "archive"; our $TeXLiveServerURL = "http://mirror.ctan.org"; @@ -84,6 +87,15 @@ if ($^O=~/^MSWin(32|64)$/i) { } # +# stuff formerly set in 00texlive.config +# +our %TLPDBConfigs = ( + "container_split_src_files" => 1, + "container_split_doc_files" => 1, + "container_format" => $DefaultContainerFormat, + "release" => $ReleaseYear ); + +# # definition of the option strings and their value types # possible types are: # - u: url @@ -98,61 +110,63 @@ if ($^O=~/^MSWin(32|64)$/i) { # WARNING: keep these in sync! # # $TLPDBOptions{"option"}->[0] --> type -# ->[1] --> tlmgr name -# ->[2] --> tlmgr description +# ->[1] --> default value +# ->[2] --> tlmgr name +# ->[3] --> tlmgr description + our %TLPDBOptions = ( "location" => - [ "u", + [ "u", "__MASTER__", "location", "Default installation location" ], "create_formats" => - [ "b", + [ "b", 1, "formats", "Create formats on installation" ], "desktop_integration" => - [ "b", + [ "b", 1, "desktop_integration", "Create shortcuts (menu and desktop) in postinst" ], "file_assocs" => - [ "n:0..2", + [ "n:0..2", 1, "fileassocs", "Change file associations in postinst" ], "post_code" => - [ "b", + [ "b", 1, "postcode", "Run postinst code blobs" ], "sys_bin" => - [ "p", + [ "p", "/usr/local/bin", "sys_bin", "Destination for symlinks for binaries" ], "sys_man" => - [ "p", + [ "p", "/usr/local/man", "sys_man", "Destination for symlinks for man pages" ], "sys_info" => - [ "p", + [ "p", "/usr/local/info", "sys_info", "Destination for symlinks for info docs" ], "install_docfiles" => - [ "b", + [ "b", 1, "docfiles", "Install documentation files" ], "install_srcfiles" => - [ "b", + [ "b", 1, "srcfiles", "Install source files" ], "w32_multi_user" => - [ "b", + [ "b", 1, "multiuser", "Install for shortcuts/menu items for all users (w32)" ], "autobackup" => - [ "n:-1..", + [ "n:-1..", 0, "autobackup", "Number of backups to keep" ], "backupdir" => - [ "p", + [ "p", "", "backupdir", - "Directory for backups" ] + "Directory for backups" ], ); diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index e91bea2620d..c9024d7e113 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -51,6 +51,8 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->config_revision; $tlpdb->options; $tlpdb->option($key, [$value]); + $tlpdb->reset_options(); + $tlpdb->add_default_options(); $tlpdb->settings; $tlpdb->setting($key, [$value]); $tlpdb->sizes_of_packages($opt_src, $opt_doc [, @packs ]); @@ -828,8 +830,8 @@ sub config_src_container { my $self = shift; if (defined($self->{'tlps'}{'00texlive.config'})) { foreach my $d ($self->{'tlps'}{'00texlive.config'}->depends) { - if ($d eq "container_split_src_files") { - return 1; + if ($d =~ m!^container_split_src_files/(.*)$!) { + return "$1"; } } } @@ -849,8 +851,8 @@ sub config_doc_container { my $self = shift; if (defined($self->{'tlps'}{'00texlive.config'})) { foreach my $d ($self->{'tlps'}{'00texlive.config'}->depends) { - if ($d eq "container_split_doc_files") { - return 1; + if ($d =~ m!^container_split_doc_files/(.*)$!) { + return "$1"; } } } @@ -1129,6 +1131,23 @@ sub setting { return $ret; } +sub reset_options { + my $self = shift; + for my $k (keys %TeXLive::TLConfig::TLPDBOptions) { + $self->option($k, $TeXLive::TLConfig::TLPDBOptions{$k}->[1]); + } +} + +sub add_default_options { + my $self = shift; + for my $k (keys %TeXLive::TLConfig::TLPDBOptions) { + # if the option is not set already, do set it to defaults + if (! $self->option($k) ) { + $self->option($k, $TeXLive::TLConfig::TLPDBOptions{$k}->[1]); + } + } +} + =pod =item C<< $tlpdb->options >> diff --git a/Master/tlpkg/bin/tl-update-tlpdb b/Master/tlpkg/bin/tl-update-tlpdb index 9b6b5c3c2eb..3b74e04f60d 100755 --- a/Master/tlpkg/bin/tl-update-tlpdb +++ b/Master/tlpkg/bin/tl-update-tlpdb @@ -179,6 +179,10 @@ sub create_tlpdb } if ($tlp->name eq "00texlive.config") { my @bar = $tlp->depends; + for my $k (keys %TeXLive::TLConfig::TLPDBConfigs) { + push @bar, "$k/" . $TeXLive::TLConfig::TLPDBConfigs{$k}; + } + # add the latest revision push @bar, "revision/".$tltree->revision; $tlp->depends (@bar); } @@ -189,6 +193,9 @@ sub create_tlpdb my @archs = $tltree->architectures; $tldb->setting("available_architectures", @archs); + # reset options to what we have by default + $tldb->add_default_options(); + return($tldb, $src_count); } diff --git a/Master/tlpkg/bin/tlpsrc2tlpdb b/Master/tlpkg/bin/tlpsrc2tlpdb index 59643fc2273..2281ddd3e75 100755 --- a/Master/tlpkg/bin/tlpsrc2tlpdb +++ b/Master/tlpkg/bin/tlpsrc2tlpdb @@ -124,6 +124,9 @@ sub main } if ($tlp->name eq "00texlive.config") { my @bar = $tlp->depends; + for my $k (keys %TeXLive::TLConfig::TLPDBConfigs) { + push @bar, "$k/" . $TeXLive::TLConfig::TLPDBConfigs{$k}; + } push @bar, "revision/".$tltree->revision; $tlp->depends (@bar); } diff --git a/Master/tlpkg/tlpsrc/00texlive.config.tlpsrc b/Master/tlpkg/tlpsrc/00texlive.config.tlpsrc index 90c05e5f3d9..7a8da4fbb31 100644 --- a/Master/tlpkg/tlpsrc/00texlive.config.tlpsrc +++ b/Master/tlpkg/tlpsrc/00texlive.config.tlpsrc @@ -7,9 +7,9 @@ longdesc appearance within the texlive.tlpdb. It is only on container level. longdesc The container_format/XXXXX specifies the format, currently allowed longdesc is only "xz", which generates .tar.xz files. zip can be supported. longdesc release/NNNN specifies the release number as used in the installer. +longdesc +longdesc These values are taken from TeXLive::TLConfig::TLPDBConfigs hash +longdesc at tlpdb creation time. +longdesc longdesc For information on the 00texlive prefix see longdesc 00texlive.installation(.tlpsrc) -depend container_split_src_files -depend container_split_doc_files -depend container_format/xz -depend release/2009 diff --git a/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc b/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc index 959ae99fb81..088fd2954ff 100644 --- a/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc +++ b/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc @@ -7,6 +7,14 @@ longdesc longdesc 2. on an installed system it serves as a configuration file. longdesc We have to remember these settings for additional package longdesc installation, removal, etc. +longdesc +longdesc In the tlpsrc itself only those options are saved that are used *ONLY* +longdesc at installation time, currently opt_paper, opt_path, opt_frozen. +longdesc These will longdesc be saved in the local tlpdb and will not be +longdesc accessible by tlmgr. +longdesc +longdesc All other options are set from TLConfig::TLPDBOptions to the +longdesc default values specified there. longdesc longdesc There are two types here: longdesc - If the key starts with opt_ this is an options that can be @@ -30,19 +38,8 @@ longdesc All packages starting with 00texlive are considered virtual packages longdesc in the sense that no containers are generated and these packages longdesc are never split into .src and .doc sub-packages in the tlpdb. -depend opt_location:__MASTER__ depend opt_paper:a4 -depend opt_create_formats:1 -depend opt_desktop_integration:1 -depend opt_file_assocs:1 -depend opt_post_code:1 -depend opt_w32_multi_user:1 depend opt_path:0 -depend opt_sys_bin:/usr/local/bin -depend opt_sys_info:/usr/local/info -depend opt_sys_man:/usr/local/man -depend opt_install_docfiles:1 -depend opt_install_srcfiles:1 # if we want to make a dist frozen uncomment that and tlmgr will bail out # telling that TLNNNN is frozen |