summaryrefslogtreecommitdiff
path: root/new-infra/TLSRC.pm
diff options
context:
space:
mode:
Diffstat (limited to 'new-infra/TLSRC.pm')
-rw-r--r--new-infra/TLSRC.pm142
1 files changed, 111 insertions, 31 deletions
diff --git a/new-infra/TLSRC.pm b/new-infra/TLSRC.pm
index 04cba813d7d..804ebc8ccad 100644
--- a/new-infra/TLSRC.pm
+++ b/new-infra/TLSRC.pm
@@ -194,23 +194,6 @@ sub writeout {
sub make_tlp {
my ($self,$tltree) = @_;
- # predefined patterns if all are missing
- if (! ( (defined($self->{'runpatterns'})) ||
- (defined($self->{'srcpatterns'})) ||
- (defined($self->{'docpatterns'})) ||
- (defined($self->{'binpatterns'})) )) {
- if ($self->category eq "Package") {
- foreach my $md (qw/bibtex context dvips fonts makeindex metafont
- metapost mft omega scripts tex vtex/) {
- push @{$self->{'runpatterns'}}, "t texmf-dist $md $self->{'name'}";
- }
- push @{$self->{'docpatterns'}}, "t texmf-dist doc $self->{'name'}";
- push @{$self->{'srcpatterns'}}, "t texmf-dist source $self->{'name'}";
- } elsif ($self->category eq "Documentation") {
- push @{$self->{'docpatterns'}}, "t texmf-doc doc $self->{'name'}";
- push @{$self->{'srcpatterns'}}, "t texmf-doc source $self->{'name'}";
- }
- }
my $tlp = TLP->new;
$tlp->name($self->name);
$tlp->category($self->category);
@@ -221,45 +204,142 @@ sub make_tlp {
$tlp->depends(@{$self->{'depends'}}) if (defined($self->{'depends'}));
$tlp->revision(0);
my $filemax;
+ my $usedefault = 1;
+ my @allpospats;
+ my @allnegpats;
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;
+ }
+ }
+ if ($usedefault) {
+ if ($self->category eq "Package") {
+ foreach my $md (qw/bibtex context dvips fonts makeindex metafont
+ metapost mft omega scripts tex vtex/) {
+ push @allpospats, "t texmf-dist $md $self->{'name'}";
+ }
+ }
+ }
+ 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);
+ }
+ @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;
+ }
+ }
+ 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 (@allpospats) {
$self->_do_normal_pattern($p,$tlp,$tltree,'src');
}
+ foreach my $p (@allnegpats) {
+ $self->_do_normal_pattern($p,$tlp,$tltree,'src',1);
+ }
+ @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);
+ }
+ # 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;
+ }
+ }
+ foreach my $p (@allpospats) {
my $matchref;
$matchref = $tltree->get_matching_files('bin',$p);
my %archmatches = %$matchref;
my @archs = $tltree->architectures;
- my $filemax;
- my @matchfiles;
foreach my $arch (@archs) {
- @matchfiles = @{$archmatches{$arch}};
- foreach my $f (@matchfiles) {
- $filemax = $tltree->file_svn_lastrevision($f);
- $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision);
- }
- $tlp->add_binfiles($arch,@matchfiles);
+ $tlp->add_binfiles($arch,@{$archmatches{$arch}});
+ }
+ }
+ foreach my $p (@allnegpats) {
+ my $matchref;
+ $matchref = $tltree->get_matching_files('bin',$p);
+ my %archmatches = %$matchref;
+ my @archs = $tltree->architectures;
+ foreach my $arch (@archs) {
+ $tlp->remove_binfiles($arch,@{$archmatches{$arch}});
}
}
$tlp->recompute_sizes($tltree);
+ $tlp->recompute_revision($tltree);
return $tlp;
}
sub _do_normal_pattern {
- my ($self,$p,$tlp,$tltree,$type) = @_;
+ my ($self,$p,$tlp,$tltree,$type,$negative) = @_;
my $matchref = $tltree->get_matching_files($type,$p);
my @matchfiles = @$matchref;
- my $filemax;
- foreach my $f (@matchfiles) {
- $filemax = $tltree->file_svn_lastrevision($f);
- $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision);
+ if (defined($negative) && $negative == 1) {
+ $tlp->remove_files($type,@matchfiles);
+ } else {
+ $tlp->add_files($type,@matchfiles);
}
- $tlp->add_files($type,@matchfiles);
}
#