"Fossies" - the Fresh Open Source Software Archive 
Member "install-tl-20231204/tlpkg/TeXLive/TLPSRC.pm" (11 Jun 2023, 42749 Bytes) of package /linux/misc/install-tl-unx.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 # $Id: TLPSRC.pm 67326 2023-06-11 15:34:16Z karl $
2 # TeXLive::TLPSRC.pm - module for handling tlpsrc files
3 # Copyright 2007-2023 Norbert Preining
4 # This file is licensed under the GNU General Public License version 2
5 # or any later version.
6
7 use strict; use warnings;
8
9 package TeXLive::TLPSRC;
10
11 use FileHandle;
12 use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory);
13 use TeXLive::TLUtils;
14 use TeXLive::TLPOBJ;
15 use TeXLive::TLTREE;
16
17 my $svnrev = '$Revision: 67326 $';
18 my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
19 sub module_revision { return $_modulerevision; }
20
21 =pod
22
23 =head1 NAME
24
25 C<TeXLive::TLPSRC> -- TeX Live Package Source (C<.tlpsrc>) module
26
27 =head1 SYNOPSIS
28
29 use TeXLive::TLPSRC;
30
31 my $tlpsrc = TeXLive::TLPSRC->new(name => "foobar");
32 $tlpsrc->from_file("/some/tlpsrc/package.tlpsrc");
33 $tlpsrc->from_file("package");
34 $tlpsrc->writeout;
35 $tlpsrc->writeout(\*FILEHANDLE);
36
37 =head1 DESCRIPTION
38
39 The C<TeXLive::TLPSRC> module handles TeX Live Package Source
40 (C<.tlpsrc>) files, which contain all (and only) the information which
41 cannot be automatically derived from other sources, notably the TeX Live
42 directory tree and the TeX Catalogue. In other words, C<.tlpsrc> files
43 are hand-maintained.
44
45 Often they are empty, when all information can be derived from the
46 package name, which is (by default) the base name of the C<.tlpsrc> file.
47
48 =cut
49
50 my $_tmp; # sorry
51 my %autopatterns; # computed once internally
52
53 sub new {
54 my $class = shift;
55 my %params = @_;
56 my $self = {
57 name => $params{'name'},
58 category => defined($params{'category'}) ? $params{'category'}
59 : $DefaultCategory,
60 shortdesc => $params{'shortdesc'},
61 longdesc => $params{'longdesc'},
62 catalogue => $params{'catalogue'},
63 runpatterns => $params{'runpatterns'},
64 srcpatterns => $params{'srcpatterns'},
65 docpatterns => $params{'docpatterns'},
66 binpatterns => $params{'binpatterns'},
67 postactions => $params{'postactions'},
68 executes => defined($params{'executes'}) ? $params{'executes'} : [],
69 depends => defined($params{'depends'}) ? $params{'depends'} : [],
70 };
71 bless $self, $class;
72 return $self;
73 }
74
75
76 sub from_file {
77 my $self = shift;
78 die "need exactly one filename for initialization" if @_ != 1;
79 my $srcfile = $_[0];
80 my $pkgname = TeXLive::TLUtils::basename($srcfile);
81 $pkgname =~ s/\.tlpsrc$//;
82
83 if (! -r "$srcfile") {
84 # if the argument is not readable as is, try looking for it in the
85 # hierarchy where we are. The %INC hash records where packages were
86 # found, so we use that to locate ourselves.
87 (my $trydir = $INC{"TeXLive/TLPSRC.pm"}) =~ s,/[^/]*$,,;
88 chomp ($trydir = `cd $trydir/../tlpsrc && pwd`); # make absolute
89 my $tryfile = "$trydir/$pkgname.tlpsrc";
90 #warn "$trydir\n$tryfile\n";
91 $srcfile = $tryfile if -r $tryfile;
92 }
93
94 open(TMP, "<$srcfile") || die("failed to open tlpsrc '$srcfile': $!");
95 my @lines = <TMP>;
96 close(TMP);
97
98 my $name = $pkgname;
99 my $category = "Package";
100 my $shortdesc = "";
101 my $longdesc= "";
102 my $catalogue = "";
103 my (@executes, @depends);
104 my (@runpatterns, @docpatterns, @binpatterns, @srcpatterns);
105 my (@postactions);
106 my $foundnametag = 0;
107 my $finished = 0;
108 my $savedline = "";
109 my %tlpvars;
110 $tlpvars{"PKGNAME"} = $name;
111
112 my $lineno = 0;
113 for my $line (@lines) {
114 $lineno++;
115
116 # remove end of line comments
117 # we require "<space>#" because since we don't want an embedded # in
118 # long descriptions, as in urls, to be a comment.
119 # Do this *before* we check for continuation lines: A line
120 # .... # foobar \
121 # should *not* be treated as continuation line.
122 $line =~ s/\s+#.*$//;
123
124 # we allow continuation lines in tlpsrc files, i.e., lines ending with \.
125 if ($line =~ /^(.*)\\$/) {
126 $savedline .= $1;
127 next;
128 }
129 if ($savedline ne "") {
130 # we are in a continuation line
131 $line = "$savedline$line";
132 $savedline = "";
133 }
134
135 $line =~ /^\s*#/ && next; # skip comment lines
136 next if $line =~ /^\s*$/; # skip blank lines
137 # (blank lines are significant in tlpobj, but not tlpsrc)
138 #
139 $line =~ /^ /
140 && die "$srcfile:$lineno: non-continuation indentation not allowed: `$line'";
141 #
142 # remove trailing comment (whitespace preceding #).
143 $line =~ s/\s+#.*$//;
144 #
145 # remove other trailing white space.
146 $line =~ s/\s+$//;
147
148 # expand tlpvars while reading in (except in descriptions).
149 # that means we have to respect *order* and define variables
150 # as we read the tlpsrc file.
151 if ($line !~ /^(short|long)desc\s/) {
152 #debug: my $origline = $line;
153 for my $k (keys %tlpvars) {
154 $line =~ s/\$\{\Q$k\E\}/$tlpvars{$k}/g;
155 }
156 # check that no variables remain unexpanded, or rather, for any
157 # remaining $ (which we don't otherwise allow in tlpsrc files, so
158 # should never occur) ... except for ${ARCH} which we specially
159 # expand in TLTREE.pm, and ${global_*} which need to
160 # be defined in 00texlive.autopatterns.tlpsrc. (We distribute one
161 # file dvi$pdf.bat, but fortunately it is matched by a directory.)
162 #
163 (my $testline = $line) =~ s,\$\{ARCH\},,g;
164 $testline =~ s,\$\{(global_[^}]*)\},,g;
165 $testline =~ /\$/
166 && die "$srcfile:$lineno: variable undefined or syntax error: $line\n";
167 #debug: warn "new line $line, from $origline\n" if $origline ne $line;
168 } # end variable expansion.
169
170 # names of source packages can either be
171 # - normal names: ^[-\w]+$
172 # - windows specific packages: ^[-\w]+\.windows$
173 # - normal texlive specific packages: ^texlive.*\..*$
174 # - configuration texlive specific packages: ^00texlive.*\..*$
175 if ($line =~ /^name\s/) {
176 $line =~ /^name\s+([-\w]+(\.windows)?|(00)?texlive\..*)$/;
177 $foundnametag
178 && die "$srcfile:$lineno: second name directive not allowed: $line"
179 . "(have $name)\n";
180 $name = $1;
181 $foundnametag = 1;
182 # let's assume that $PKGNAME doesn't occur before any name
183 # directive (which would result in different expansions); there is
184 # no need for it in practice.
185 $tlpvars{"PKGNAME"} = $name;
186
187 } elsif ($line =~ /^category\s+$CategoriesRegexp$/) {
188 $category = $1;
189
190 } elsif ($line =~ /^shortdesc\s*(.*)$/) {
191 $shortdesc
192 && die "$srcfile:$lineno: second shortdesc not allowed: $line"
193 . "(have $shortdesc)\n";
194 $shortdesc = $1;
195
196 } elsif ($line =~ /^shortdesc$/) {
197 $shortdesc = "";
198
199 } elsif ($line =~ /^longdesc$/) {
200 # We need to use a space here instead of a newline so that strings
201 # read from *.tlpsrc and tlpdb come out the same; see $shortdesc
202 # and $longdesc assignments below.
203 $longdesc .= " ";
204
205 } elsif ($line =~ /^longdesc\s+(.*)$/) {
206 $longdesc .= "$1 ";
207
208 } elsif ($line =~ /^catalogue\s+(.*)$/) {
209 $catalogue
210 && die "$srcfile:$lineno: second catalogue not allowed: $line"
211 . "(have $catalogue)\n";
212 $catalogue = $1;
213
214 } elsif ($line =~ /^runpattern\s+(.*)$/) {
215 push (@runpatterns, $1) if ($1 ne "");
216
217 } elsif ($line =~ /^srcpattern\s+(.*)$/) {
218 push (@srcpatterns, $1) if ($1 ne "");
219
220 } elsif ($line =~ /^docpattern\s+(.*)$/) {
221 push (@docpatterns, $1) if ($1 ne "");
222
223 } elsif ($line =~ /^binpattern\s+(.*)$/) {
224 push (@binpatterns, $1) if ($1 ne "");
225
226 } elsif ($line =~ /^execute\s+(.*)$/) {
227 push (@executes, $1) if ($1 ne "");
228
229 } elsif ($line =~ /^(depend|hard)\s+(.*)$/) {
230 push (@depends, $2) if ($2 ne "");
231
232 } elsif ($line =~ /^postaction\s+(.*)$/) {
233 push (@postactions, $1) if ($1 ne "");
234
235 } elsif ($line =~ /^tlpsetvar\s+([-_a-zA-Z0-9]+)\s+(.*)$/) {
236 $tlpvars{$1} = $2;
237
238 } elsif ($line =~ /^catalogue-([^\s]+)\s+(.*)$/o) {
239 $self->{'cataloguedata'}{$1} = $2 if defined $2;
240
241 } else {
242 die "$srcfile:$lineno: unknown tlpsrc directive, fix: $line\n";
243 }
244 }
245 $self->_srcfile($srcfile);
246 $self->_tlpvars(\%tlpvars);
247 if ($name =~ m/^[[:space:]]*$/) {
248 die "Cannot deduce name from file argument and name tag not found";
249 }
250 #
251 # We should call TeXCatalogue::beautify(), but let's be lazy since not
252 # everything comes up in practice. We want the parsing from .tlpsrc to
253 # result in exactly the same string, including spaces, as parsing from
254 # texlive.tlpdb. Otherwise tl-update-tlpdb's tlpdb_catalogue_compare
255 # will think the strings are always different.
256 $shortdesc =~ s/\s+$//g; # rm trailing whitespace (shortdesc)
257 $longdesc =~ s/\s+$//g; # rm trailing whitespace (longdesc)
258 $longdesc =~ s/\s\s+/ /g; # collapse multiple whitespace characters to one
259 # see comments in beautify.
260 $longdesc =~ s,http://grants.nih.gov/,grants.nih.gov/,g;
261 #
262 $self->name($name);
263 $self->category($category);
264 $self->catalogue($catalogue) if $catalogue;
265 $self->shortdesc($shortdesc) if $shortdesc;
266 $self->longdesc($longdesc) if $longdesc;
267 $self->srcpatterns(@srcpatterns) if @srcpatterns;
268 $self->runpatterns(@runpatterns) if @runpatterns;
269 $self->binpatterns(@binpatterns) if @binpatterns;
270 $self->docpatterns(@docpatterns) if @docpatterns;
271 $self->executes(@executes) if @executes;
272 $self->depends(@depends) if @depends;
273 $self->postactions(@postactions) if @postactions;
274 }
275
276
277 sub writeout {
278 my $self = shift;
279 my $fd = (@_ ? $_[0] : *STDOUT);
280 format_name $fd "multilineformat"; # format defined in TLPOBJ, and $:
281 $fd->format_lines_per_page (99999); # no pages in this format
282 print $fd "name ", $self->name, "\n";
283 print $fd "category ", $self->category, "\n";
284 defined($self->{'catalogue'}) && print $fd "catalogue $self->{'catalogue'}\n";
285 defined($self->{'shortdesc'}) && print $fd "shortdesc $self->{'shortdesc'}\n";
286 if (defined($self->{'longdesc'})) {
287 $_tmp = "$self->{'longdesc'}";
288 write $fd; # use that multilineformat
289 }
290 if (defined($self->{'depends'})) {
291 foreach (@{$self->{'depends'}}) {
292 print $fd "depend $_\n";
293 }
294 }
295 if (defined($self->{'executes'})) {
296 foreach (@{$self->{'executes'}}) {
297 print $fd "execute $_\n";
298 }
299 }
300 if (defined($self->{'postactions'})) {
301 foreach (@{$self->{'postactions'}}) {
302 print $fd "postaction $_\n";
303 }
304 }
305 if (defined($self->{'srcpatterns'}) && (@{$self->{'srcpatterns'}})) {
306 foreach (sort @{$self->{'srcpatterns'}}) {
307 print $fd "srcpattern $_\n";
308 }
309 }
310 if (defined($self->{'runpatterns'}) && (@{$self->{'runpatterns'}})) {
311 foreach (sort @{$self->{'runpatterns'}}) {
312 print $fd "runpattern $_\n";
313 }
314 }
315 if (defined($self->{'docpatterns'}) && (@{$self->{'docpatterns'}})) {
316 foreach (sort @{$self->{'docpatterns'}}) {
317 print $fd "docpattern $_\n";
318 }
319 }
320 if (defined($self->{'binpatterns'}) && (@{$self->{'binpatterns'}})) {
321 foreach (sort @{$self->{'binpatterns'}}) {
322 print $fd "binpattern $_\n";
323 }
324 }
325 }
326
327
328 # the hard work, generate the TLPOBJ data.
329 #
330 sub make_tlpobj {
331 my ($self,$tltree,$autopattern_root) = @_;
332 my %allpatterns = &find_default_patterns($autopattern_root);
333 my %global_tlpvars = %{$allpatterns{'tlpvars'}};
334 my $category_patterns = $allpatterns{$self->category};
335
336 # tlpsrc tlpvars are already applied during tlpsrc read in time
337 # now apply the global tlpvars from 00texlive.autopatterns.tlpsrc
338 # update the execute and depend strings
339 my @exes = $self->executes;
340 my @deps = $self->depends;
341 for my $key (keys %global_tlpvars) {
342 s/\$\{\Q$key\E\}/$global_tlpvars{$key}/g for @deps;
343 s/\$\{\Q$key\E\}/$global_tlpvars{$key}/g for @exes;
344 }
345 $self->depends(@deps);
346 $self->executes(@exes);
347
348 my $tlp = TeXLive::TLPOBJ->new;
349 $tlp->name($self->name);
350 $tlp->category($self->category);
351 $tlp->shortdesc($self->{'shortdesc'}) if (defined($self->{'shortdesc'}));
352 $tlp->longdesc($self->{'longdesc'}) if (defined($self->{'longdesc'}));
353 $tlp->catalogue($self->{'catalogue'}) if (defined($self->{'catalogue'}));
354 $tlp->cataloguedata(%{$self->{'cataloguedata'}}) if (defined($self->{'cataloguedata'}));
355 $tlp->executes(@{$self->{'executes'}}) if (defined($self->{'executes'}));
356 $tlp->postactions(@{$self->{'postactions'}}) if (defined($self->{'postactions'}));
357 $tlp->depends(@{$self->{'depends'}}) if (defined($self->{'depends'}));
358 $tlp->revision(0);
359
360 # convert each fmttrigger to a depend line, if not already present.
361 if (defined($tlp->executes)) { # else no fmttriggers
362 my @deps = (defined($tlp->depends) ? $tlp->depends : ());
363 my $tlpname = $tlp->name;
364 for my $e ($tlp->executes) {
365 # we only check for AddFormat lines
366 if ($e =~ m/^\s*AddFormat\s+(.*)\s*$/) {
367 my %fmtline = TeXLive::TLUtils::parse_AddFormat_line($1);
368 if (defined($fmtline{"error"})) {
369 tlwarn ("error in parsing $e for return hash: $fmtline{error}\n");
370 } else {
371 # make sure that we don't add circular deps
372 TeXLive::TLUtils::push_uniq (\@deps,
373 grep { $_ ne $tlpname } @{$fmtline{'fmttriggers'}});
374 }
375 }
376 }
377 $tlp->depends(@deps);
378 }
379
380 my $filemax;
381 my $usedefault;
382 my @allpospats;
383 my @allnegpats;
384 my $pkgname = $self->name;
385 my @autoaddpat;
386
387 # src/run/doc patterns
388 #
389 # WARNING WARNING WARNING
390 # the "bin" must be last since we drop through for further dealing
391 # with specialities of the bin patterns!!!!
392 for my $pattype (qw/src run doc bin/) {
393 @allpospats = ();
394 @allnegpats = ();
395 @autoaddpat = ();
396 $usedefault = 1;
397 foreach my $p (@{$self->{${pattype} . 'patterns'}}) {
398 # Expansion of ${global_...} variables from autopatterns.
399 for my $key (keys %global_tlpvars) {
400 $p =~ s/\$\{\Q$key\E\}/$global_tlpvars{$key}/g;
401 }
402
403 if ($p =~ m/^a\s+(.*)\s*$/) {
404 # format
405 # a toplevel1 toplevel2 toplevel3 ...
406 # which add autopatterns as if we are doing single packages
407 # toplevel1 toplevel2 toplevel3
408 push @autoaddpat, split(' ', $1);
409 } elsif ($p =~ m/^!\+(.*)$/) {
410 push @allnegpats, $1;
411 } elsif ($p =~ m/^\+!(.*)$/) {
412 push @allnegpats, $1;
413 } elsif ($p =~ m/^\+(.*)$/) {
414 push @allpospats, $1;
415 } elsif ($p =~ m/^!(.*)$/) {
416 push @allnegpats, $1;
417 $usedefault = 0;
418 } else {
419 push @allpospats, $p;
420 $usedefault = 0;
421 }
422 }
423
424 if ($usedefault) {
425 push @autoaddpat, $pkgname;
426 }
427 if (defined($category_patterns)) {
428 for my $a (@autoaddpat) {
429 my $type_patterns = $category_patterns->{$pattype};
430 for my $p (@{$type_patterns}) {
431 # the occurrence of %[str:]NAME[:str]% and its
432 # expansion is documented in 00texlive.autopatterns.tlpsrc
433 # we have to make a copy of $p otherwise we change it in the
434 # hash once and for all
435 my $pp = $p;
436 while ($pp =~ m/%(([^%]*):)?NAME(:([^%]*))?%/) {
437 my $nn = $a;
438 if (defined($1)) {
439 $nn =~ s/^$2//;
440 }
441 if (defined($3)) {
442 $nn =~ s/$4$//;
443 }
444 $pp =~ s/%(([^%]*):)?NAME(:([^%]*))?%/$nn/;
445 }
446 # replace the string %NAME% with the actual package name
447 #(my $pp = $p) =~ s/%NAME%/$a/g;
448 # sort through the patterns, and make sure that * are added to
449 # tag the default patterns
450 if ($pp =~ m/^!(.*)$/) {
451 push @allnegpats, "*$1";
452 } else {
453 push @allpospats, "*$pp";
454 }
455 }
456 }
457 }
458 # at this point we do NOT do the actual pattern matching for
459 # bin patterns, since we have some specialities to do
460 last if ($pattype eq "bin");
461
462 # for all other patterns we create the list and add the files
463 foreach my $p (@allpospats) {
464 ddebug("pos pattern $p\n");
465 $self->_do_normal_pattern($p,$tlp,$tltree,$pattype);
466 }
467 foreach my $p (@allnegpats) {
468 ddebug("neg pattern $p\n");
469 $self->_do_normal_pattern($p,$tlp,$tltree,$pattype,1);
470 }
471 }
472 #
473 # binpatterns
474 #
475 # mind that @allpospats and @allnegpats have already been set up
476 # in the above loop. We only have to deal with the specialities of
477 # the bin patterns
478 foreach my $p (@allpospats) {
479 my @todoarchs = $tltree->architectures;
480 my $finalp = $p;
481 if ($p =~ m%^(\w+)/(!?[-_a-z0-9,]+)\s+(.*)$%) {
482 my $pt = $1;
483 my $aa = $2;
484 my $pr = $3;
485 if ($aa =~ m/^!(.*)$/) {
486 # negative specification
487 my %negarchs;
488 foreach (split(/,/,$1)) {
489 $negarchs{$_} = 1;
490 }
491 my @foo = ();
492 foreach (@todoarchs) {
493 push @foo, $_ unless defined($negarchs{$_});
494 }
495 @todoarchs = @foo;
496 } else {
497 @todoarchs = split(/,/,$aa);
498 }
499 # set $p to the pattern without arch specification
500 $finalp = "$pt $pr";
501 }
502 # one final trick
503 # if the original pattern string matches bin/windows/ then we *only*
504 # work on the windows arch
505 if ($finalp =~ m! bin/windows/!) {
506 @todoarchs = qw/windows/;
507 }
508 # now @todoarchs contains only those archs for which we want
509 # to match the pattern
510 foreach my $arch (sort @todoarchs) {
511 # get only those files matching the pattern
512 my @archfiles = $tltree->get_matching_files('bin',$finalp, $pkgname, $arch);
513 if (!@archfiles) {
514 if (($arch ne "windows") || defined($::tlpsrc_pattern_warn_win)) {
515 tlwarn("$self->{name} ($arch): no hit on binpattern $finalp\n");
516 }
517 }
518 $tlp->add_binfiles($arch,@archfiles);
519 }
520 }
521 foreach my $p (@allnegpats) {
522 my @todoarchs = $tltree->architectures;
523 my $finalp = $p;
524 if ($p =~ m%^(\w+)/(!?[-_a-z0-9,]+)\s+(.*)$%) {
525 my $pt = $1;
526 my $aa = $2;
527 my $pr = $3;
528 if ($aa =~ m/^!(.*)$/) {
529 # negative specification
530 my %negarchs;
531 foreach (split(/,/,$1)) {
532 $negarchs{$_} = 1;
533 }
534 my @foo = ();
535 foreach (@todoarchs) {
536 push @foo, $_ unless defined($negarchs{$_});
537 }
538 @todoarchs = @foo;
539 } else {
540 @todoarchs = split(/,/,$aa);
541 }
542 # set $p to the pattern without arch specification
543 $finalp = "$pt $pr";
544 }
545 # now @todoarchs contains only those archs for which we want
546 # to match the pattern
547 foreach my $arch (sort @todoarchs) {
548 # get only those files matching the pattern
549 my @archfiles = $tltree->get_matching_files('bin', $finalp, $pkgname, $arch);
550 if (!@archfiles) {
551 if (($arch ne "windows") || defined($::tlpsrc_pattern_warn_win)) {
552 tlwarn("$self->{name} ($arch): no hit on negative binpattern $finalp\n")
553 unless $::tlpsrc_pattern_no_warn_negative;
554 # see comments in libexec/place script.
555 }
556 }
557 $tlp->remove_binfiles($arch,@archfiles);
558 }
559 }
560 # add the revision number of the .tlpsrc file to the compute list:
561 $tlp->recompute_revision($tltree,
562 $tltree->file_svn_lastrevision("tlpkg/tlpsrc/$self->{name}.tlpsrc"));
563 $tlp->recompute_sizes($tltree);
564 return $tlp;
565 }
566
567 sub _do_normal_pattern {
568 my ($self,$p,$tlp,$tltree,$type,$negative) = @_;
569 my $is_default_pattern = 0;
570 if ($p =~ m/^\*/) {
571 $is_default_pattern = 1;
572 $p =~ s/^\*//;
573 }
574 my @matchfiles = $tltree->get_matching_files($type, $p, $self->{'name'});
575 if (!$is_default_pattern && !@matchfiles
576 && ($p !~ m,^f ignore,) && ($p !~ m,^d tlpkg/backups,)) {
577 tlwarn("$self->{name}: no hit for pattern $p\n")
578 unless $negative && $::tlpsrc_pattern_no_warn_negative;
579 }
580 if (defined($negative) && $negative == 1) {
581 $tlp->remove_files($type,@matchfiles);
582 } else {
583 $tlp->add_files($type,@matchfiles);
584 }
585 }
586
587
588 # =item C<find_default_patterns($tlroot)>
589 #
590 # Get the default patterns for all categories from an external file.
591 #
592 # Return hash with keys being the categories (Package, Collection, etc.)
593 # and values being refs to another hash. The subhash's keys are the
594 # file types (run bin doc ...) with values being refs to an array of
595 # patterns for that type.
596 #
597 # The returned hash has an additional key C<tlpvars> for global tlpsrc
598 # variables, which can be used in any C<.tlpsrc> files. The names of these
599 # variables all start with C<global_>.
600 #
601 # =cut
602 # (all doc at bottom, let's not rewrite now.)
603
604 sub find_default_patterns {
605 my ($tlroot) = @_;
606 # %autopatterns is global.
607 return %autopatterns if keys %autopatterns; # only compute once
608
609 my $apfile = "$tlroot/tlpkg/tlpsrc/00texlive.autopatterns.tlpsrc";
610 die "No autopatterns file found: $apfile" if ! -r $apfile;
611
612 my $tlsrc = new TeXLive::TLPSRC;
613 $tlsrc->from_file ($apfile);
614 if ($tlsrc->binpatterns) {
615 for my $p ($tlsrc->binpatterns) {
616 my ($cat, @rest) = split ' ', $p;
617 push @{$autopatterns{$cat}{"bin"}}, join(' ', @rest);
618 }
619 }
620 if ($tlsrc->srcpatterns) {
621 for my $p ($tlsrc->srcpatterns) {
622 my ($cat, @rest) = split ' ', $p;
623 push @{$autopatterns{$cat}{"src"}}, join(' ', @rest);
624 }
625 }
626 if ($tlsrc->docpatterns) {
627 for my $p ($tlsrc->docpatterns) {
628 my ($cat, @rest) = split ' ', $p;
629 push @{$autopatterns{$cat}{"doc"}}, join(' ', @rest);
630 }
631 }
632 if ($tlsrc->runpatterns) {
633 for my $p ($tlsrc->runpatterns) {
634 my ($cat, @rest) = split ' ', $p;
635 push @{$autopatterns{$cat}{"run"}}, join(' ', @rest);
636 }
637 }
638
639 for my $cat (keys %autopatterns) {
640 ddebug ("Category $cat\n");
641 for my $d (@{$autopatterns{$cat}{"bin"}}) {
642 ddebug ("auto bin pattern $d\n");
643 }
644 for my $d (@{$autopatterns{$cat}{"src"}}) {
645 ddebug ("auto src pattern $d\n");
646 }
647 for my $d (@{$autopatterns{$cat}{"doc"}}) {
648 ddebug ("auto doc pattern $d\n");
649 }
650 for my $d (@{$autopatterns{$cat}{"run"}}) {
651 ddebug ("auto run pattern $d\n");
652 }
653 }
654
655 # check defined variables to ensure their names start with "global_".
656 my %gvars = %{$tlsrc->_tlpvars};
657 for my $v (keys %gvars) {
658 if ($v !~ /^(global_[-_a-zA-Z0-9]+)$/) {
659 tlwarn("$apfile: variable does not start with global_: $v\n")
660 unless $v eq "PKGNAME";
661 # the auto-defined PKGNAME is not expected to be global.
662 delete $gvars{$v};
663 }
664 } # we'll usually unnecessarily create a second hash, but so what.
665 $autopatterns{'tlpvars'} = \%gvars;
666
667 return %autopatterns;
668 }
669
670
671 # member access functions
672 #
673 sub _srcfile {
674 my $self = shift;
675 if (@_) { $self->{'_srcfile'} = shift }
676 return $self->{'_srcfile'};
677 }
678 sub _tlpvars {
679 my $self = shift;
680 if (@_) { $self->{'_tlpvars'} = shift; }
681 return $self->{'_tlpvars'};
682 }
683 sub name {
684 my $self = shift;
685 if (@_) { $self->{'name'} = shift }
686 return $self->{'name'};
687 }
688 sub category {
689 my $self = shift;
690 if (@_) { $self->{'category'} = shift }
691 return $self->{'category'};
692 }
693 sub shortdesc {
694 my $self = shift;
695 if (@_) { $self->{'shortdesc'} = shift }
696 return $self->{'shortdesc'};
697 }
698 sub longdesc {
699 my $self = shift;
700 if (@_) { $self->{'longdesc'} = shift }
701 return $self->{'longdesc'};
702 }
703 sub catalogue {
704 my $self = shift;
705 if (@_) { $self->{'catalogue'} = shift }
706 return $self->{'catalogue'};
707 }
708 sub cataloguedata {
709 my $self = shift;
710 my %ct = @_;
711 if (@_) { $self->{'cataloguedata'} = \%ct }
712 return $self->{'cataloguedata'};
713 }
714 sub srcpatterns {
715 my $self = shift;
716 if (@_) { @{ $self->{'srcpatterns'} } = @_ }
717 if (defined($self->{'srcpatterns'})) {
718 return @{ $self->{'srcpatterns'} };
719 } else {
720 return;
721 }
722 }
723 sub docpatterns {
724 my $self = shift;
725 if (@_) { @{ $self->{'docpatterns'} } = @_ }
726 if (defined($self->{'docpatterns'})) {
727 return @{ $self->{'docpatterns'} };
728 } else {
729 return;
730 }
731 }
732 sub binpatterns {
733 my $self = shift;
734 if (@_) { @{ $self->{'binpatterns'} } = @_ }
735 if (defined($self->{'binpatterns'})) {
736 return @{ $self->{'binpatterns'} };
737 } else {
738 return;
739 }
740 }
741 sub depends {
742 my $self = shift;
743 if (@_) { @{ $self->{'depends'} } = @_ }
744 return @{ $self->{'depends'} };
745 }
746 sub runpatterns {
747 my $self = shift;
748 if (@_) { @{ $self->{'runpatterns'} } = @_ }
749 if (defined($self->{'runpatterns'})) {
750 return @{ $self->{'runpatterns'} };
751 } else {
752 return;
753 }
754 }
755 sub executes {
756 my $self = shift;
757 if (@_) { @{ $self->{'executes'} } = @_ }
758 return @{ $self->{'executes'} };
759 }
760 sub postactions {
761 my $self = shift;
762 if (@_) { @{ $self->{'postactions'} } = @_ }
763 return @{ $self->{'postactions'} };
764 }
765
766 1;
767 __END__
768
769
770 =head1 FILE SPECIFICATION
771
772 A C<tlpsrc> file consists of lines of the form:
773
774 I<key> I<value>
775
776 where I<key> can be one of: C<name> C<category> C<catalogue>
777 C<shortdesc> C<longdesc> C<depend> C<execute> C<postaction> C<tlpsetvar>
778 C<runpattern> C<srcpattern> C<docpattern> C<binpattern>.
779
780 Continuation lines are supported via a trailing backslash. That is, if
781 the C<.tlpsrc> file contains two physical lines like this:
782
783 foo\
784 bar
785
786 they are concatenated into C<foobar>. The backslash and the newline are
787 removed; no other whitespace is added or removed.
788
789 Comment lines begin with a # and continue to the end of the line.
790 Within a line, a # that is preceded by whitespace is also a comment.
791
792 Blank lines are ignored.
793
794 The I<key>s are described in the following sections.
795
796 =head2 C<name>
797
798 identifies the package; C<value> must consist only of C<[-_a-zA-Z0-9]>,
799 i.e., with what Perl considers a C<\w>. It is optional; if not
800 specified, the name of the C<.tlpsrc> file will be used (with the
801 C<.tlpsrc> removed).
802
803 There are three exceptions to this rule:
804
805 =over 4
806
807 =item B<name.ARCH>
808
809 where B<ARCH> is a supported architecture-os combination. This has two
810 uses. First, packages are split (automatically) into containers for the
811 different architectures to make possible installations including only
812 the necessary binaries. Second, one can add 'one-arch-only' packages,
813 often used to deal with Windows peculiarities.
814
815 =item B<texlive>I<some.thing>
816
817 (notice the dot in the package name) These packages are core TeX Live
818 packages. They are treated as usual packages in almost all respects, but
819 have that extra dot to be sure they will never clash with any package
820 that can possibly appear on CTAN. The only such package currently is
821 C<texlive.infra>, which contains L<tlmgr> and other basic infrastructure
822 functionality.
823
824 =item B<00texlive>I<something>
825
826 These packages are used for internal operation and storage containers
827 for settings. I<00texlive> packages are never be split into separate
828 arch-packages, and containers are never generated for these packages.
829
830 The full list of currently used packages of this type is:
831
832 =over 8
833
834 =item B<00texlive.config>
835
836 This package contains configuration options for the TeX Live archive.
837 If container_split_{doc,src}_files occurs in the depend lines the
838 {doc,src} files are split into separate containers (.tar.xz)
839 during container build time. Note that this has NO effect on the
840 appearance within the texlive.tlpdb. It is only on container level.
841 The container_format/XXXXX specifies the format, currently allowed
842 is only "xz", which generates .tar.xz files. zip can be supported.
843 release/NNNN specifies the release number as used in the installer.
844
845 =item B<00texlive.installation>
846
847 This package serves a double purpose:
848
849 1. at installation time the present values are taken as default for
850 the installer
851
852 2. on an installed system it serves as configuration file. Since
853 we have to remember these settings for additional package
854 installation, removal, etc.
855
856 =item B<00texlive.image>
857
858 This package collects some files which are not caught by any of the
859 other TL packages. Its primary purpose is to make the file coverage
860 check happy. The files here are not copied by the installer
861 and containers are not built; they exist only in the
862 TeX Live Master tree.
863
864 =item B<00texlive.installer>
865
866 This package defines the files to go into the installer
867 archives (install-tl-unx.tar.gz, install-tl.zip) built
868 by the tl-make-installer script. Most of what's here is also
869 included in the texlive.infra package -- ordinarily duplicates
870 are not allowed, but in this case, 00texlive.installer is never
871 used *except* to build the installer archives, so it's ok.
872
873 =back
874
875 =back
876
877 =head2 C<category>
878
879 identifies the category into which this package belongs. This determines
880 the default patterns applied. Possible categories are defined in
881 C<TeXLive::TLConfig>, currently C<Collection>, C<Scheme>, C<TLCore>,
882 C<Package>, C<ConTeXt>. Most packages fall into the C<Package> category,
883 and this is the default if not specified.
884
885 =head2 C<catalogue>
886
887 identifies the name under which this package can be found in the TeX
888 Catalogue. If not specified, the package name is used.
889
890 =head2 C<shortdesc>
891
892 gives a one line description of the package. Later lines overwrite
893 earlier, so there's no use in giving it more than once. If not
894 specified, the default is taken from the TeX Catalogue, which suffices
895 for almost all normal packages. Thus, in TeX Live, primarily used for
896 collections and schemes.
897
898 =head2 C<longdesc>
899
900 gives a long description of the package. Later lines are appended to
901 earlier ones. As with C<shortdesc>, if not specified, the default is
902 taken from the TeX Catalogue, which suffices for almost all normal
903 packages.
904
905 =head2 C<depend>
906
907 specifies the list of dependencies, which are just other package names.
908 All the C<depend> lines contribute to the dependencies of the package.
909 For example, C<latex.tlpsrc> contains (among others):
910
911 depend latexconfig
912 depend latex-fonts
913 depend pdftex
914
915 to ensure these packages are installed if the C<latex> package is. The
916 directive C<hard> is an alias for C<depend>, since that's we specified
917 for the C<DEPENDS.txt> files package authors can provide; see
918 L<https://www.tug.org/texlive/pkgcontrib.html#deps>.
919
920 =head2 C<execute>
921
922 specifies an install-time action to be executed. The following actions
923 are supported:
924
925 =over 4
926
927 =item C<execute addMap> I<font>C<.map>
928
929 enables the font map file I<font>C<.map> in the C<updmap.cfg> file.
930
931 =item C<execute addMixedMap> I<font>C<.map>
932
933 enables the font map file I<font>C<.map> for Mixed mode in the
934 C<updmap.cfg> file.
935
936 =item C<execute AddHyphen name=I<texlang> file=I<file> [I<var>...]>
937
938 activates the hyphenation pattern with name I<texlang> and load the file
939 I<file> for that language. The additional variables I<var> are:
940 C<lefthyphenmin>, C<righthyphenmin> (both integers), C<synonyms> (a
941 comma-separated list of alias names for that hyphenation), C<databases>
942 (a comma-separated list of databases the entry should go in; currently
943 recognized are: C<dat> (C<language.dat>), C<def> (C<language.def>) and
944 C<lua> (C<language.dat.lua>)), C<file_patterns> and C<file_exceptions>
945 (files with the patterns (resp. exceptions) in plain txt), and
946 C<luaspecial> (string).
947
948 The variable C<databases> defaults to C<dat,def>, or C<dat,def,lua> if
949 one of the keys C<file_patterns>, C<file_exceptions> or C<luaspecial> is
950 used.
951
952 =item C<execute AddFormat name=I<fmt> engine=I<eng> [I<var>...]>
953
954 activates the format with name I<fmt> based on the engine I<eng>. The
955 additional variables I<var> are:
956 C<mode> which can only be equal to C<disable> in which case the format
957 will only be mentioned but disabled (prefixed with C<#!>;
958 C<patterns> which gives the patterns file, if not present C<-> is used;
959 C<options> which gives the additional options for the C<fmtutil.cnf> file.
960
961 =back
962
963 =head2 C<postaction>
964
965 specifies a post-install or post-removal action to be
966 executed. The difference to the C<execute> statement is that
967 C<postaction> is concerned with system integration, i.e., adjusting
968 things outside the installation directory, while C<execute> touches
969 only things within the installation.
970
971 The following actions are supported:
972
973 =over 4
974
975 =item C<postaction shortcut name=I<name> type=menu|desktop icon=I<path> cmd=I<cmd> args=I<args> hide=0|1>
976
977 On W32 creates a shortcut either in the main TeX Live menu or on the
978 desktop. See the documentation of L<TeXLive::TLWinGoo> for details.
979
980 =item C<postaction filetype name=I<name> cmd=I<cmd>>
981
982 On W32 associates the file type I<name> with the command I<cmd>.
983
984 =item C<postaction fileassoc extension=I<.ext> filetype=I<name>>
985
986 On W32 declares files with the extenstion I<.ext> of file type I<name>.
987
988 =item C<postaction script file=I<file> [filew32=I<filew32>]>
989
990 This postaction executes the given I<file> with two arguments, the first
991 being either the string C<install> or C<remove>, the second being the
992 root of the installation.
993
994 If the C<filew32> argument is given this script is run on Windows systems
995 instead of the one given via C<file>.
996
997 =back
998
999 =head2 C<tlpsetvar> I<var> I<val>
1000
1001 sets variable I<var> to I<val>. Order matters: the variable can be
1002 expanded with C<${>I<var>C<}>, only after it is defined. Characters
1003 allowed in the I<var> name are C<-_a-zA-Z0-9>.
1004
1005 For example, the Xindy program is not supported on all platforms, so we
1006 define a variable:
1007
1008 tlpsetvar no_xindy_platforms i386-solaris,x86_64-linuxmusl,x86_64-solaris
1009
1010 that can then by used in each C<binpattern> needed:
1011
1012 binpattern f/!${no_xindy_platforms} bin/${ARCH}/texindy
1013 binpattern f/!${no_xindy_platforms} bin/${ARCH}/tex2xindy
1014 ...
1015
1016 (The C<binpattern> details are below; here, just notice the variable
1017 definition and expansion.)
1018
1019 Ordinarily, variables can be used only within the C<.tlpsrc> file where
1020 they are defined. There is one exception: global tlpsrc variables can be
1021 defined in the C<00texlive.autopatterns.tlpsrc> file (mentioned below);
1022 their names must start with C<global_>,
1023 and can only be used in C<depend>, C<execute>, and C<...pattern>
1024 directives, another C<tlpsetvar>. For example, our
1025 C<autopatterns.tlpsrc> defines:
1026
1027 tlpsetvar global_latex_deps babel,cm,hyphen-base,latex-fonts
1028
1029 And then any other C<.tlpsrc> files can use it as
1030 C<${global_latex_deps}>; in this case, C<latex-bin.tlpsrc>,
1031 C<latex-bin-dev.tlpsrc>, C<platex.tlpsrc>, and others (in C<execute
1032 AddFormat> directives).
1033
1034 =head2 C<(src|run|doc|bin)pattern> I<pattern>
1035
1036 adds I<pattern> (next section) to the respective list of patterns.
1037
1038 =head1 PATTERNS
1039
1040 Patterns specify which files are to be included into a C<tlpobj> at
1041 expansion time. Patterns are of the form
1042
1043 [PREFIX]TYPE[/[!]ARCHSPEC] PAT
1044
1045 where
1046
1047 PREFIX = + | +! | !
1048 TYPE = t | f | d | r
1049 ARCHSPEC = <list of architectures separated by comma>
1050
1051 Simple patterns without PREFIX and ARCHSPEC specifications are explained
1052 first.
1053
1054 =over 4
1055
1056 =item C<f> I<path>
1057
1058 includes all files which match C<path> where B<only> the last component
1059 of C<path> can contain the usual glob characters C<*> and C<?> (but no
1060 others!). The special string C<ignore> for I<path> means to ignore this
1061 pattern (used to eliminate the auto-pattern matching).
1062
1063 =item C<d> I<path>
1064
1065 includes all the files in and below the directory specified as C<path>.
1066
1067 =item C<r> I<regexp>
1068
1069 includes all files matching the regexp C</^regexp$/>.
1070
1071 =item C<a> I<name1> [<name2> ...]
1072
1073 includes auto-generated patterns for each I<nameN> as if the package
1074 itself would be named I<nameN>. That is useful if a package (such as
1075 C<venturisadf>) contains top-level directories named after different
1076 fonts.
1077
1078 =item C<t> I<word1 ... wordN wordL>
1079
1080 includes all the files in and below all directories of the form
1081
1082 word1/word2/.../wordN/.../any/dirs/.../wordL/
1083
1084 i.e., all the first words but the last form the prefix of the path, then
1085 there can be an arbitrary number of subdirectories, followed by C<wordL>
1086 as the final directory. This is primarily used in
1087 C<00texlive.autopatterns.tlpsrc> in a custom way, but here is the one
1088 real life example from a standard package, C<omega.tlpsrc>:
1089
1090 runpattern t texmf-dist fonts omega
1091
1092 matches C<texmf-dist/fonts/**/omega>, where C<**> matches any number of
1093 intervening subdirectories, e.g.:
1094
1095 texmf-dist/fonts/ofm/public/omega
1096 texmf-dist/fonts/tfm/public/omega
1097 texmf-dist/fonts/type1/public/omega
1098
1099 =back
1100
1101 =head2 Special patterns
1102
1103 =head3 Prefix characters: C<+> and C<!>
1104
1105 If the C<PREFIX> contains the symbol C<!> the meaning of the pattern is
1106 reversed, i.e., files matching this pattern are removed from the list of
1107 included files.
1108
1109 The prefix C<+> means to append to the list of automatically synthesized
1110 patterns, instead of replacing them.
1111
1112 The C<+> and C<!> prefixes can be combined. This is useful to exclude
1113 directories from the automatic pattern list. For example,
1114 C<graphics.tlpsrc> contains this line:
1115
1116 docpattern +!d texmf-dist/doc/latex/tufte-latex/graphics
1117
1118 so that the subdirectory of the C<tufte-latex> package that happens to
1119 be named "graphics" is not mistakenly included in the C<graphics>
1120 package.
1121
1122 =head2 Auto-generated patterns (C<00texlive.autopatterns>)
1123
1124 If a given pattern section is empty or I<all> the provided patterns have
1125 the prefix C<+> (e.g., C<+f ...>), then patterns such as the following,
1126 listed by type, are I<automatically> added at expansion time. The list
1127 here contains examples, rather than being definitive; the added patterns
1128 are actually taken from C<00texlive.autopatterns.tlpsrc>. (That file
1129 also defines any global tlpsrc variables, as described above under
1130 L</tlpsetvar>).
1131
1132 =over 4
1133
1134 =item C<runpattern>
1135
1136 For category C<Package>:
1137
1138 t texmf-dist I<topdir> %NAME%
1139
1140 where C<%NAME%> means the current package name, and I<topdir> is one of:
1141 C<bibtex> C<context> C<dvips> C<fonts> C<makeindex> C<metafont>
1142 C<metapost> C<mft> C<omega> C<scripts> C<tex>.
1143
1144 For category C<ConTeXt>:
1145
1146 d texmf-dist/tex/context/third/%context-:NAME%
1147 d texmf-dist/metapost/context/third/%context-:NAME%
1148 f texmf-dist/tex/context/interface/third/*%context-:NAME%.xml
1149
1150 (where C<%context-:NAME%> is replaced by the package name with an initial
1151 C<context-> is removed. E.g., if the package is called C<context-foobar>
1152 the replacement in the above rules will be C<foobar>.)
1153
1154 For other categories I<no> patterns are automatically added to the
1155 list of C<runpattern>s.
1156
1157 =item C<docpattern>
1158
1159 for category C<TLCore>:
1160
1161 t texmf-dist doc %NAME%
1162 f texmf-dist/doc/man/man1/%NAME%.*
1163
1164 for category C<Package>:
1165
1166 t texmf-dist doc %NAME%
1167 f texmf-dist/doc/man/man1/%NAME%.*
1168
1169 for category C<ConTeXt>:
1170
1171 d texmf-dist/doc/context/third/%context-:NAME%
1172
1173 =item C<srcpattern>
1174
1175 for category C<Package>:
1176
1177 t texmf-dist source %NAME%
1178
1179 for category C<ConTeXt>:
1180
1181 d texmf-dist/source/context/third/%context-:NAME%
1182
1183 (see above for the C<$NAME%> construct)
1184
1185 =item C<binpattern>
1186
1187 No C<binpattern>s are ever automatically added.
1188
1189 =back
1190
1191 =head3 Special treatment of binpatterns
1192
1193 The binpatterns have to deal with all the different architectures. To
1194 ease the writing of patterns, we have the following features:
1195
1196 =over 4
1197
1198 =item Architecture expansion
1199
1200 Within a binpattern, the string C<${ARCH}> is automatically expanded to
1201 all available architectures.
1202
1203 =item C<bat/exe/dll/texlua> for Windows
1204
1205 C<binpattern>s that match Windows, e.g., C<f bin/windows/foobar> or C<f
1206 bin/${ARCH}/foobar>, also match the files C<foobar.bat>, C<foobar.cmd>,
1207 C<foobar.dll>, C<foobar.exe>, and C<foobar.texlua>.
1208
1209 In addition, C<foobar.exe.manifest> and C<foobar.dll.manifest> are matched.
1210
1211 The above two properties allows to capture the binaries for all
1212 architectures in one binpattern
1213
1214 binpattern f bin/${ARCH}/dvips
1215
1216 and would get C<bin/windows/dvips.exe> into the runfiles for C<arch=windows>.
1217
1218 This C<bat>/C<exe>/etc. expansion I<only> works for patterns of the C<f>
1219 type.
1220
1221 =item ARCHSPEC specification of a pattern
1222
1223 Sometimes files should be included into the list of binfiles of a
1224 package only for some architectures, or for all but some architectures.
1225 This can be done by specifying the list of architectures for which this
1226 pattern should be matched after the pattern specifier using a C</>:
1227
1228 binpattern f/windows tlpkg/bin/perl.exe
1229
1230 will include the file C<tlpkg/bin/perl.exe> only in the binfiles for
1231 the architecture C<windows>. Another example:
1232
1233 binpattern f/arch1,arch2,arch3 path/$ARCH/foo/bar
1234
1235 This will only try to match this pattern for arch1, arch2, and arch3.
1236
1237 Normally, a binpattern is matched against all possible architectures. If
1238 you want to exclude some architectures, instead of listing all the ones
1239 you want to include as above, you can prefix the list of architectures
1240 with a ! and these architectures will not be tested. Example:
1241
1242 binpattern f/!arch1,arch2 path/$ARCH/foo/bar
1243
1244 will be matched against all architectures I<except> arch1 and arch2.
1245
1246 =back
1247
1248 =head1 MEMBER ACCESS FUNCTIONS
1249
1250 For any of the above I<key>s a function
1251
1252 $tlpsrc->key
1253
1254 is available, which returns the current value when called without an argument,
1255 and sets the respective value when called with an argument.
1256
1257 Arguments and return values for C<name>, C<category>, C<shortdesc>,
1258 C<longdesc>, C<catalogue> are single scalars. Arguments and return values
1259 for C<depends>, C<executes>, and the various C<patterns> are lists.
1260
1261 In addition, the C<_srcfile> member refers to the filename for this
1262 C<TLPSRC> object, if set (normally by C<from_file>).
1263
1264 =head1 OTHER FUNCTIONS
1265
1266 The following functions can be called for a C<TLPSRC> object:
1267
1268 =over 4
1269
1270 =item C<new>
1271
1272 The constructor C<new> returns a new C<TLPSRC> object. The arguments
1273 to the C<new> constructor can be in the usual hash representation for
1274 the different keys above:
1275
1276 $tlpsrc = TLPSRC->new(name => "foobar",
1277 shortdesc => "The foobar package");
1278
1279 =item C<from_file("filename")>
1280
1281 Reads a C<tlpsrc> file from disk. C<filename> can either be a full path
1282 (if it's readable, it's used), or just a package identifier such as
1283 C<plain>. In the latter case, the directory searched is the C<tlpsrc>
1284 sibling of the C<TeXLive> package directory where C<TLPSRC.pm> was found.
1285
1286 $tlpsrc=new TeXLive::TLPSRC;
1287 $tlpsrc->from_file("/path/to/the/tlpsrc/somepkg.tlpsrc");
1288 $tlpsrc->from_file("somepkg");
1289
1290 =item C<writeout>
1291
1292 writes the textual representation of a C<TLPSRC> object to stdout, or the
1293 filehandle if given:
1294
1295 $tlpsrc->writeout;
1296 $tlpsrc->writeout(\*FILEHANDLE);
1297
1298 =item C<make_tlpobj($tltree)>
1299
1300 creates a C<TLPOBJ> object from a C<TLPSRC> object and a C<TLTREE> object.
1301 This function does the necessary work to expand the manual data and
1302 enrich it with the content from C<$tltree> to a C<TLPOBJ> object.
1303
1304 =back
1305
1306 =head1 SEE ALSO
1307
1308 The other modules in C<Master/tlpkg/TeXLive/> (L<TeXLive::TLConfig> and
1309 the rest), and the scripts in C<Master/tlpkg/bin/> (especially
1310 C<tl-update-tlpdb>), the documentation in C<Master/tlpkg/doc/>, etc.
1311
1312 =head1 AUTHORS AND COPYRIGHT
1313
1314 This script and its documentation were written for the TeX Live
1315 distribution (L<https://tug.org/texlive>) and both are licensed under the
1316 GNU General Public License Version 2 or later.
1317
1318 =cut
1319
1320 ### Local Variables:
1321 ### perl-indent-level: 2
1322 ### tab-width: 2
1323 ### indent-tabs-mode: nil
1324 ### End:
1325 # vim:set tabstop=2 expandtab: #