summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-04-17 08:50:52 +0000
committerNorbert Preining <preining@logic.at>2008-04-17 08:50:52 +0000
commit879ffd96ec3bdc67834400d7537e8e75754077e7 (patch)
treebab5b6e43761f0a7f2c49bd8e22ef525c10d6746 /Master
parent31774a928820b9ede1b2624558c3dc725d8985fc (diff)
add an option to change the default location
tlmgr default location http://.... git-svn-id: svn://tug.org/texlive/trunk@7467 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tl-package-manager.pl19
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm109
2 files changed, 118 insertions, 10 deletions
diff --git a/Master/texmf/scripts/texlive/tl-package-manager.pl b/Master/texmf/scripts/texlive/tl-package-manager.pl
index 0fda2b2f1c6..44467737210 100755
--- a/Master/texmf/scripts/texlive/tl-package-manager.pl
+++ b/Master/texmf/scripts/texlive/tl-package-manager.pl
@@ -11,6 +11,11 @@
# - (?) removal does not remove created format files from TEXMFSYSVAR
# - other features: dependency check?, ...?
# - improve search function
+# - list_archs and add_arch
+# - cmd
+# default <key> <value>
+# sets the options in texlive.tlpdb
+# done for location
my $Master;
@@ -130,6 +135,20 @@ if ($action =~ m/^generate$/i) {
}
# should we do some postinst actions?
exit(0);
+} elsif ($action =~ m/^default$/i) {
+ my $what = shift;
+ die("default needs at least one argument") unless defined($what);
+ 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;
+ } else {
+ warn "Setting other options currently not support, please edit texlive.tlpdb!";
+ }
+ exit(0);
} elsif ($action =~ m/^list$/i) {
my $what = shift;
if ($what =~ m/^collection/i) {
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index fc8d7b1ac58..857d4370b81 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -732,6 +732,28 @@ Need to be documented
=cut
+sub _set_option_value {
+ my ($self,$key,$value) = @_;
+ my $pkg = $self->{'tlps'}{'00texlive-installation.config'};
+ my @newdeps;
+ if (!defined($pkg)) {
+ my $pkg = new TeXLive::TLPOBJ;
+ $tlp->name("00texlive-installation.config");
+ $tlp->category("TLCore");
+ push @newdeps, "$key/$value";
+ } else {
+ foreach my $d ($pkg->depends) {
+ if ($d =~ m!^$key/!) {
+ push @newdeps, "$key/$value";
+ } else {
+ push @newdeps, $d;
+ }
+ }
+ }
+ $pkg->depends(@newdeps);
+ $self->{'tlps'}{'00texlive-installation.config'} = $pkg;
+}
+
sub _option_value {
my ($self,$key) = @_;
if (defined($self->{'tlps'}{'00texlive-installation.config'})) {
@@ -744,6 +766,33 @@ sub _option_value {
}
return;
}
+
+sub _set_option_setting {
+ my ($self,$key,$value) = @_;
+ my $pkg = $self->{'tlps'}{'00texlive-installation.config'};
+ my @newdeps;
+ if (!defined($pkg)) {
+ my $pkg = new TeXLive::TLPOBJ;
+ $tlp->name("00texlive-installation.config");
+ $tlp->category("TLCore");
+ if ($value) {
+ push @newdeps, "$key";
+ }
+ } else {
+ foreach my $d ($pkg->depends) {
+ if (($d =~ m!^$key$!) && (!$value)) {
+ # key is present, but we should clear it, so do nothing
+ } else {
+ # either the key is already present and we should set it (again) to on
+ # or it is something else
+ push @newdeps, $d;
+ }
+ }
+ }
+ $pkg->depends(@newdeps);
+ $self->{'tlps'}{'00texlive-installation.config'} = $pkg;
+}
+
sub _option_setting {
my ($self,$key) = @_;
if (defined($self->{'tlps'}{'00texlive-installation.config'})) {
@@ -757,16 +806,56 @@ sub _option_setting {
return;
}
-sub option_symlinks { my $self = shift; return $self->_option_setting("symlinks"); }
-sub option_docfiles { my $self = shift; return $self->_option_setting("docfiles"); }
-sub option_srcfiles { my $self = shift; return $self->_option_setting("srcfiles"); }
-sub option_formats { my $self = shift; return $self->_option_setting("formats"); }
-sub option_letter { my $self = shift; return $self->_option_setting("letter"); }
-sub option_location { my $self = shift; return $self->_option_value("location"); }
-sub option_sys_bin { my $self = shift; return $self->_option_value("sys_bin"); }
-sub option_sys_man { my $self = shift; return $self->_option_value("sys_man"); }
-sub option_sys_info { my $self = shift; return $self->_option_value("sys_info"); }
-sub option_platform { my $self = shift; return $self->_option_value("platform"); }
+sub option_symlinks {
+ my $self = shift;
+ if (@_) { $self->_set_option_setting("symlinks", shift); }
+ return $self->_option_setting("symlinks");
+}
+sub option_docfiles {
+ my $self = shift;
+ if (@_) { $self->_set_option_setting("docfiles", shift); }
+ return $self->_option_setting("docfiles");
+}
+sub option_srcfiles {
+ my $self = shift;
+ if (@_) { $self->_set_option_setting("srcfiles", shift); }
+ return $self->_option_setting("srcfiles");
+}
+sub option_formats {
+ my $self = shift;
+ if (@_) { $self->_set_option_setting("formats", shift); }
+ return $self->_option_setting("formats");
+}
+sub option_letter {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("letter", shift); }
+ return $self->_option_setting("letter");
+}
+sub option_location {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("location", shift); }
+ return $self->_option_value("location");
+}
+sub option_sys_bin {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("sys_bin", shift); }
+ return $self->_option_value("sys_bin");
+}
+sub option_sys_man {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("sys_man", shift); }
+ return $self->_option_value("sys_man");
+}
+sub option_sys_info {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("sys_info", shift); }
+ return $self->_option_value("sys_info");
+}
+sub option_platform {
+ my $self = shift;
+ if (@_) { $self->_set_option_value("platform", shift); }
+ return $self->_option_value("platform");
+}
=pod