From b40b1cb1e5dc67b35e577a4d9ea88d80bd6673c3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 19 Nov 2017 22:17:35 +0000 Subject: crossrefware (19nov17) git-svn-id: svn://tug.org/texlive/trunk@45853 c570f23f-e606-0410-a88d-b1316a301751 --- .../texlive/linked_scripts/crossrefware/bbl2bib.pl | 41 +++++++- .../linked_scripts/crossrefware/bibdoiadd.pl | 4 +- .../linked_scripts/crossrefware/bibmradd.pl | 4 +- .../linked_scripts/crossrefware/bibzbladd.pl | 2 +- .../linked_scripts/crossrefware/ltx2crossrefxml.pl | 2 +- .../texk/texlive/linked_scripts/texlive/tlmgr.pl | 115 +++++++++++++++------ 6 files changed, 131 insertions(+), 37 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl index a2df920382d..477412d140e 100755 --- a/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl +++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl @@ -8,13 +8,15 @@ bbl2bib.pl - convert thebibliography environment to a bib file =head1 SYNOPSIS -bbl2bib.pl [B<-o> I] I +bbl2bib.pl [-d] [B<-o> I] I =head1 OPTIONS =over 4 +=item [-d] +Send debugging output to stdout =item B<-o> I @@ -98,10 +100,13 @@ use LaTeX::ToUnicode qw (convert); use Getopt::Std; use URI::Escape; use LWP::Simple; +# Sometimes AMS forgets to update certificates +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; + my $USAGE="USAGE: $0 [-o output] file\n"; my $VERSION = <new($inputfile) or @@ -168,7 +177,15 @@ sub ProcessBibitem { my $bibitem = shift; my $key = $bibitem->{key}; my $text=$bibitem->{text}; + + if ($debug) { + print STDOUT "DEBUG: Processing item $key\n"; + } + if (!length($text) || $text =~ /^\s+$/s) { + if ($debug) { + print STDOUT "DEBUG: No text found\n"; + } return; } @@ -180,21 +197,33 @@ sub ProcessBibitem { # Arxiv entry? if ($text =~ s/\\arxiv\{([^\}]+)\}\.?//) { + if ($debug) { + print STDOUT "DEBUG: Found arXiv number $1\n"; + } $bibitem->{arxiv}=$1; } # Mr number exists? if ($text =~ s/\\mr\{([^\}]+)\}\.?//) { + if ($debug) { + print STDOUT "DEBUG: Found mr number $1\n"; + } $bibitem->{mr}=$1; } # zbl number exists? if ($text =~ s/\\zbl\{([^\}]+)\}\.?//) { + if ($debug) { + print STDOUT "DEBUG: Found zbl number $1\n"; + } $bibitem->{zbl}=$1; } # doi number exists? if ($text =~ s/\\doi\{([^\}]+)\}\.?//) { + if ($debug) { + print STDOUT "DEBUG: Found doi $1\n"; + } $bibitem->{doi}=$1; } @@ -208,8 +237,14 @@ sub SearchMref { my $bibitem = shift; my $mirror = "http://www.ams.org/mathscinet-mref"; my $string=uri_escape_utf8($bibitem->{text}); + if ($debug) { + print STDOUT "Sending $mirror?ref=$string".'&'."dataType=bibtex\n" + } my $response = $userAgent->get("$mirror?ref=$string&dataType=bibtex") -> decoded_content(); + if ($debug) { + print STDOUT "DEBUG: Response $response\n"; + } if ($response =~ /
(.*)<\/pre>/s) {
 	my $bib= $1;
 	my $fh = new FileHandle;
diff --git a/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl b/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl
index bf7bc1a2856..52eba925283 100755
--- a/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl
+++ b/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl
@@ -104,10 +104,12 @@ use LaTeX::ToUnicode qw (convert);
 use Getopt::Std;
 use URI::Escape;
 use LWP::Simple;
+# Sometimes AMS forgets to update certificates
+$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
 
 my $USAGE="USAGE: $0 [-c config] [-e 1|0] [-f] [-o output] file\n";
 my $VERSION = <;
-      $::version_string .= $rel_tl[0];
-      $::version_string .= $rel_tl[$#rel_tl];
+      # print first, which has the TL version info.
+      my $rel_tl = ;
+      $::version_string .= $rel_tl;
+      # for machine readable we only want the last word which is the version
+      my @foo = split(' ', $rel_tl);
+      $::mrversion .= "tlversion $foo[$#foo]\n";
       close (REL_TL);
     }
+    #
+    # add the list of revisions
+    if ($::opt_verbosity > 0) {
+      $::version_string .= "Revisions of TeXLive:: modules:";
+      $::version_string .= "\nTLConfig: " . TeXLive::TLConfig->module_revision();
+      $::version_string .= "\nTLUtils:  " . TeXLive::TLUtils->module_revision();
+      $::version_string .= "\nTLPOBJ:   " . TeXLive::TLPOBJ->module_revision();
+      $::version_string .= "\nTLPDB:    " . TeXLive::TLPDB->module_revision();
+      $::version_string .= "\nTLPaper:  " . TeXLive::TLPaper->module_revision();
+      $::version_string .= "\nTLWinGoo: " . TeXLive::TLWinGoo->module_revision();
+      $::version_string .= "\n";
+    }
+    $::mrversion      .= "TLConfig "   . TeXLive::TLConfig->module_revision();
+    $::mrversion      .= "\nTLUtils "  . TeXLive::TLUtils->module_revision();
+    $::mrversion      .= "\nTLPOBJ "   . TeXLive::TLPOBJ->module_revision();
+    $::mrversion      .= "\nTLPDB "    . TeXLive::TLPDB->module_revision();
+    $::mrversion      .= "\nTLPaper "  . TeXLive::TLPaper->module_revision();
+    $::mrversion      .= "\nTLWinGoo " . TeXLive::TLWinGoo->module_revision();
+    $::mrversion      .= "\n";
+  }
+  if ($::machinereadable) {
+    return $::mrversion;
+  } else {
+    return $::version_string;
   }
-  #
-  # add the list of revisions
-  if ($::opt_verbosity > 0) {
-    $::version_string .= "Revisions of TeXLive:: modules:";
-    $::version_string .= "\nTLConfig: " . TeXLive::TLConfig->module_revision();
-    $::version_string .= "\nTLUtils:  " . TeXLive::TLUtils->module_revision();
-    $::version_string .= "\nTLPOBJ:   " . TeXLive::TLPOBJ->module_revision();
-    $::version_string .= "\nTLPDB:    " . TeXLive::TLPDB->module_revision();
-    $::version_string .= "\nTLPaper:  " . TeXLive::TLPaper->module_revision();
-    $::version_string .= "\nTLWinGoo: " . TeXLive::TLWinGoo->module_revision();
-    $::version_string .= "\n";
-  }
-  return $::version_string;
 }
 
 
@@ -1120,6 +1137,20 @@ sub action_remove {
     }
   }
   @packs = keys %packs;
+
+  my %sizes = %{$localtlpdb->sizes_of_packages(
+    $localtlpdb->option("install_srcfiles"),
+    $localtlpdb->option("install_docfiles"), undef, @packs)};
+  defined($sizes{'__TOTAL__'}) || ($sizes{'__TOTAL__'} = 0);
+  my $totalsize = $sizes{'__TOTAL__'};
+  my $totalnr = $#packs;
+  my $currnr = 1;
+  my $starttime = time();
+  my $donesize = 0;
+  
+  print "total-bytes\t$sizes{'__TOTAL__'}\n" if $::machinereadable;
+  print "end-of-header\n" if $::machinereadable;
+
   foreach my $pkg (sort @packs) {
     my $tlp = $localtlpdb->get_package($pkg);
     next if defined($already_removed{$pkg});
@@ -1127,17 +1158,27 @@ sub action_remove {
       info("$pkg: package not present, cannot remove\n");
       $ret |= $F_WARNING;
     } else {
+      my ($estrem, $esttot) = TeXLive::TLUtils::time_estimate($totalsize,
+                                                              $donesize, $starttime);
+
       # in the first round we only remove collections, nothing else
       # but removing collections will remove all dependencies, too
       # save the information of which packages have already been removed
       # into %already_removed.
       if ($tlp->category eq "Collection") {
         my $foo = 0;
-        info ("$prg: removing $pkg\n");
+        if ($::machinereadable) {
+          machine_line($pkg, "d", $tlp->revision, "-", $sizes{$pkg}, $estrem, $esttot);
+        } else {
+          # info ("$prg: removing $pkg\n");
+          info("[$currnr/$totalnr, $estrem/$esttot] remove: $pkg\n");
+        }
         if (!$opts{"dry-run"}) {
           $foo = backup_and_remove_package($pkg, $autobackup);
           logpackage("remove: $pkg");
         }
+        $currnr++;
+        $donesize += $sizes{$pkg};
         if ($foo) {
           # removal was successful, so the return is at least 0x0001 mktexlsr
           # remove dependencies, too
@@ -1153,8 +1194,19 @@ sub action_remove {
     }
   }
   foreach my $pkg (sort @more_removal) {
+    my $tlp = $localtlpdb->get_package($pkg);
     if (!defined($already_removed{$pkg})) {
-      info ("$prg: removing package $pkg\n");
+      my ($estrem, $esttot) = TeXLive::TLUtils::time_estimate($totalsize,
+                                                              $donesize, $starttime);
+      # info ("$prg: removing package $pkg\n");
+      if ($::machinereadable) {
+        machine_line($pkg, "d", $tlp->revision, "-", $sizes{$pkg}, $estrem, $esttot);
+      } else {
+        # info ("$prg: removing $pkg\n");
+        info("[$currnr/$totalnr, $estrem/$esttot] remove: $pkg\n");
+      }
+      $currnr++;
+      $donesize += $sizes{$pkg};
       if (!$opts{"dry-run"}) {
         if (backup_and_remove_package($pkg, $autobackup)) {
           # removal was successful
@@ -1164,6 +1216,7 @@ sub action_remove {
       }
     }
   }
+  print "end-of-updates\n" if $::machinereadable;
   if ($opts{"dry-run"}) {
     # stop here, don't do any postinstall actions
     return ($ret | $F_NOPOSTACTION);
@@ -1171,9 +1224,11 @@ sub action_remove {
     $localtlpdb->save;
     my @foo = sort keys %already_removed;
     if (@foo) {
-      info("$prg: ultimately removed these packages: @foo\n");
+      info("$prg: ultimately removed these packages: @foo\n")
+        if (!$::machinereadable);
     } else {
-      info("$prg: no packages removed.\n");
+      info("$prg: no packages removed.\n")
+        if (!$::machinereadable);
     }
   }
   return ($ret);
@@ -6194,7 +6249,7 @@ sub action_shell {
     } elsif ($cmd eq "help") {
       print "Please see tlmgr help or http://tug.org/texlive/tlmgr.html.\n";
     } elsif ($cmd eq "version") {
-      print give_version(), "\n";
+      print give_version();
     } elsif ($cmd =~ m/^(quit|end|bye(bye)?)$/i) {
       return $F_OK;
     } elsif ($cmd eq "setup-location") {
@@ -9259,7 +9314,7 @@ This script and its documentation were written for the TeX Live
 distribution (L) and both are licensed under the
 GNU General Public License Version 2 or later.
 
-$Id: tlmgr.pl 45815 2017-11-15 03:45:40Z preining $
+$Id: tlmgr.pl 45838 2017-11-17 02:13:42Z preining $
 =cut
 
 # to remake HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html
-- 
cgit v1.2.3