texlive[48030] Master/texmf-dist/scripts/texlive: tlmgr info

commits+preining at tug.org commits+preining at tug.org
Sat Jun 16 15:43:22 CEST 2018


Revision: 48030
          http://tug.org/svn/texlive?view=revision&revision=48030
Author:   preining
Date:     2018-06-16 15:43:22 +0200 (Sat, 16 Jun 2018)
Log Message:
-----------
tlmgr info --only-remote

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/NEWS
    trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl

Modified: trunk/Master/texmf-dist/scripts/texlive/NEWS
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/NEWS	2018-06-16 04:54:51 UTC (rev 48029)
+++ trunk/Master/texmf-dist/scripts/texlive/NEWS	2018-06-16 13:43:22 UTC (rev 48030)
@@ -1,6 +1,11 @@
 (This file public domain.  Originally written by Norbert Preining and
 Karl Berry, 2010.)
 
+<p><b>tlmgr NNNNN (released DDmmmYY):</b>
+<li>tlmgr info now allows listing only packages from the remote 
+  repository using <tt>--only-remote</tt>.
+
+
 <p><b>tlmgr 47951 (released 07jun18):</b>
 <li>Backup removal for non-xz.
 

Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2018-06-16 04:54:51 UTC (rev 48029)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2018-06-16 13:43:22 UTC (rev 48030)
@@ -215,7 +215,8 @@
       "data" => "=s",
       "all" => 1,
       "list" => 1, 
-      "only-installed" => 1
+      "only-installed" => 1,
+      "only-remote" => 1
     },
     "run-post" => 0,
     "function" => \&action_info
@@ -1547,6 +1548,10 @@
 # 
 INFO
 #
 sub action_info {
+  if ($opts{'only-installed'} && $opts{'only-remote'}) {
+    tlwarn("Are you joking? --only-installed and --only-remote cannot both be specified!\n");
+    return($F_ERROR);
+  }
   init_local_db();
   my ($what, at todo) = @ARGV;
   my $ret = $F_OK | $F_NOPOSTACTION;
@@ -1613,8 +1618,10 @@
     } else {
       @whattolist = $tlm->list_packages;
     }
-    # add also the local packages
-    TeXLive::TLUtils::push_uniq(\@whattolist, $localtlpdb->list_packages);
+    if (!$opts{'only-remote'}) {
+      # add also the local packages
+      TeXLive::TLUtils::push_uniq(\@whattolist, $localtlpdb->list_packages);
+    }
   } else {
     @whattolist = ($what, @todo);
   }
@@ -3938,6 +3945,20 @@
 
 sub show_one_package_list {
   my ($p, @rest) = @_;
+  my @out;
+  my $loctlp = $localtlpdb->get_package($p);
+  my $remtlp = $remotetlpdb->get_package($p) unless ($opts{'only-installed'});
+  my $is_installed = (defined($loctlp) ? 1 : 0);
+  my $is_available = (defined($remtlp) ? 1 : 0);
+  if (!($is_installed || $is_available)) {
+    if ($opts{'only-installed'}) {
+      tlwarn("$prg: package $p not locally!\n");
+    } else {
+      tlwarn("$prg: package $p not found neither locally nor remote!\n");
+    }
+    return($F_WARNING);
+  }
+  my $tlp = ($is_installed ? $loctlp : $remtlp);
   my $tlm;
   if ($opts{"only-installed"}) {
     $tlm = $localtlpdb;
@@ -3944,12 +3965,11 @@
   } else {
     $tlm = $remotetlpdb;
   }
-  if (defined($localtlpdb->get_package($p))) {
+  if ($is_installed) {
     print "i ";
   } else {
     print "  ";
   }
-  my $tlp = $tlm->get_package($p);
   if (!$tlp) {
     if ($remotetlpdb->is_virtual) {
       # we might have the case that a package is present in a
@@ -8038,6 +8058,13 @@
 If this option is given, the installation source will not be used; only
 locally installed packages, collections, or schemes are listed.
 
+=item B<--only-remote>
+
+Only list packages from the remote repository. Useful when checking what
+is available in a remote repository using
+C<tlmgr --repo ... --only-remote info>. Note that
+C<--only-installed> and C<--only-remote> cannot both be specified.
+
 =item B<--data C<item1,item2,...>>
 
 If the option C<--data> is given, its argument must be a comma separated



More information about the tex-live-commits mailing list