summaryrefslogtreecommitdiff
path: root/Master/tlpkg/etc/dev.usermode-tlmgr.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/etc/dev.usermode-tlmgr.patch')
-rw-r--r--Master/tlpkg/etc/dev.usermode-tlmgr.patch206
1 files changed, 206 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/dev.usermode-tlmgr.patch b/Master/tlpkg/etc/dev.usermode-tlmgr.patch
new file mode 100644
index 00000000000..3d3aa4f7519
--- /dev/null
+++ b/Master/tlpkg/etc/dev.usermode-tlmgr.patch
@@ -0,0 +1,206 @@
+Index: tlpkg/TeXLive/TLConfig.pm
+===================================================================
+--- tlpkg/TeXLive/TLConfig.pm (revision 14488)
++++ tlpkg/TeXLive/TLConfig.pm (working copy)
+@@ -162,11 +162,13 @@
+
+ our %TLPDBSettingType = (
+ "platform" => "s",
+- "available_architectures" => "l"
++ "available_architectures" => "l",
++ "usertree" => "b"
+ );
+ our %TLPDBSettingDesc = (
+ "platform" => "Main platform for this computer",
+- "available_architectures" => "All available/installed architectures"
++ "available_architectures" => "All available/installed architectures",
++ "usertree" => "This tree acts as user tree"
+ );
+
+
+Index: tlpkg/TeXLive/TLMedia.pm
+===================================================================
+--- tlpkg/TeXLive/TLMedia.pm (revision 14488)
++++ tlpkg/TeXLive/TLMedia.pm (working copy)
+@@ -48,6 +48,8 @@
+ }
+ if (-d "$location/texmf/web2c") {
+ $media = 'DVD';
++ } elsif (-d "$location/web2c") {
++ $media = 'DVD';
+ } elsif (-d "$location/$Archive") {
+ $media = 'CD';
+ } else {
+@@ -142,6 +144,7 @@
+ my $opt_doc = $totlpdb->option("install_docfiles");
+ my $real_opt_doc = $opt_doc;
+ my $reloc = 1 if $tlpobj->relocated;
++ $reloc = 0 if $totlpdb->setting("usertree");
+ my $container;
+ my @installfiles;
+ my $location = $self->location;
+@@ -235,7 +238,7 @@
+ }
+ # if a package is relocatable we have to cancel the reloc prefix
+ # before we save it to the local tlpdb
+- if ($tlpobj->relocated) {
++ if ($reloc) {
+ $tlpobj->cancel_reloc_prefix;
+ }
+ # we have to write out the tlpobj file since it is contained in the
+@@ -388,6 +391,7 @@
+ my ($self, $pkg, $nopostinstall) = @_;
+ my $localtlpdb = $self->tlpdb;
+ my $tlp = $localtlpdb->get_package($pkg);
++ my $usertree = $localtlpdb->setting("usertree");
+ if (!defined($tlp)) {
+ tlwarn ("$pkg: package not present, cannot remove\n");
+ } else {
+@@ -413,9 +417,14 @@
+ # in user mode we just remove the prefix, in normal mode we
+ # replace it with texmf-dist
+ # since we don't have user mode
++
+ if ($tlp->relocated) {
+ for (@files) {
+- s:^$RelocPrefix/:$RelocTree/:;
++ if ($usertree) {
++ s:^$RelocPrefix/::;
++ } else {
++ s:^$RelocPrefix/:$RelocTree/:;
++ }
+ }
+ }
+ #
+Index: texmf/scripts/texlive/tlmgr.pl
+===================================================================
+--- texmf/scripts/texlive/tlmgr.pl (revision 14493)
++++ texmf/scripts/texlive/tlmgr.pl (working copy)
+@@ -125,6 +125,8 @@
+ "machine-readable" => 1,
+ "package-logfiles" => "=s",
+ "pause" => 1,
++ "usermode" => 1,
++ "usertree" => "=s",
+ "version" => 1,
+ "help|h|?" => 1);
+
+@@ -287,13 +289,30 @@
+ pod2usage(-msg => $msg, -exitstatus => 1, -verbose => 1, @noperldoc);
+ }
+
++ #
++ # the main tree we will be working on
++ $::maintree = $Master;
++ if ($opts{"usermode"}) {
++ # we could also try to detect that we don't have write permissions
++ # and switch to user mode automatically
++ if (defined($opts{"usertree"})) {
++ $::maintree = $opts{"usertree"};
++ } else {
++ chomp($::maintree = `kpsewhich -var-value TEXMFHOME`);
++ }
++ }
++
+ # 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
+ $packagelogged = 0; # how many msgs we logged
+ chomp (my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`);
+ $packagelogfile = $opts{"package-logfile"};
+- $packagelogfile ||= "$texmfsysvar/web2c/tlmgr.log";
++ if ($opts{"usermode"}) {
++ $packagelogfile ||= "$::maintree/web2c/tlmgr.log";
++ } else {
++ $packagelogfile ||= "$texmfsysvar/web2c/tlmgr.log";
++ }
+ #
+ # Try to open the packagelog file, but do NOT die when that does not work
+ if (!open(PACKAGELOG, ">>$packagelogfile")) {
+@@ -416,6 +435,9 @@
+ } elsif ($action =~ m/^show$/i) {
+ action_show();
+ finish(0);
++ } elsif ($action =~ m/^init-usertree$/i) {
++ action_init_usertree();
++ finish(0);
+ } elsif ($action =~ m/^remove$/i) {
+ action_remove();
+ } elsif ($action =~ /^paper$/) {
+@@ -1988,16 +2010,18 @@
+ $opts{"no-depends"} = 1 if $opts{"no-depends-at-all"};
+ init_tlmedia();
+
+- # check for updates to tlmgr itself, and die unless --force is given
+- if (check_for_critical_updates( $localtlpdb, $tlmediatlpdb)) {
+- if ($opts{"force"}) {
+- tlwarn("Continuing due to --force\n");
+- } else {
+- if ($::gui_mode) {
+- # return here and don't do any updates
+- return;
++ if (!$opts{"usermode"}) {
++ # check for updates to tlmgr itself, and die unless --force is given
++ if (check_for_critical_updates( $localtlpdb, $tlmediatlpdb)) {
++ if ($opts{"force"}) {
++ tlwarn("Continuing due to --force\n");
+ } else {
+- die "tlmgr: Not continuing, please see warning above!\n";
++ if ($::gui_mode) {
++ # return here and don't do any updates
++ return;
++ } else {
++ die "tlmgr: Not continuing, please see warning above!\n";
++ }
+ }
+ }
+ }
+@@ -3119,6 +3143,34 @@
+
+
+ #
++# action init_user_tree
++# sets up TEXMFHOME or --usertree argument for user mode tlmgr
++# by creating a minimal tlpdb
++#
++sub action_init_usertree {
++ init_local_db();
++ my $tlpdb = TeXLive::TLPDB->new;
++ my $usertree;
++ if ($opts{"usertree"}) {
++ $usertree = $opts{"usertree"};
++ } else {
++ chomp($usertree = `kpsewhich -var-value TEXMFHOME`);
++ }
++ $tlpdb->root($usertree);
++ my $inst = TeXLive::TLPOBJ->new;
++ $inst->name("00texlive.installation");
++ $inst->category("TLCore");
++ my @deps;
++ push @deps, "opt_location:$location";
++ push @deps, "setting_available_architectures:";
++ push @deps, "setting_usertree:1";
++ $inst->depends(@deps);
++ $tlpdb->add_tlpobj($inst);
++ $tlpdb->save;
++}
++
++
++#
+ # action conf
+ # tries to mimick texconfig conf but probably will add some more things
+ #
+@@ -3182,10 +3234,10 @@
+ # stuff changed via the GUI
+ return if defined $localtlmedia;
+ return if defined $localtlpdb;
+- $localtlmedia = TeXLive::TLMedia->new ( $Master );
+- die("cannot setup TLMedia in $Master") unless (defined($localtlmedia));
++ $localtlmedia = TeXLive::TLMedia->new ( $::maintree );
++ die("cannot setup TLMedia in $::maintree") unless (defined($localtlmedia));
+ $localtlpdb = $localtlmedia->tlpdb;
+- die("cannot find tlpdb in $Master") unless (defined($localtlpdb));
++ die("cannot find tlpdb in $::maintree") unless (defined($localtlpdb));
+ # setup the programs, for w32 we need the shipped wget/xz etc, so we
+ # pass the location of these files to setup_programs.
+ if (!setup_programs("$Master/tlpkg/installer", $localtlmedia->platform)) {