-
Notifications
You must be signed in to change notification settings - Fork 1
/
check-package
executable file
·161 lines (125 loc) · 3.69 KB
/
check-package
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env perl
# Originally written by Norbert Preining, 2017. Public domain.
#
# Test various files on their "usability" or "loadability"
#
# Ideas:
# - tlpobj contains
# testfile ....tex
# reference ....pdf
# later: auto generation
# - .cls => test with pdflatex and compare pdfs
# - .sty => load in article or some other class?
#
# functionality:
# scriptname check [-all] | <pkg> ...
# checks all/passed packages
# scriptname rebuild [-all] | <pkg> ...
# rebuilds reference file for all/passed packages
#
# further arguments:
# --basedir BASE location of files: BASE/<pkg>/...
# --master MASTER location of Master tree
# (root of an installation containing tlpkg)
#
#
# TODO
# * fix layout of BASE/...
#
# Future ideas:
# * provide CTAN package for building reference pdf and
# submitting it to TeX Live together with a test file
#
my $Master;
BEGIN {
$^W = 1;
$| = 1;
(my $mydir = $0) =~ s,/[^/]*$,,;
if ($mydir eq $0) {
$mydir = ".";
}
#my $tlroot = "$mydir/../..";
my $tlroot = "$mydir";
unshift (@INC, "$tlroot/tlpkg");
#chomp ($Master = `cd $mydir/../.. && pwd`);
chomp ($Master = `pwd`);
}
use File::Find;
use Getopt::Long;
use Pod::Usage;
use TeXLive::TLPDB;
use TeXLive::TLConfig;
use TeXLive::TLUtils qw(info debug ddebug debug_hash tlwarn tldie);
my $prg = TeXLive::TLUtils::basename($0);
my $opt_basedir = "/home/norbert/Development/TeX/tltesting.git/testfiles";
my $opt_help = 0;
my $opt_version = 0;
my $opt_all = 0;
TeXLive::TLUtils::process_logging_options ();
GetOptions (
"base=s" => \$opt_basedir,
"all|a" => \$opt_all,
"version" => \$opt_version,
"help|?" => \$help) || pod2usage(1);
pod2usage ("-exitstatus" => 0, "-verbose" => 2) if $help;
if ($opt_version) { print "dev\n"; exit 0; }
#
if ($opt_all) { die("option -all is not implemented by now!"); }
#
# we want to setup the master that we are running all tests
# with our own programs
$::installerdir = $Master; # TLUtils.pm should be smarter
$ENV{'PATH'} = "$Master/bin/" . TeXLive::TLUtils::platform() . ":$ENV{PATH}";
exit (&main());
sub main {
# no interference from TEXMFHOME, etc.
$ENV{'TEXMFHOME'} = "/nonesuch-home";
$ENV{'TEXMFVAR'} = "/nonesuch-uvar";
$ENV{'TEXMFCONFIG'} = "/nonesuch-config";
$ENV{'TEXMFLOCAL'} = "/nonesuch-local";
# load TLPDB
my $tlpdb = TeXLive::TLPDB->new("root" => $Master);
die "cannot find tlpdb in $Master" unless defined($tlpdb);
#
my $cmd = shift @ARGV;
die("No command passed") if (!$cmd);
# setup packages to check:
my @packs = @ARGV;
my $ret = 0;
if ($cmd eq "check" || $cmd eq "rebuild") {
for my $p (@packs) {
$ret += check_rebuild_package($cmd, $p);
}
} else {
die("unknown command: $cmd");
}
exit($ret);
}
# check or rebuild reference for one package
sub check_rebuild_package {
my ($cmd, $p) = @_;
die "NOT IMPLEMENTED";
}
__END__
=head1 NAME
check-package - check package for usability
=head1 SYNOPSIS
check-package check|rebuild [I<option>]... [I<pkg>]
=head1 OPTIONS
The standard options B<-q>, B<-v>, and B<-logfile>=I<file> are also
accepted; see the C<process_logging_options> function in
L<TeXLive::TLUtils> for details. In particular, with B<-v> or higher,
the packages found to be needed for each I<engine.format> combination
will be reported.
=head1 DESCRIPTION
=head1 AUTHORS AND COPYRIGHT
This script and its documentation were written for the TeX Live
distribution (L<http://tug.org/texlive>) and both are licensed under the
GNU General Public License Version 2 or later.
=cut
# Local Variables:
# perl-indent-level: 2
# tab-width: 2
# indent-tabs-mode: nil
# End:
# vim: sw=2 expandtab