summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tlpkginfo
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/tlpkginfo')
-rwxr-xr-xMaster/tlpkg/bin/tlpkginfo56
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo
index 387c226162d..3b8819248c6 100755
--- a/Master/tlpkg/bin/tlpkginfo
+++ b/Master/tlpkg/bin/tlpkginfo
@@ -3,11 +3,66 @@
# Public domain. Originally written 2005, Karl Berry.
#
# Return information given a TL package name (i.e., a tlpsrc file name).
+# With -rev (--revision) argument given, returns only the revision number
+# of the package (see below for details).
# We require local copies of CTAN and the TeX Catalogue.
+BEGIN {
+ $^W = 1;
+ ($mydir = $0) =~ s,/[^/]*$,,;
+ unshift (@INC, "$mydir/..");
+}
+
exit (&main ());
sub main {
+ if ($#ARGV >= 0 && ($ARGV[0] =~ m/^--?rev(ision)?$/)) {
+ &tlpkgrevision();
+ } else {
+ &ctaninfo();
+ }
+}
+
+
+
+sub tlpkgrevision {
+ # output and exit codes:
+ # repository not found or no modules available there
+ # output: -1 exit code: 1
+ # stderr warning
+ # package not found:
+ # output: 0 exit code: 1
+ # stderr warning
+ # both found
+ # output: rev exit code: 0
+ #
+ # tlpkginfo -revision <pkg> [ <tltree> ]
+ require TeXLive::TLPOBJ;
+ require TeXLive::TLPDB;
+ die "need at least pkg name as argument!" if ($#ARGV < 1);
+ if ($#ARGV == 2) {
+ $root = $ARGV[2];
+ } else {
+ $root = "$mydir/../..";
+ }
+ my $tlpdb = TeXLive::TLPDB->new ("root" => $root);
+ if (!defined($tlpdb)) {
+ printf STDERR "Cannot find tlpdb in $root\n";
+ print "-1";
+ exit(1);
+ }
+ my $pkg = $tlpdb->get_package($ARGV[1]);
+ if (!defined($pkg)) {
+ printf STDERR "Cannot find $ARGV[1] package\n";
+ print "0";
+ exit(1);
+ }
+ print $pkg->revision;
+ exit(0);
+}
+
+
+sub ctaninfo {
$CTAN = $ENV{"CTAN"} || "/home/ftp/tex-archive";
$TMPDIR = $ENV{"TMPDIR"} || "/tmp";
$CATALOGUE = $ENV{"TEX_CATALOGUE"} || "/home/httpd/html/catalogue/entries";
@@ -26,6 +81,7 @@ sub main {
# special packages from latex-tds project; used by prepare()
#$amslatex_tds_pkgs = "xamscls|xamsmath|xamsrefs"; # from amslatex.tds
+ $amslatex_tds_pkgs = ''; # silence $^W as it is used further down there
#$amsfonts_tds_pkgs = "amsfonts";
# (amstex and amsfonts handled from the original.)
$latex_tds_pkgs = "latex-tds";