"Fossies" - the Fresh Open Source Software Archive

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