summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLPSRC.pm187
-rwxr-xr-xMaster/tlpkg/bin/tlpsrc2tlpdb68
-rw-r--r--Master/tlpkg/tlpsrc/00texlive.autopatterns.tlpsrc21
3 files changed, 163 insertions, 113 deletions
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm
index 521c75124e1..0a0eb0faeb4 100644
--- a/Master/tlpkg/TeXLive/TLPSRC.pm
+++ b/Master/tlpkg/TeXLive/TLPSRC.pm
@@ -201,7 +201,11 @@ sub writeout
#
sub make_tlpobj
{
- my ($self,$tltree) = @_;
+ my ($self,$tltree,$defaultpatterns) = @_;
+ my %patterns;
+ if (defined($defaultpatterns)) {
+ %patterns = %{$defaultpatterns};
+ }
my $tlp = TeXLive::TLPOBJ->new;
$tlp->name($self->name);
$tlp->category($self->category);
@@ -212,124 +216,67 @@ sub make_tlpobj
$tlp->depends(@{$self->{'depends'}}) if (defined($self->{'depends'}));
$tlp->revision(0);
my $filemax;
- my $usedefault = 1;
+ my $usedefault;
my @allpospats;
my @allnegpats;
+ my $pkgname = $self->name;
#
- # runpatterns
+ # src/run/doc patterns
#
- foreach my $p (@{$self->{'runpatterns'}}) {
- if ($p =~ m/^\+!(.*)$/) {
- push @allnegpats, $1;
- } elsif ($p =~ m/^\+(.*)$/) {
- push @allpospats, $1;
- } elsif ($p =~ m/^!(.*)$/) {
- push @allnegpats, $1;
- $usedefault = 0;
- } else {
- push @allpospats, $p;
- $usedefault = 0;
+ # WARNING WARNING WARNING
+ # the "bin" must be last since we drop through for further dealing
+ # with specialities of the bin patterns!!!!
+ for my $pattype (qw/src run doc bin/) {
+ @allpospats = ();
+ @allnegpats = ();
+ $usedefault = 1;
+ foreach my $p (@{$self->{${pattype} . 'patterns'}}) {
+ if ($p =~ m/^\+!(.*)$/) {
+ push @allnegpats, $1;
+ } elsif ($p =~ m/^\+(.*)$/) {
+ push @allpospats, $1;
+ } elsif ($p =~ m/^!(.*)$/) {
+ push @allnegpats, $1;
+ $usedefault = 0;
+ } else {
+ push @allpospats, $p;
+ $usedefault = 0;
+ }
}
- }
- if ($usedefault) {
- if ($self->category eq "Package") {
- foreach my $md (qw/bibtex context dvips fonts makeindex metafont
- metapost mft omega scripts tex vtex/) {
- # mark the default pattern with a leading * so that
- # we do not warn a missing hit on a default pattern
- push @allpospats, "*t texmf-dist $md $self->{'name'}";
+ if ($usedefault && defined($patterns{$pattype})) {
+ for my $p (@{$patterns{$pattype}}) {
+ # replace the string %NAME% with the actual package name
+ # we have to make a copy of $p otherwise we change it in the
+ # hash once and for all
+ (my $pp = $p) =~ s/%NAME%/$pkgname/g;
+ # sort through the patterns, and make sure that * are added to
+ # tag the default patterns
+ if ($pp =~ m/^!(.*)$/) {
+ push @allnegpats, "*$1";
+ } else {
+ push @allpospats, "*$pp";
+ }
}
}
- }
- foreach my $p (@allpospats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'run');
- }
- foreach my $p (@allnegpats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'run',1);
- }
- #
- # srcpatterns
- #
- @allpospats = ();
- @allnegpats = ();
- $usedefault = 1;
- foreach my $p (@{$self->{'srcpatterns'}}) {
- if ($p =~ m/^\+!(.*)$/) {
- push @allnegpats, $1;
- } elsif ($p =~ m/^\+(.*)$/) {
- push @allpospats, $1;
- } elsif ($p =~ m/^!(.*)$/) {
- push @allnegpats, $1;
- $usedefault = 0;
- } else {
- push @allpospats, $p;
- $usedefault = 0;
+ # at this point we do NOT do the actual pattern matching for
+ # bin patterns, since we have some specialities to do
+ last if ($pattype eq "bin");
+ # for all other patterns we create the list and add the files
+ foreach my $p (@allpospats) {
+ ddebug("pos pattern $p\n");
+ $self->_do_normal_pattern($p,$tlp,$tltree,$pattype);
}
- }
- if ($usedefault) {
- # default patterns for srcfiles
- if ($self->category eq "Package") {
- push @allpospats, "*t texmf-dist source $self->{'name'}";
- } elsif ($self->category eq "Documentation") {
- push @allpospats, "*t texmf-doc source $self->{'name'}";
+ foreach my $p (@allnegpats) {
+ ddebug("neg pattern $p\n");
+ $self->_do_normal_pattern($p,$tlp,$tltree,$pattype,1);
}
}
- foreach my $p (@allpospats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'src');
- }
- foreach my $p (@allnegpats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'src',1);
- }
- #
- # docpatterns
- #
- @allpospats = ();
- @allnegpats = ();
- $usedefault = 1;
- foreach my $p (@{$self->{'docpatterns'}}) {
- if ($p =~ m/^\+!(.*)$/) {
- push @allnegpats, $1;
- } elsif ($p =~ m/^\+(.*)$/) {
- push @allpospats, $1;
- } elsif ($p =~ m/^!(.*)$/) {
- push @allnegpats, $1;
- $usedefault = 0;
- } else {
- push @allpospats, $p;
- $usedefault = 0;
- }
- }
- if ($usedefault) {
- # default patterns for docfiles
- if ($self->category eq "Package") {
- push @allpospats, "*t texmf-dist doc $self->{'name'}";
- } elsif ($self->category eq "Documentation") {
- push @allpospats, "*t texmf-doc doc $self->{'name'}";
- }
- }
- foreach my $p (@allpospats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'doc');
- }
- foreach my $p (@allnegpats) {
- $self->_do_normal_pattern($p,$tlp,$tltree,'doc',1);
- }
#
# binpatterns
#
- # no default patterns for binfiles
- @allpospats = ();
- @allnegpats = ();
- foreach my $p (@{$self->{'binpatterns'}}) {
- if ($p =~ m/^\+!(.*)$/) {
- push @allnegpats, $1;
- } elsif ($p =~ m/^\+(.*)$/) {
- push @allpospats, $1;
- } elsif ($p =~ m/^!(.*)$/) {
- push @allnegpats, $1;
- } else {
- push @allpospats, $p;
- }
- }
+ # mind that @allpospats and @allnegpats have already been set up
+ # in the above loop. We only have to deal with the specialities of
+ # the bin patterns
foreach my $p (@allpospats) {
my @todoarchs = $tltree->architectures;
my $finalp = $p;
@@ -472,17 +419,29 @@ sub catalogue {
sub srcpatterns {
my $self = shift;
if (@_) { @{ $self->{'srcpatterns'} } = @_ }
- return @{ $self->{'srcpatterns'} };
+ if (defined($self->{'srcpatterns'})) {
+ return @{ $self->{'srcpatterns'} };
+ } else {
+ return;
+ }
}
sub docpatterns {
my $self = shift;
if (@_) { @{ $self->{'docpatterns'} } = @_ }
- return @{ $self->{'docpatterns'} };
+ if (defined($self->{'docpatterns'})) {
+ return @{ $self->{'docpatterns'} };
+ } else {
+ return;
+ }
}
sub binpatterns {
my $self = shift;
if (@_) { @{ $self->{'binpatterns'} } = @_ }
- return @{ $self->{'binpatterns'} };
+ if (defined($self->{'binpatterns'})) {
+ return @{ $self->{'binpatterns'} };
+ } else {
+ return;
+ }
}
sub depends {
my $self = shift;
@@ -492,7 +451,11 @@ sub depends {
sub runpatterns {
my $self = shift;
if (@_) { @{ $self->{'runpatterns'} } = @_ }
- return @{ $self->{'runpatterns'} };
+ if (defined($self->{'runpatterns'})) {
+ return @{ $self->{'runpatterns'} };
+ } else {
+ return;
+ }
}
sub executes {
my $self = shift;
@@ -746,7 +709,9 @@ package.
If a given pattern section is empty or B<all> the provided patterns have
the prefix C<+> (e.g., C<+f ...>), then the following patterns, listed
-by type are I<automatically> added at expansion time:
+by type are I<automatically> added at expansion time. Note that this list
+is not definitive, but is taken from the patterns of tlpsrc files
+named C<00texlive.autopatterns.>I<Category>C<.tlpsrc>.
=over 4
diff --git a/Master/tlpkg/bin/tlpsrc2tlpdb b/Master/tlpkg/bin/tlpsrc2tlpdb
index 4d7960eeb1d..dcc857cad14 100755
--- a/Master/tlpkg/bin/tlpsrc2tlpdb
+++ b/Master/tlpkg/bin/tlpsrc2tlpdb
@@ -31,6 +31,7 @@ my $help = 0;
my $opt_nobinsplit = 0;
my $opt_winwarning;
my $opt_fromfiles = 0;
+my $opt_noautopatterns = 0;
TeXLive::TLUtils::process_logging_options();
GetOptions(
@@ -38,6 +39,7 @@ GetOptions(
"master=s" => \$opt_master, # location of the TL tree
"catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue
"no-bin-split!" => \$opt_nobinsplit,
+ "no-autopatterns" => \$opt_noautopatterns,
"from-files" => \$opt_fromfiles,
"with-win-pattern-warning" => \$opt_winwarning,
"help|?" => \$help) or pod2usage(1);
@@ -63,9 +65,66 @@ sub main
$tlc = TeXLive::TeXCatalogue->new ("location" => $opt_catalogue);
}
+ my $tlpsrc_dir = "$opt_master/tlpkg/tlpsrc";
+
+ # get the default patterns
+ my %autopatterns;
+ if (! $opt_noautopatterns) {
+ my $apfile = "$tlpsrc_dir/00texlive.autopatterns.tlpsrc";
+ if (! -r $apfile) {
+ if (! $opt_noautopatterns) {
+ tlwarn ("No autopatterns tlpsrc 00texlive.autopatterns.tlpsrc found.\n");
+ tlwarn ("Stopping here. If you want to continue either add the above file\n");
+ tlwarn ("or call tlpsrc with --no-autopatterns.\n");
+ exit 1;
+ }
+ }
+ my $tlsrc = new TeXLive::TLPSRC;
+ $tlsrc->from_file ( $apfile );
+ if ($tlsrc->binpatterns) {
+ for my $p ($tlsrc->binpatterns) {
+ my ($cat, @rest) = split ' ', $p;
+ push @{$autopatterns{$cat}{"bin"}}, join(' ', @rest);
+ }
+ }
+ if ($tlsrc->srcpatterns) {
+ for my $p ($tlsrc->srcpatterns) {
+ my ($cat, @rest) = split ' ', $p;
+ push @{$autopatterns{$cat}{"src"}}, join(' ', @rest);
+ }
+ }
+ if ($tlsrc->docpatterns) {
+ for my $p ($tlsrc->docpatterns) {
+ my ($cat, @rest) = split ' ', $p;
+ push @{$autopatterns{$cat}{"doc"}}, join(' ', @rest);
+ }
+ }
+ if ($tlsrc->runpatterns) {
+ for my $p ($tlsrc->runpatterns) {
+ my ($cat, @rest) = split ' ', $p;
+ push @{$autopatterns{$cat}{"run"}}, join(' ', @rest);
+ }
+ }
+
+ for my $cat (keys %autopatterns) {
+ debug ("Category $cat\n");
+ for my $d (@{$autopatterns{$cat}{"bin"}}) {
+ debug ("Found auto bin pattern $d\n");
+ }
+ for my $d (@{$autopatterns{$cat}{"src"}}) {
+ debug ("Found auto src pattern $d\n");
+ }
+ for my $d (@{$autopatterns{$cat}{"doc"}}) {
+ debug ("Found auto doc pattern $d\n");
+ }
+ for my $d (@{$autopatterns{$cat}{"run"}}) {
+ debug ("Found auto run pattern $d\n");
+ }
+ }
+ } # end of if (! $opt_noautopatterns)
+
# if we're regenerating the whole thing, get all our tlpsrc files.
if ($opt_all) {
- my $tlpsrc_dir = "$opt_master/tlpkg/tlpsrc";
chdir ($tlpsrc_dir) || die "chdir($tlpsrc_dir) failed: $!";
@ARGV = glob ("*.tlpsrc");
}
@@ -82,11 +141,16 @@ sub main
my $tldb = TeXLive::TLPDB->new;
my $src_count = 0;
foreach my $f (@ARGV) {
+ next if ($f =~ m/^00texlive\.autopatterns/);
$src_count++ if $opt_all;
my $tlsrc = new TeXLive::TLPSRC;
$tlsrc->from_file ($f);
- my $tlp = $tlsrc->make_tlpobj ($tltree);
+ my $patternref;
+ if (defined($autopatterns{$tlsrc->category})) {
+ $patternref = $autopatterns{$tlsrc->category};
+ }
+ my $tlp = $tlsrc->make_tlpobj ($tltree, $autopatterns{$tlsrc->category});
(my $base_f = $f) =~ s/\.tlpsrc$//;
warn "$f: package name " . $tlp->name . " does not match filename\n"
diff --git a/Master/tlpkg/tlpsrc/00texlive.autopatterns.tlpsrc b/Master/tlpkg/tlpsrc/00texlive.autopatterns.tlpsrc
new file mode 100644
index 00000000000..a23dce1d5eb
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/00texlive.autopatterns.tlpsrc
@@ -0,0 +1,21 @@
+name 00texlive.autopatterns
+category TLCore
+shortdesc Defines the automatically generated patterns
+# auto patterns for category Package
+runpattern Package t texmf-dist bibtex %NAME%
+runpattern Package t texmf-dist context %NAME%
+runpattern Package t texmf-dist dvips %NAME%
+runpattern Package t texmf-dist fonts %NAME%
+runpattern Package t texmf-dist makeindex %NAME%
+runpattern Package t texmf-dist metafont %NAME%
+runpattern Package t texmf-dist metapost %NAME%
+runpattern Package t texmf-dist mft %NAME%
+runpattern Package t texmf-dist omega %NAME%
+runpattern Package t texmf-dist scripts %NAME%
+runpattern Package t texmf-dist tex %NAME%
+runpattern Package t texmf-dist vtex %NAME%
+srcpattern Package t texmf-dist source %NAME%
+docpattern Package t texmf-dist doc %NAME%
+# auto patterns for category Documentation
+srcpattern Documentation t texmf-doc source %NAME%
+docpattern Documentation t texmf-doc doc %NAME%