diff options
author | Norbert Preining <preining@logic.at> | 2007-11-06 17:05:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-06 17:05:30 +0000 |
commit | 3f1d85a5192dc2b66772fa9cb114b8b6a9cb2c6e (patch) | |
tree | be142542f6c9c7eb6f85b710d48799ad40cf4d7a | |
parent | 9a1ebf961419f920e2e067a0999ecabd2c6ec490 (diff) |
add a function $tlpdb->add_tlpcontainer("foobar.ext" [, destination ] )
The C<add_tlpcontainer> functions takes as argument the path to an
package TLPOBJ, i.e., one generated by TLPOBJ->make_zip and adds it to
the installation.
git-svn-id: svn://tug.org/texlive/trunk@5370 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 2a621fa741d..cfd516f13e1 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -26,7 +26,8 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->writeout(FILEHANDLE); $tlpdb->save; $tlpdb->available_architectures(); - $tlpdb->add_objpkg($tlpobj); + $tlpdb->add_tlpcontainer("foobar.ext" [, "destination" ] ); + $tlpdb->add_tlpobj($tlpobj); $tlpdb->get_package("packagename"); $tlpdb->list_packages; $tlpdb->package_revision("packagename"); @@ -41,6 +42,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory); use TeXLive::TLUtils; use TeXLive::TLPOBJ; +use Cwd; my $_listdir; @@ -185,6 +187,42 @@ sub available_architectures { =pod +=item C<< $tlpdb->add_tlpcontainer("foobar.ext" [, destination ] ) >> + +The C<add_tlpcontainer> functions takes as argument the path to an +package TLPOBJ, i.e., one generated by TLPOBJ->make_zip and adds it to +the installation. + +Note that this procedure does NOT check for dependencies. So if your package +adds new dependencies they are not necessarily fulfilled. + +=cut + +sub add_tlpcontainer { + my ($self, $package, $dest) = @_; + my $unpackprog; + # THIS IS NOW A STRONG ASSUMPTION!!! + # The base of the installation is dirname($self->location)!!! + if (not(defined($dest))) { $dest = TeXLive::TLUtils::dirname($self->location) ; } + die ("$package not readable!\n") unless ( -r $package ); + my $pkgname = TeXLive::TLUtils::basename($package); + if ($package =~ m/\.zip$/) { + $unpackprog="unzip"; + $pkgname =~ s/\.zip$//; + } else { + die "Currently only zip packages allowed: $package!\n"; + } + warn "Huuu, this needs testing and error checking!\n"; + warn "Should we use -a -- adapt line endings etc?\n"; + `$unpackprog -o -qq $package -d $dest`; + my $tlpobj = new TeXLive::TLPOBJ; + $tlpobj->from_file("$dest/.tlpobj/$pkgname.tlpobj"); + $self->add_tlpobj($tlpobj); +} + + +=pod + =item C<< $tlpdb->get_package("packagename") >> The C<get_package> function returns a reference to a C<TLPOBJ> object |