diff options
-rw-r--r-- | Master/tlpkg/etc/allow_packages_to_be_relocatable.patch | 247 |
1 files changed, 164 insertions, 83 deletions
diff --git a/Master/tlpkg/etc/allow_packages_to_be_relocatable.patch b/Master/tlpkg/etc/allow_packages_to_be_relocatable.patch index b0b1a296984..fab704c0fec 100644 --- a/Master/tlpkg/etc/allow_packages_to_be_relocatable.patch +++ b/Master/tlpkg/etc/allow_packages_to_be_relocatable.patch @@ -1,73 +1,55 @@ -Index: bin/tl-update-containers +Index: tlpkg/TeXLive/TLConfig.pm =================================================================== ---- bin/tl-update-containers (revision 12901) -+++ bin/tl-update-containers (working copy) -@@ -43,6 +43,7 @@ - "location=s" => \$opt_location, - "no-setup" => \$opt_nosetup, - "recreate" => \$opt_recreate, -+ "relative" => \$opt_relative, - "version" => \$opt_version, - "help|?" => \$opt_help) or pod2usage(1); +--- tlpkg/TeXLive/TLConfig.pm (revision 12901) ++++ tlpkg/TeXLive/TLConfig.pm (working copy) +@@ -30,6 +30,7 @@ + @CriticalPackagesList + @AllowedConfigOptions + $WindowsMainMenuName ++ $RelocPrefix + ); + @EXPORT = @EXPORT_OK; + } +@@ -65,11 +66,13 @@ + our $TeXLiveServerURL = "http://mirror.ctan.org"; + our $TeXLiveServerPath = "systems/texlive/tlnet/$ReleaseYear"; + our $TeXLiveURL = "$TeXLiveServerURL/$TeXLiveServerPath"; ++our $RelocPrefix = "texmf-dist"; + + our $WinSpecialUpdatePackagesRegexp = + '^(texlive\.infra|bin-tlperl\.win32$|bin-texlive)'; + -@@ -235,14 +236,24 @@ - debug("updating $pkg containers ...\n"); - # we have to make a copy otherwise the src/doc files in the original - # tlpobj are removed, and thus also in the tlpdb to be saved!!! + - my $objcopy = $obj->copy; + our @CriticalPackagesList = qw/texlive.infra bin-texlive/; + push(@CriticalPackagesList, "bin-tlperl.win32") if ($^O=~/^MSWin(32|64)$/i); + +@@ -175,6 +178,10 @@ + + A list of a config options that can be set in 00texlive.installation. + ++=item C<$TeXLive::TLConfig::RelocPrefix> + -+ # if we try to create relative containers we check the package -+ # for residing only in texmf-dist, and being relocatable -+ # TLPOBJ->common_texmf_tree returns the string of the -+ # common temxf tree or undefined, so we can use it in && -+ my $ctt = $objcopy->common_texmf_tree; -+ my $do_relative = $opt_relative && # user option -+ $ctt && # see above -+ ($ctt eq "texmf-dist"); # only for texmf-dist - if ($srcsplit) { - if (!$opt_dry) { - my $objsrc = $obj->srcfiles_package; - $objcopy->clear_srcfiles; - if ($objsrc) { - my ($s,$m) = $objsrc->make_container($type, $Master, $opt_containerdir, -- "$pkg.source", $opt_relative); -+ "$pkg.source", $do_relative); - if ($s > 0) { - # something was created - # important, we have to add it to the original $obj -@@ -266,7 +277,7 @@ - $objcopy->clear_docfiles; - if ($objdoc) { - my ($s,$m) = $objdoc->make_container($type, $Master, -- $opt_containerdir, "$pkg.doc", $opt_relative); -+ $opt_containerdir, "$pkg.doc", $do_relative); - if ($s > 0) { - # something was created - $obj->doccontainersize($s); -@@ -285,7 +296,7 @@ - } - if (!$opt_dry) { - my ($s,$m) = $objcopy->make_container($type, $Master, $opt_containerdir, -- $pkg, $opt_relative); -+ $pkg, $do_relative); - if ($s > 0) { - $obj->containersize($s); - } -@@ -293,6 +304,8 @@ - $obj->containermd5($m); - } - } -+ # if the container has been build relocatable we save that information -+ $obj->relocated($do_relative); - # add the updated (or new) TLPOBJ to NET TLPDB - # that way the other container sizes are not destroyed - $nettlpdb->add_tlpobj($obj) unless $opt_dry; -Index: TeXLive/TLPOBJ.pm ++the texmf-tree name that can be relocated. ++ + =back + + =head1 SEE ALSO +Index: tlpkg/TeXLive/TLPOBJ.pm =================================================================== ---- TeXLive/TLPOBJ.pm (revision 12901) -+++ TeXLive/TLPOBJ.pm (working copy) -@@ -22,6 +22,7 @@ +--- tlpkg/TeXLive/TLPOBJ.pm (revision 12901) ++++ tlpkg/TeXLive/TLPOBJ.pm (working copy) +@@ -6,7 +6,8 @@ + + package TeXLive::TLPOBJ; + +-use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp $MetaCategoriesRegexp $InfraLocation); ++use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp ++ $MetaCategoriesRegexp $InfraLocation $RelocPrefix); + use TeXLive::TLUtils; + use TeXLive::TLTREE; + +@@ -22,6 +23,7 @@ shortdesc => $params{'shortdesc'}, longdesc => $params{'longdesc'}, catalogue => $params{'catalogue'}, @@ -75,7 +57,7 @@ Index: TeXLive/TLPOBJ.pm runfiles => defined($params{'runfiles'}) ? $params{'runfiles'} : [], runsize => $params{'runsize'}, srcfiles => defined($params{'srcfiles'}) ? $params{'srcfiles'} : [], -@@ -165,6 +166,10 @@ +@@ -165,6 +167,10 @@ $self->{'category'} = "$1"; $lastcmd = "category"; next; @@ -86,7 +68,7 @@ Index: TeXLive/TLPOBJ.pm } elsif ($line =~ /^revision\s+(.*)\s*/o) { $self->{'revision'} = "$1"; $lastcmd = "revision"; -@@ -305,6 +310,7 @@ +@@ -305,6 +311,7 @@ defined($self->{'catalogue'}) && print $fd "catalogue $self->{'catalogue'}\n"; defined($self->{'shortdesc'}) && print $fd "shortdesc $self->{'shortdesc'}\n"; defined($self->{'license'}) && print $fd "license $self->{'license'}\n"; @@ -94,10 +76,25 @@ Index: TeXLive/TLPOBJ.pm # ugly hack to get rid of use FileHandle; see man perlform #format_name $fd "multilineformat"; select((select($fd),$~ = "multilineformat")[0]); -@@ -432,6 +438,22 @@ +@@ -432,6 +439,37 @@ } } ++sub cancel_common_texmf_tree { ++ my $self = shift; ++ my @docfiles = $self->docfiles; ++ for (@docfiles) { s:^$RelocPrefix/::; } ++ $self->docfiles(@docfiles); ++ my @runfiles = $self->runfiles; ++ for (@runfiles) { s:^$RelocPrefix/::; } ++ $self->runfiles(@runfiles); ++ my @srcfiles = $self->srcfiles; ++ for (@srcfiles) { s:^$RelocPrefix/::; } ++ $self->srcfiles(@srcfiles); ++ # if there are bin files they have definitely NOT the ++ # texmf-dist prefix, so we cannot cancel it anyway ++} ++ +sub common_texmf_tree { + my $self = shift; + my $tltree; @@ -117,7 +114,7 @@ Index: TeXLive/TLPOBJ.pm sub make_container { my ($self,$type,$instroot,$destdir,$containername,$relative) = @_; -@@ -441,30 +463,18 @@ +@@ -441,30 +479,18 @@ if (!defined($containername)) { $containername = $self->name; } @@ -153,7 +150,7 @@ Index: TeXLive/TLPOBJ.pm } my @nf; map { s@^$tltree/@@ ; push @nf, $_; } @files; -@@ -895,6 +905,11 @@ +@@ -895,6 +921,11 @@ if (@_) { $self->{'revision'} = shift } return $self->{'revision'}; } @@ -165,7 +162,7 @@ Index: TeXLive/TLPOBJ.pm sub catalogue { my $self = shift; if (@_) { $self->{'catalogue'} = shift } -@@ -1089,9 +1104,11 @@ +@@ -1089,9 +1120,11 @@ only differences are that the various C<*pattern> keys are invalid, and instead there are the respective C<*files> keys described below. Furthermore some more I<keys> is allowed: C<revision> which specifies the maximum of @@ -179,7 +176,7 @@ Index: TeXLive/TLPOBJ.pm All these keys have in common that they are followed by a list of files I<indented> by one space. They differ only in the first line itself -@@ -1264,6 +1281,12 @@ +@@ -1264,6 +1297,12 @@ debugging function for comparison with C<tpm>/C<tlps>, will go away. @@ -192,15 +189,15 @@ Index: TeXLive/TLPOBJ.pm =item C<make_container($type,$instroot[, $destdir[, $containername[, $relative]]])> creates a container file of the all files in the C<TLPOBJ> -Index: TeXLive/TLMedia.pm +Index: tlpkg/TeXLive/TLMedia.pm =================================================================== ---- TeXLive/TLMedia.pm (revision 12901) -+++ TeXLive/TLMedia.pm (working copy) +--- tlpkg/TeXLive/TLMedia.pm (revision 12901) ++++ tlpkg/TeXLive/TLMedia.pm (working copy) @@ -117,6 +117,7 @@ # even if opt_doc is false $real_opt_doc = 1; } -+ my $reloc = $tlpobj->relocated; ++ my $reloc = 1 if $tlpobj->relocated; my $container; my @installfiles; my $location = $self->location; @@ -237,20 +234,27 @@ Index: TeXLive/TLMedia.pm my $media = $self->media; my $target = $totlpdb->root; -@@ -255,6 +256,9 @@ +@@ -255,6 +256,8 @@ } elsif ($what =~ m,\.tar(\.xz)?$,) { my $type = defined($1) ? "xz" : "tar"; -+ # if we are working on an relocated package we adjust the target -+ $target .= "/texmf-dist" if $reloc; ++ $target .= "/$TeXLive::TLConfig::RelocPrefix" if $reloc; + # this is the case when we install from CD or the NET, or a backup # # in all other cases we create temp files .tar.xz (or use the present -Index: TeXLive/TLUtils.pm +@@ -365,6 +368,7 @@ + my @goodfiles = (); + my @badfiles = (); + for my $f (@files) { ++ # in usermode we have to add texmf-dist again for comparison + if (defined($allfiles{$f})) { + # this file should be removed but is mentioned somewhere, too + push @badfiles, $f; +Index: tlpkg/TeXLive/TLUtils.pm =================================================================== ---- TeXLive/TLUtils.pm (revision 12901) -+++ TeXLive/TLUtils.pm (working copy) +--- tlpkg/TeXLive/TLUtils.pm (revision 12901) ++++ tlpkg/TeXLive/TLUtils.pm (working copy) @@ -950,6 +950,7 @@ my $starttime = time(); foreach my $package (@packs) { @@ -317,8 +321,85 @@ Index: TeXLive/TLUtils.pm # one), xzdec them, and then call tar + # if we are unpacking a relocated container we adjust the target -+ $target .= "/texmf-dist" if $reloc; ++ $target .= "/$TeXLive::TLConfig::RelocPrefix" if $reloc; + my $fn = basename($what); mkdirhier("$target/temp"); my $xzfile = "$target/temp/$fn"; +Index: tlpkg/bin/tl-update-containers +=================================================================== +--- tlpkg/bin/tl-update-containers (revision 12901) ++++ tlpkg/bin/tl-update-containers (working copy) +@@ -43,6 +43,7 @@ + "location=s" => \$opt_location, + "no-setup" => \$opt_nosetup, + "recreate" => \$opt_recreate, ++ "relative" => \$opt_relative, + "version" => \$opt_version, + "help|?" => \$opt_help) or pod2usage(1); + +@@ -235,14 +236,34 @@ + debug("updating $pkg containers ...\n"); + # we have to make a copy otherwise the src/doc files in the original + # tlpobj are removed, and thus also in the tlpdb to be saved!!! ++ + my $objcopy = $obj->copy; ++ ++ # if we try to create relative containers we check the package ++ # for residing only in texmf-dist, and being relocatable, and ++ # not having a dependency on $pkg.ARCH ++ # TLPOBJ->common_texmf_tree returns the string of the ++ # common temxf tree or undefined, so we can use it in && ++ my $ctt = $objcopy->common_texmf_tree; ++ my $deps_on_arch = 0; ++ for ($objcopy->depends) { ++ if (m/^$pkg\.ARCH$/) { ++ $deps_on_arch = 1; ++ last; ++ } ++ } ++ my $do_relative = $opt_relative && # user option ++ !$deps_on_arch && # no $pkg.ARCH dep ++ $ctt && # see above ++ ($ctt eq $TeXLive::TLConfig::RelocPrefix); ++ # only for texmf-dist + if ($srcsplit) { + if (!$opt_dry) { + my $objsrc = $obj->srcfiles_package; + $objcopy->clear_srcfiles; + if ($objsrc) { + my ($s,$m) = $objsrc->make_container($type, $Master, $opt_containerdir, +- "$pkg.source", $opt_relative); ++ "$pkg.source", $do_relative); + if ($s > 0) { + # something was created + # important, we have to add it to the original $obj +@@ -266,7 +287,7 @@ + $objcopy->clear_docfiles; + if ($objdoc) { + my ($s,$m) = $objdoc->make_container($type, $Master, +- $opt_containerdir, "$pkg.doc", $opt_relative); ++ $opt_containerdir, "$pkg.doc", $do_relative); + if ($s > 0) { + # something was created + $obj->doccontainersize($s); +@@ -285,7 +306,7 @@ + } + if (!$opt_dry) { + my ($s,$m) = $objcopy->make_container($type, $Master, $opt_containerdir, +- $pkg, $opt_relative); ++ $pkg, $do_relative); + if ($s > 0) { + $obj->containersize($s); + } +@@ -293,6 +314,10 @@ + $obj->containermd5($m); + } + } ++ # if the container has been build relocatable we save that information ++ $obj->relocated($do_relative); ++ # and remove the common prefix from the files in the tlpobj ++ $obj->cancel_common_texmf_tree; + # add the updated (or new) TLPOBJ to NET TLPDB + # that way the other container sizes are not destroyed + $nettlpdb->add_tlpobj($obj) unless $opt_dry; |