diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 2d20c35e31e..96f954ba923 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -6,7 +6,7 @@ package TeXLive::TLPOBJ; -use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp $MetaCategoriesRegexp); +use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp $MetaCategoriesRegexp $InfraLocation); use TeXLive::TLUtils; use File::Path; use Cwd; @@ -356,37 +356,46 @@ sub writeout_simple { } } +sub make_packagecontainer { + my ($self,$type,$instroot,$destdir,$zipname) = @_; + if ($type eq "zip") { + $self->make_zip($instroot,$destdir,$zipname); + return 0; + } + if ($type eq "lzma") { + warn("not implemented yet: lzma compression!\n"); + return 1; + } + die("Container method $type unknown!\n"); +} + sub make_zip { - my ($self,$instroot,$destdir,$zipname) = @_; + my ($self,$type,$instroot,$destdir,$zipname) = @_; my $zipn; if (not(defined($zipname))) { - $zipname = $self->name . ".zip"; + $zipname = $self->name; } if (not(defined($destdir))) { $destdir = TeXLive::TLPOBJ->zipdir; } die("Undefined instroot argument!") if (not(defined($instroot))); # first build the arch independent part - $self->_make_zip($instroot,$destdir,$zipname,"all"); + $self->_make_zip($type,$instroot,$destdir,$zipname,"all"); # now the $pkg.$arch.zip if ($self->is_arch_dependent) { foreach my $t (keys %{$self->{'binfiles'}}) { &TeXLive::TLUtils::debug("arch=$t"); - if ($zipname =~ /^(.*)\.zip$/) { - $zipn = "$1.$t.zip"; - } else { - $zipn = "$zipname.$t.zip"; - } - $self->_make_zip($instroot,$destdir,$zipn,$t); + $self->_make_zip($type,$instroot,$destdir,"$zipname.$t",$t); } } } sub _make_zip { - my ($self,$instroot,$destdir,$zipname,$arch) = @_; + my ($self,$type,$instroot,$destdir,$zipname,$arch) = @_; my @files = (); my $zipcmd; + my $tlpobjdir = "$InfraLocation/tlpobj"; if ($arch ne "all") { push @files, @{$self->{'binfiles'}{$arch}}; } else { @@ -402,14 +411,12 @@ sub _make_zip { # } if ($^O =~ /MSWin32/) { $nul = "nul"; - $zipcmd = "| zip -9\@or " } else { $nul = "/dev/null"; - $zipcmd = "| zip -9\@ory " } @files = TeXLive::TLUtils::sort_uniq(@files); if (!@files) { - &TeXLive::TLUtils::debug("Not creating empty zip file $zipname"); + &TeXLive::TLUtils::debug("Not creating empty container file for $zipname"); return; } my $cwd = &getcwd; @@ -422,18 +429,31 @@ sub _make_zip { if ($arch eq "all") { # we add the .tlpobj into the .tlpobj directory my $removetlpobjdir = 0; - if (! -d ".tlpobj") { - &mkpath(".tlpobj"); + if (! -d "$tlpobjdir") { + &mkpath("$tlpobjdir"); $removetlpobjdir = 1; } - open(TMP,">.tlpobj/$self->{'name'}.tlpobj") or die "Cannot create .tlpobj/$self->{'name'}.tlpobj"; + open(TMP,">$tlpobjdir/$self->{'name'}.tlpobj") or die "Cannot create $tlpobjdir/$self->{'name'}.tlpobj"; $self->writeout(\*TMP); close(TMP); - push @files, ".tlpobj/$self->{'name'}.tlpobj"; + push @files, "$tlpobjdir/$self->{'name'}.tlpobj"; + } + if ($type eq "zip") { + $zipname .= ".zip"; + if ($^O =~ /MSWin32/) { + $zipcmd = "| zip -9\@or $destdir/$zipname > $nul" + } else { + $zipcmd = "| zip -9\@ory $destdir/$zipname > $nul" + } + } elsif ($type eq "lzma") { + $zipname .= ".tar.lzma"; + $zipcmd = "| tar --create --files-from=- | lzma -c > $destdir/$zipname "; + } else { + die("Container method $type unknown!\n"); } unlink($zipname); - print $zipcmd . "$destdir/$zipname" . " > $nul\n" if ($::opt_debug); - open ZIP, $zipcmd . "$destdir/$zipname" . " > $nul"; + print "$zipcmd\n" if ($::opt_debug); + open ZIP, $zipcmd ; map { if (! -f $_) { print STDERR "!!!Error: non-existent $_\n"; @@ -444,8 +464,8 @@ sub _make_zip { close ZIP; if ($arch eq "all") { # cleaning up - unlink(".tlpobj/$self->{'name'}.tlpobj"); - rmdir(".tlpobj") if $removetlpobjdir; + unlink("$tlpobjdir/$self->{'name'}.tlpobj"); + rmdir("$tlpobjdir") if $removetlpobjdir; } chdir($cwd); print "Done $zipname\n" if ($::opt_debug); @@ -925,7 +945,7 @@ all archs containing B<only> the binfiles are created, and the zipfile name is C<$zipname.$arch.zip> All the arch independent zip files B<also> contain the respective -C<TLPOBJ> file in C<.tlpobj/$name.tlpobj> so C<$zipname.zip> does +C<TLPOBJ> file in C<tlpkg/tlpobj/$name.tlpobj> so C<$zipname.zip> does contain this tlpobj file, while C<$zipname.$arch.zip> does NOT. The argument C<$instroot> specifies the root of the installation from |