From 39cf7125fb062849d46801254cec30e6216a0b20 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 16 Nov 2007 12:18:08 +0000 Subject: implement relative package building relative packages are ready to be unpacked INTO a texmf tree, i.e. the leading path component has been removed. In this case the tlpobj file is placed into the root of the container git-svn-id: svn://tug.org/texlive/trunk@5471 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 50 +++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 0a3b47e8daa..3ef9f305ae0 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -357,7 +357,7 @@ sub writeout_simple { } sub make_container { - my ($self,$type,$instroot,$destdir,$containername) = @_; + my ($self,$type,$instroot,$destdir,$containername,$relative) = @_; if (not(defined($containername))) { $containername = $self->name; } @@ -366,18 +366,18 @@ sub make_container { } die("Undefined instroot argument!") if (not(defined($instroot))); # first build the arch independent part - $self->_make_container($type,$instroot,$destdir,$containername,"all"); + $self->_make_container($type,$instroot,$destdir,$containername,$relative,"all"); # now the $pkg.$arch.zip if ($self->is_arch_dependent) { foreach my $t (keys %{$self->{'binfiles'}}) { &TeXLive::TLUtils::debug("arch=$t"); - $self->_make_container($type,$instroot,$destdir,"$containername.$t",$t); + $self->_make_container($type,$instroot,$destdir,"$containername.$t",$relative,$t); } } } sub _make_container { - my ($self,$type,$instroot,$destdir,$containername,$arch) = @_; + my ($self,$type,$instroot,$destdir,$containername,$relative,$arch) = @_; my @files = (); my $compresscmd; my $tlpobjdir = "$InfraLocation/tlpobj"; @@ -404,6 +404,23 @@ sub _make_container { &TeXLive::TLUtils::debug("Not creating empty container file for $containername"); return; } + # we do relative packages ONLY if the files do NOT span multiple + # texmf trees. check this here + my $tltree; + if ($relative) { + foreach (@files) { + my $tmp; + ($tmp) = split m@/@; + if (defined($tltree) && ($tltree ne $tmp)) { + die "Not generating relative package for multiple tree spanning packages!\n"; + } else { + $tltree = $tmp; + } + } + my @nf; + map { s@^$tltree/@@ ; push @nf, $_; } @files; + @files = @nf; + } my $cwd = &getcwd; if ("$destdir" !~ m@^/@) { # we have an relative containerdir, so we have to make it absolute @@ -411,6 +428,12 @@ sub _make_container { } &mkpath("$destdir") if (! -d "$destdir"); chdir($instroot); + # in the relative case we have to chdir to the respective tltree + # and put the tlpobj into the root! + if ($relative) { + chdir("./$tltree"); + $tlpobjdir = "."; + } if ($arch eq "all") { # we add the .tlpobj into the .tlpobj directory my $removetlpobjdir = 0; @@ -423,12 +446,13 @@ sub _make_container { close(TMP); push @files, "$tlpobjdir/$self->{'name'}.tlpobj"; } + print "name=$containername\n"; if ($type eq "zip") { - $zipname .= ".zip"; + $containername .= ".zip"; if ($^O =~ /MSWin32/) { - $compresscmd = "| zip -9\@or $destdir/$zipname > $nul" + $compresscmd = "| zip -9\@or $destdir/$containername > $nul" } else { - $compresscmd = "| zip -9\@ory $destdir/$zipname > $nul" + $compresscmd = "| zip -9\@ory $destdir/$containername > $nul" } } elsif ($type eq "lzma") { $containername .= ".tar.lzma"; @@ -918,7 +942,7 @@ or the filehandle if given: debugging function for comparison with C/C, will go away. -=item C +=item C creates a container file of the arch B files in the C in C<$destdir> (if not defined then C<< TLPOBJ->containerdir >> is used). @@ -943,6 +967,16 @@ contain this tlpobj file, while C<$containername.$arch.$extension> does NOT. The argument C<$instroot> specifies the root of the installation from which the files should be taken. +If the argument C<$relative> is present and true (perlish true) AND the +packages does not span multiple texmf trees (i.e., all the first path +components of all files are the same) then a relative packages is created, +i.e., the first path component is stripped. In this case the tlpobj file +is placed into the root of the installation. + +This is used to distribute packages which can be installed in any arbitrary +texmf tree (of other distributions, too). + + =item C recomputes the sizes based on the information present in C<$tltree>. -- cgit v1.2.3