diff options
author | Norbert Preining <preining@logic.at> | 2017-11-17 02:13:42 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-11-17 02:13:42 +0000 |
commit | 391cfb2ba71abd1145f54ac3865e19aab5fe89d4 (patch) | |
tree | 415c30724b85e271463be49f0fdac8a608e5da22 /Master/texmf-dist | |
parent | a81221c13651412f324fecfb00629c5a5808b8d3 (diff) |
version printing in machine readable format
git-svn-id: svn://tug.org/texlive/trunk@45838 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index f7fe02b1b4f..73662615f9b 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -9,6 +9,7 @@ my $svnrev = '$Revision$'; my $datrev = '$Date$'; my $tlmgrrevision; +my $tlmgrversion; my $prg; if ($svnrev =~ m/: ([0-9]+) /) { $tlmgrrevision = $1; @@ -17,7 +18,7 @@ if ($svnrev =~ m/: ([0-9]+) /) { } $datrev =~ s/^.*Date: //; $datrev =~ s/ \(.*$//; -$tlmgrrevision .= " ($datrev)"; +$tlmgrversion = "$tlmgrrevision ($datrev)"; our $Master; our $ismain; @@ -522,7 +523,7 @@ sub main { } else { # give a short message about usage print " -tlmgr revision $tlmgrrevision +tlmgr revision $tlmgrversion usage: tlmgr OPTION... ACTION ARGUMENT... where ACTION is one of:\n"; for my $k (sort keys %action_specification) { @@ -666,29 +667,45 @@ for the full story.\n"; sub give_version { if (!defined($::version_string)) { $::version_string = ""; - $::version_string .= "tlmgr revision $tlmgrrevision\n"; + $::mrversion = ""; + $::version_string .= "tlmgr revision $tlmgrversion\n"; + $::mrversion .= "revision $tlmgrrevision\n"; $::version_string .= "tlmgr using installation: $Master\n"; + $::mrversion .= "installation $Master\n"; if (open (REL_TL, "$Master/release-texlive.txt")) { - # print first and last lines, which have the TL version info. - my @rel_tl = <REL_TL>; - $::version_string .= $rel_tl[0]; - $::version_string .= $rel_tl[$#rel_tl]; + # print first, which has the TL version info. + my $rel_tl = <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; } @@ -6232,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") { |