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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
#!/usr/bin/env perl
#
# tpm2deb-source.pl
# machinery to create debian packages from TeX Live depot
# (c) 2005, 2006 Norbert Preining
#
# $Id: tpm2deb-source.pl 2691 2007-04-16 09:42:22Z frank $
#
# configuration is done via the file tpm2deb.cfg
#
use strict;
no strict 'refs';
# use warnings;
# no warnings 'uninitialized';
my $opt_master;
our $opt_debug;
our $opt_nosrcpkg;
our $opt_noremove;
my $globalreclevel;
my $oldsrcdir;
my $datadump ;
BEGIN {
my $upstream_modules = "/usr/share/tex-common/";
unshift (@INC, "./all/debian");
unshift (@INC, $upstream_modules);
}
my ($mydir,$mmydir);
($mydir = $0) =~ s,/[^/]*$,,;
if ($mydir eq $0) { $mydir = `pwd` ; chomp($mydir); }
if (!($mydir =~ m,/.*,,)) { $mmydir = `pwd`; chomp($mmydir); $mydir = "$mmydir/$mydir" ; }
# $opt_master = "./LocalTPM";
$opt_debug = 0;
$opt_nosrcpkg = 0;
$opt_noremove = 0;
$globalreclevel = 1;
$oldsrcdir = "./src";
$datadump = "tpm.data";
use Getopt::Long;
# use Data::Dumper;
#use Strict;
use File::Basename;
use File::Copy;
use File::Path;
use File::Temp qw/ tempfile tempdir /;
use Storable;
## not needed, atm we are calling eperl binary use Parse::ePerl;
#use XML::DOM;
use Cwd;
#use FileUtils qw(canon_dir cleandir make_link newpath member
# normalize substitute_var_val dirname diff_list remove_list
# rec_rmdir sync_dir walk_dir start_redirection stop_redirection);
#use Tpm;
#
# Configuration for destination of files
# DONT USER DOUBLE QUOTES; THESE VARIABLES HAVE TO GET REEVALUATED
# AFTER $tmpdir IS SET!!
#
my $changelog = "";
my $changelogversion = "";
my $changelogextraversion = "";
my $changelogrevision = "";
my $changelogdistribution = "";
my $allowed_dists = "(unstable|UNRELEASED|sarge-backports|etch-backports|stable-security|experimental)";
our $Master;
our %TpmData;
$Master = `pwd`;
chomp($Master);
my $TpmGlobalPath = $Master;
my $DataGlobalPath = $Master;
unshift (@INC, "$Master/../Build/tools");
File::Basename::fileparse_set_fstype('unix');
use Getopt::Long;
use File::Basename;
use File::Copy;
use File::Path;
use File::Temp qw/ tempfile tempdir /;
use Storable;
use Cwd;
use Tpm;
our (%TeXLive);
our (%Config,%TpmData);
our %TexmfTreeOfType = ( "TLCore" => "texmf",
"Documentation" => "texmf-doc",
"Package" => "texmf-dist");
our @TpmCategories = keys %TexmfTreeOfType;
our %TypeOfTexmfTree = reverse %TexmfTreeOfType;
# pre set $opt_master to ./LocalTPM which contains also the Tools dir
# this is set in the main script, and changed with commandline option.
# should it maybe be deleted here?
my $opt_debug;
my $opt_onlyscripts;
sub populate_TpmData_from_dump {
my $datafile = $_[0];
my $tpmdataref = retrieve($datafile);
%TpmData = %{$tpmdataref};
}
sub load_collection_tpm_data {
# local functions
sub trim {
my ($str) = @_;
$str =~ s/^[\n\s]+//;
$str =~ s/[\n\s]+$//;
return $str;
}
sub get_requires {
my ($tpm,$type) = @_;
my %requires = $tpm->getHash("Requires");
my @keylist = keys %requires;
my @tlcorereqlist = ();
my @packagereqlist = ();
if ($type eq '') {
$type = "all";
}
foreach my $k (keys %requires) {
foreach my $e (@{$requires{$k}}) {
# manually exclude Windows-only packages
if ($e eq "bin-bzip2") {}
elsif ($e eq "bin-xpdf") {}
elsif ($e eq "bin-chktex") {}
elsif ($e eq "bin-ghostscript") {}
elsif ($e eq "bin-gzip") {}
elsif ($e eq "bin-jpeg2ps") {}
elsif ($e eq "bin-perl") {}
elsif ($e eq "bin-windvi") {}
elsif ($e eq "lib-freetype2") {}
elsif ($e eq "lib-gd") {}
elsif ($e eq "lib-geturl") {}
elsif ($e eq "lib-gnu") {}
elsif ($e eq "lib-gs") {}
elsif ($e eq "lib-jpeg") {}
elsif ($e eq "lib-md5") {}
elsif ($e eq "lib-png") {}
elsif ($e eq "lib-regex") {}
elsif ($e eq "lib-texmfmp") {}
elsif ($e eq "lib-tiff") {}
elsif ($e eq "lib-ttf") {}
elsif ($e eq "lib-xpdf") {}
elsif ($e eq "lib-xpm") {}
elsif ($e eq "lib-zlib") {}
elsif ($e =~ /^bin-(.*)$/) {
push @packagereqlist, "$k/$e";
}
elsif ($e =~ /^hyphen-(.*)$/){
push @packagereqlist, "$k/$e";
}
elsif ($k eq "TLCore") {
push @tlcorereqlist, "$k/$e";
} else {
push @packagereqlist, "$k/$e";
}
}
}
if ($type eq '' || $type eq 'all') {
my %foo;
$foo{'TLCore'} = \@tlcorereqlist;
$foo{'Package'} = \@packagereqlist;
#my @foo=(@tlcorereqlist,@packagereqlist);
#return(@foo);
return(\%foo);
} elsif ($type eq 'TLCore') {
return(@tlcorereqlist);
} elsif ($type eq 'Package') {
return(@packagereqlist);
} else {
die("Don't know this type: $type!\n");
}
}
# start of real function
print "Start loading tpm data ... \n";
foreach my $t ('TLCore', 'Documentation', 'Package') {
my $subtree = ${TexmfTreeOfType}{$t};
foreach my $f (<$Master/$subtree/tpm/*.tpm>) {
print "Working on $f\n";
my $shortn = basename($f);
$shortn =~ s,\.tpm$,,;
if (($t eq 'TLCore') && ($shortn =~ m/^scheme-/)) { next ; }
my $tpm = Tpm->new("$subtree/tpm/$shortn.tpm");
foreach my $a (@Tpm::ArchList) {
${Tpm::CurrentArch} = $a;
$TpmData{$t}{$shortn}{'BinFiles'}{$a} = [ $tpm->getFileList("BinFiles") ];
}
#$TpmData{$t}{$shortn}{'BinFiles'} = [ $tpm->getFileList("BinFiles") ];
$TpmData{$t}{$shortn}{'DocFiles'} = [ $tpm->getFileList("DocFiles") ];
$TpmData{$t}{$shortn}{'RunFiles'} = [ $tpm->getFileList("RunFiles") ];
$TpmData{$t}{$shortn}{'SourceFiles'} = [ $tpm->getFileList("SourceFiles") ];
$TpmData{$t}{$shortn}{'RemoteFiles'} = [ $tpm->getFileList("RemoteFiles") ];
$TpmData{$t}{$shortn}{'Title'} = trim($tpm->getAttribute("Title"));
# print "got title $TpmData{$t}{$shortn}{'Title'}\n";
$TpmData{$t}{$shortn}{'Description'} = trim($tpm->getAttribute("Description"));
$TpmData{$t}{$shortn}{'License'} = trim($tpm->getAttribute("License"));
my @foo = $tpm->getList("Installation");
$TpmData{$t}{$shortn}{'Installation'} = \@foo ;
my $alldeps = get_requires($tpm,'all');
my @incs = @{$alldeps->{'Package'}};
my @deps = @{$alldeps->{'TLCore'}};
$TpmData{$t}{$shortn}{'Package'} = \@incs;
$TpmData{$t}{$shortn}{'TLCore'} = \@deps;
}
}
print " ... done\n";
}
sub dump_tpm_data {
print "Dumping TpmData\n\n";
foreach my $t ('TLCore', 'Documentation', 'Package') {
#foreach my $t ('Package') {
print "Dumping $t:\n";
my %foo = %{$TpmData{$t}};
foreach my $p (keys %foo) {
open (FOO,">tlptpm/$p.tlp") || die("Cannot open tlptpm/$p.tpmtlp!");
print FOO "name $p\n";
print FOO "category $t\n";
foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) {
print FOO "depend $foo\n";
}
foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) {
print FOO "depend $foo\n";
}
foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) {
my %foo = %{$ex};
print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n";
}
my @foo;
@foo = @{$TpmData{$t}{$p}{'DocFiles'}};
if ($#foo >= 0) {
print FOO "docfiles\n";
foreach my $foo (sort @foo) {
print FOO " $foo\n";
}
}
@foo = @{$TpmData{$t}{$p}{'SourceFiles'}};
if ($#foo >= 0) {
print FOO "srcfiles\n";
foreach my $foo (sort @foo) {
print FOO " $foo\n";
}
}
@foo = @{$TpmData{$t}{$p}{'RunFiles'}};
if ($#foo >= 1) {
print FOO "runfiles\n";
foreach my $foo (sort @foo) {
next if ($foo =~ /\.tpm$/);
print FOO " $foo\n";
}
}
@foo = @{$TpmData{$t}{$p}{'RemoteFiles'}};
if ($#foo >= 0) {
print FOO "remotefiles\n";
foreach my $foo (sort @foo) {
print FOO " $foo\n";
}
}
foreach my $a (sort @Tpm::ArchList) {
@foo = @{$TpmData{$t}{$p}{'BinFiles'}{$a}};
if ($#foo >= 0) {
print FOO "binfiles arch=$a\n";
foreach my $foo (sort @foo) {
print FOO " $foo\n";
}
}
}
close(FOO);
}
}
}
&main(@ARGV);
1;
# variables needed outside of main
my $version;
my $revision;
my $extraversion;
my $date;
my $arch;
my $shortl;
sub main {
${Tpm::MasterDir} = $TeXLive{'all'}{'tpm_global_path'};
$arch = "all";
${Tpm::CurrentArch} = "i386-linux";
${Tpm::MasterDir} = $Master;
load_collection_tpm_data();
dump_tpm_data();
}
### Local Variables:
### perl-indent-level: 4
### tab-width: 4
### indent-tabs-mode: t
### End:
# vim:set tabstop=4: #
|