From 2e81e510ea1340812a752b7a3d854789f9a79398 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 30 Jul 2009 16:33:57 +0000 Subject: work on user mode tlmgr, currently install and remove does actually work git-svn-id: svn://tug.org/texlive/trunk@14494 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/doc/tlmgr-usermode-specification.txt | 24 ++- Master/tlpkg/etc/dev.usermode-tlmgr.patch | 206 ++++++++++++++++++++++ 2 files changed, 225 insertions(+), 5 deletions(-) create mode 100644 Master/tlpkg/etc/dev.usermode-tlmgr.patch (limited to 'Master') diff --git a/Master/tlpkg/doc/tlmgr-usermode-specification.txt b/Master/tlpkg/doc/tlmgr-usermode-specification.txt index 7647bf50566..ee536348266 100644 --- a/Master/tlpkg/doc/tlmgr-usermode-specification.txt +++ b/Master/tlpkg/doc/tlmgr-usermode-specification.txt @@ -1,6 +1,9 @@ Using the TeX Live Manager in Usermode ====================================== (to be discussed and implemented) +(partial implementation working for install and remove is in + tlpkg/dev/dev.usermode-tlmgr.patch) + 0. Contents ----------- @@ -14,6 +17,17 @@ Using the TeX Live Manager in Usermode --------------------------------------------------------------- +0.1 Implementation notes +------------------------ + +- User has to first call + tlmgr init-usertree [ --usertree .... ] +- available_architectures is set to the empty list, this allows + updating packages depending on .ARCH packages, but I am not sure + if that is a good idea + +--------------------------------------------------------------- + 1. Rationale and definition --------------------------- @@ -79,14 +93,14 @@ As an example: shortdesc ... ... docfiles size=98 - doc/latex/12many/12many.pdf - doc/latex/12many/README + RELOC/doc/latex/12many/12many.pdf + RELOC/doc/latex/12many/README ... srcfiles size=6 - source/latex/12many/12many.dtx - source/latex/12many/12many.ins + RELOC/source/latex/12many/12many.dtx + RELOC/source/latex/12many/12many.ins runfiles size=1 - tex/latex/12many/12many.sty + RELOC/tex/latex/12many/12many.sty ... The normal installation procedure of TeX Live (i.e., currently 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)) { -- cgit v1.2.3