From 9c50630d0d19c2e4bf7b68149a88ee4b965f8d48 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 20 Sep 2012 10:36:14 +0000 Subject: tlmgr: implement listing of the content of arbitrary repositories with "tlmgr repository list ...." tlmgr: start working on a pinning action TLPDB: add fucntions to get sub-tlpdbs from a virtual db, and listing of packages of a sub-tlpdb git-svn-id: svn://tug.org/texlive/trunk@27748 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPDB.pm | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'Master/tlpkg/TeXLive') diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index cd36a8fe099..53b9c1040f5 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -43,7 +43,7 @@ C -- A database of TeX Live Packages $tlpdb->needed_by($pkg); $tlpdb->remove_tlpobj($pkg); $tlpdb->get_package("packagename"); - $tlpdb->list_packages; + $tlpdb->list_packages ( [$tag] ); $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list); $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list); $tlpdb->find_file("filename"); @@ -81,6 +81,7 @@ C -- A database of TeX Live Packages $tlpdb->is_virtual; $tlpdb->virtual_add_tlpdb($tlpdb, $tag); $tlpdb->virtual_remove_tlpdb($tag); + $tlpdb->virtual_get_tlpdb($tag); $tlpdb->virtual_get_package($pkg, $tag); $tlpdb->candidates($pkg); $tlpdb->virtual_candidate($pkg); @@ -629,19 +630,41 @@ sub media_of_package { The C function returns the list of all included packages. +By default, for virtual tlpdbs only packages that are installable +are listed. That means, packages that are only in subsidiary repositories +but are not specifically pinned to it cannot be installed and are thus +not listed. Adding "-all" argument lists also these packages. + +Finally, if there is another argument, the tlpdb must be virtual, +and the argument must specify a tag/name of a sub-tlpdb. In this +case all packages (without exceptions) from this repository are returned. + =cut sub list_packages { my $self = shift; my $arg = shift; + my $tag; my $showall = 0; - if (defined($arg) && ($arg eq "-all")) { - $showall = 1; + if (defined($arg)) { + if ($arg eq "-all") { + $showall = 1; + } else { + $tag = $arg; + } } if ($self->is_virtual) { if ($showall) { return (sort keys %{$self->{'packages'}}); } + if ($tag) { + if (defined($self->{'tlpdbs'}{$tag})) { + return $self->{'tlpdbs'}{$tag}->list_packages; + } else { + tlwarn("TLPDB:list_packages: tag not defined: $tag\n"); + return 0; + } + } # we have to be careful here: If a package # is only present in a subsidiary repository # and the package is *not* explicitely @@ -2175,6 +2198,19 @@ sub make_virtual { return 1; } +sub virtual_get_tlpdb { + my ($self, $tag) = @_; + if (!$self->is_virtual) { + tlerror("Cannot remove tlpdb from a non-virtual tlpdb!\n"); + return 0; + } + if (!defined($self->{'tlpdbs'}{$tag})) { + tlerror("TLPDB virtual_get_tlpdb: unknown tag $tag\n"); + return 0; + } + return $self->{'tlpdbs'}{$tag}; +} + sub virtual_add_tlpdb { my ($self, $tlpdb, $tag) = @_; if (!$self->is_virtual) { -- cgit v1.2.3