blob: 3c075743b9de0d4eefcbf18fb7c8a0757b8fc344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/env perl
# $Id$
# Public domain. Originally written 2015, Norbert Preining.
# Return the revision number of a package in a TL structure
# (can be a tlnet archive, installation, or svn)
#
# 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
#
# usage
# tlpkg-revision <pkg> [ <tltree> ]
$^W = 1;
BEGIN {
chomp ($mydir = `dirname $0`); # we are in Master/tlpkg/bin
die "need at least pkg name as argument!" if ($#ARGV < 0);
if ($#ARGV == 1) {
# we got a tltree as second argument, use the modules from there
if (! -d "$ARGV[1]/tlpkg/TeXLive") {
printf STDERR "Cannot find tlpdb in $ARGV[1]\n";
print "-1";
exit(1);
}
unshift (@INC, "$ARGV[1]/tlpkg");
$root = $ARGV[1];
} else {
unshift (@INC, "$mydir/..");
$root = "$mydir/../..";
}
}
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
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[0]);
if (!defined($pkg)) {
printf STDERR "Cannot find $ARGV[0] package\n";
print "0";
exit(1);
}
print $pkg->revision;
exit(0);
|