summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl99
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm42
2 files changed, 129 insertions, 12 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index e1d95ab0c25..e7c48c201a7 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -170,6 +170,7 @@ sub main {
"no-depends-at-all" => 1,
"force" => 1,
"dry-run|n" => 1 },
+ "repository" => { "with-platforms" => 1 },
"restore" => { "backupdir" => "=s",
"dry-run|n" => 1,
"all" => 1,
@@ -538,6 +539,9 @@ sub execute_action {
} elsif ($action =~ m/^repository$/i) {
action_repository();
finish(0);
+ } elsif ($action =~ m/^pinning$/i) {
+ action_pinning();
+ finish(0);
} elsif ($action =~ m/^candidates$/i) {
action_candidates();
finish(0);
@@ -3486,10 +3490,25 @@ sub show_list_of_packages {
return;
}
+# PINNING
+#
+# this action manages the pinning file
+# of course it can be edited by hand, but we want to make this
+# easier for people to use
+# tlmgr pinning show
+# tlmgr pinning check
+# tlmgr pinning add <repo> <pkgglob> [<pkgglob>, ...]
+# tlmgr pinning remove <repo> <pkgglob> [<pkgglob>, ...]
+# tlmgr pinning remove <repo> --all
+sub action_pinning {
+ tlwarn("Not implemented by now, sorry!\n");
+}
+
# REPOSITORY
#
# this action manages the list of repositories
# tlmgr repository list -> lists repositories
+# tlmgr repository list path|tag -> lists content of repo path|tag
# tlmgr repository add path [tag] -> add repository with optional tag
# tlmgr repository remove [path|tag] -> removes repository or tag
# tlmgr repository set path[#tag] [path[#tag] ...] -> sets the list
@@ -3539,20 +3558,73 @@ sub repository_to_array {
}
return %r;
}
+sub merge_sub_packages {
+ my %pkgs;
+ for my $p (@_) {
+ if ($p =~ m/^(.*)\.([^.]*)$/) {
+ my $n = $1;
+ my $a = $2;
+ if ($p eq "texlive.infra") {
+ push @{$pkgs{$p}}, "all";
+ } else {
+ push @{$pkgs{$n}}, $a;
+ }
+ } else {
+ push @{$pkgs{$p}}, "all";
+ }
+ }
+ return %pkgs;
+}
sub action_repository {
init_local_db();
my $what = shift @ARGV;
$what = "list" if !defined($what);
my %repos = repository_to_array($localtlpdb->option("location"));
if ($what =~ m/^list$/i) {
- print "List of repositories (with tags if set):\n";
- for my $k (keys %repos) {
- my $v = $repos{$k};
- print "\t$v";
- if ($k ne $v) {
- print " ($k)";
+ if (@ARGV) {
+ # list what is in a repository
+ for my $repo (@ARGV) {
+ my $loc = $repo;
+ if (defined($repos{$repo})) {
+ $loc = $repos{$repo};
+ }
+ my ($tlpdb, $errormsg) = setup_one_remotetlpdb($loc);
+ if (!defined($tlpdb)) {
+ tlwarn("cannot locate get TLPDB from $loc\n\n");
+ } else {
+ print "Packages at $loc:\n";
+ my %pkgs = merge_sub_packages($tlpdb->list_packages);
+ for my $p (sort keys %pkgs) {
+ next if ($p =~ m/00texlive/);
+ print " $p";
+ if (!$opts{'with-platforms'}) {
+ print "\n";
+ } else {
+ my @a = @{$pkgs{$p}};
+ if ($#a == 0) {
+ if ($a[0] eq "all") {
+ # no further information necessary
+ print "\n";
+ } else {
+ print ".$a[0]\n";
+ }
+ } else {
+ print " (@{$pkgs{$p}})\n";
+ }
+ }
+ }
+ }
+ }
+ } else {
+ print "List of repositories (with tags if set):\n";
+ for my $k (keys %repos) {
+ my $v = $repos{$k};
+ print "\t$v";
+ if ($k ne $v) {
+ print " ($k)";
+ }
+ print "\n";
}
- print "\n";
}
return;
}
@@ -6151,6 +6223,8 @@ written to the terminal.
=item B<repository list>
+=item B<repository list I<path|tag>>
+
=item B<repository add I<path> [I<tag>]>
=item B<repository remove I<path|tag>>
@@ -6161,8 +6235,15 @@ This action manages the list of repositories. See L</"MULTIPLE
REPOSITORIES"> below for detailed explanations.
The first form (C<list>) lists all configured repositories and the
-respective tags if set. The second form (C<add>) adds a repository
-(optionally attaching a tag) to the list of repositories. The third
+respective tags if set. If a path, url, or tag is given after the
+C<list> keyword, it is interpreted as source from where to
+initialize a TeX Live Database and lists the contained packages.
+This can also be an up-to-now not used repository, both locally
+and remote. If one pass in addition C<--with-platforms>, for each
+package the available platforms (if any) are listed, too.
+
+The third form (C<add>) adds a repository
+(optionally attaching a tag) to the list of repositories. The forth
form (C<remove>) removes a repository, either by full path/url, or by
tag. The last form (C<set>) sets the list of repositories to the items
given on the command line, not keeping previous settings
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<TeXLive::TLPDB> -- 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<TeXLive::TLPDB> -- 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<list_packages> 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) {