diff options
author | Norbert Preining <preining@logic.at> | 2007-05-24 08:36:50 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-05-24 08:36:50 +0000 |
commit | 1c9a20ae1070a4bd920aff7deb70e553569b4cc9 (patch) | |
tree | 131a59ab19b2126053e2cb9afc1e01e99598e0d3 | |
parent | 2c863339ea98cde989caaede49639f33ff7093e9 (diff) |
more modules games
git-svn-id: svn://tug.org/texlive/trunk@4353 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | new-infra/TLP.pm | 24 | ||||
-rw-r--r-- | new-infra/TLSRC.pm | 44 | ||||
-rw-r--r-- | new-infra/TLTREE.pm | 4 | ||||
-rw-r--r-- | new-infra/test-modules.pl | 23 | ||||
-rw-r--r-- | new-infra/test-tlsrc.pl | 2 | ||||
-rw-r--r-- | new-infra/test-tltree.pl | 6 |
6 files changed, 65 insertions, 38 deletions
diff --git a/new-infra/TLP.pm b/new-infra/TLP.pm index d3d12aebccb..74d642e8459 100644 --- a/new-infra/TLP.pm +++ b/new-infra/TLP.pm @@ -16,12 +16,12 @@ sub new { shortdesc => $params{'shortdesc'}, longdesc => $params{'longdesc'}, catalogue => $params{'catalogue'}, - runfiles => $params{'runfiles'}, - srcfiles => $params{'srcpatterns'}, - docfiles => $params{'docfiles'}, - binfiles => $params{'binfiles'}, - executes => $params{'executes'}, - depends => $params{'depends'}, + runfiles => defined($params{'runfiles'}) ? $params{'runfiles'} : [], + srcfiles => defined($params{'srcfiles'}) ? $params{'srcfiles'} : [], + docfiles => defined($params{'docfiles'}) ? $params{'docfiles'} : [], + binfiles => defined($params{'binfiles'}) ? $params{'binfiles'} : [], + executes => defined($params{'executes'}) ? $params{'executes'} : [], + depends => defined($params{'depends'}) ? $params{'depends'} : [], revision => $params{'revision'}, }; bless $self, $class; @@ -131,25 +131,25 @@ sub writeout { } if (defined($self->{'srcfiles'}) && (@{$self->{'srcfiles'}})) { print $fd "srcfiles\n"; - foreach (@{$self->{'srcfiles'}}) { + foreach (sort @{$self->{'srcfiles'}}) { print $fd " $_\n"; } } if (defined($self->{'runfiles'}) && (@{$self->{'runfiles'}})) { print $fd "runfiles\n"; - foreach (@{$self->{'runfiles'}}) { + foreach (sort @{$self->{'runfiles'}}) { print $fd " $_\n"; } } if (defined($self->{'docfiles'}) && (@{$self->{'docfiles'}})) { print $fd "docfiles\n"; - foreach (@{$self->{'docfiles'}}) { + foreach (sort @{$self->{'docfiles'}}) { print $fd " $_\n"; } } if (defined($self->{'binfiles'}) && (@{$self->{'binfiles'}})) { print $fd "binfiles\n"; - foreach (@{$self->{'binfiles'}}) { + foreach (sort @{$self->{'binfiles'}}) { print $fd " $_\n"; } } @@ -219,6 +219,10 @@ sub add_runfiles { my ($self,@files) = @_; push @{ $self->{'runfiles'} }, @files; } +sub add_files { + my ($self,$type,@files) = @_; + push @{ $self->{$type} }, @files; +} sub depends { my $self = shift; if (@_) { @{ $self->{'depends'} } = @_ } diff --git a/new-infra/TLSRC.pm b/new-infra/TLSRC.pm index 2cc88a478da..f496f384e37 100644 --- a/new-infra/TLSRC.pm +++ b/new-infra/TLSRC.pm @@ -19,12 +19,12 @@ sub new { shortdesc => $params{'shortdesc'}, longdesc => $params{'longdesc'}, catalogue => $params{'catalogue'}, - runpatterns => $params{'runpatterns'}, - srcpatterns => $params{'srcpatterns'}, - docpatterns => $params{'docpatterns'}, - binpatterns => $params{'binpatterns'}, - executes => $params{'executes'}, - depends => $params{'depends'}, + runpatterns => defined($params{'runpatterns'}) ? $params{'runpatterns'} : [], + srcpatterns => defined($params{'srcpatterns'}) ? $params{'srcpatterns'} : [], + docpatterns => defined($params{'docpatterns'}) ? $params{'docpatterns'} : [], + binpatterns => defined($params{'binpatterns'}) ? $params{'binpatterns'} : [], + executes => defined($params{'executes'}) ? $params{'executes'} : [], + depends => defined($params{'depends'}) ? $params{'depends'} : [], }; bless $self, $class; return $self; @@ -147,25 +147,25 @@ sub writeout { } if (defined($self->{'srcpatterns'}) && (@{$self->{'srcpatterns'}})) { print $fd "srcpatterns\n"; - foreach (@{$self->{'srcpatterns'}}) { + foreach (sort @{$self->{'srcpatterns'}}) { print $fd " $_\n"; } } if (defined($self->{'runpatterns'}) && (@{$self->{'runpatterns'}})) { print $fd "runpatterns\n"; - foreach (@{$self->{'runpatterns'}}) { + foreach (sort @{$self->{'runpatterns'}}) { print $fd " $_\n"; } } if (defined($self->{'docpatterns'}) && (@{$self->{'docpatterns'}})) { print $fd "docpatterns\n"; - foreach (@{$self->{'docpatterns'}}) { + foreach (sort @{$self->{'docpatterns'}}) { print $fd " $_\n"; } } if (defined($self->{'binpatterns'}) && (@{$self->{'binpatterns'}})) { print $fd "binpatterns\n"; - foreach (@{$self->{'binpatterns'}}) { + foreach (sort @{$self->{'binpatterns'}}) { print $fd " $_\n"; } } @@ -190,12 +190,12 @@ sub make_tlp { push @{$self->{'srcpatterns'}}, "t texmf-dist source $tlp"; } my $tlp = TLP->new; - $tlp->name($tlsrc->name); + $tlp->name($self->name); $tlp->shortdesc($self->{'shortdesc'}) if (defined($self->{'shortdesc'})); - $tlp->longdesc($self->{'longdesc'}) if (defined($tls{$tlp}{'longdesc'})); - $tlp->catalogue($self->{'catalogue'}) if (defined($tls{$tlp}{'catalogue'})); - $tlp->executes($self->{'executes'}) if (defined($tls{$tlp}{'executes'})); - $tlp->depends($self->{'depends'}) if (defined($tls{$tlp}{'depends'})); + $tlp->longdesc($self->{'longdesc'}) if (defined($self->{'longdesc'})); + $tlp->catalogue($self->{'catalogue'}) if (defined($self->{'catalogue'})); + $tlp->executes(@{$self->{'executes'}}) if (defined($self->{'executes'})); + $tlp->depends(@{$self->{'depends'}}) if (defined($self->{'depends'})); $tlp->revision(0); my $filemax; foreach my $p (@{$self->{'runpatterns'}}) { @@ -230,26 +230,29 @@ sub make_tlp { $self->_do_regexp_pattern($tlp,$tltree,'binfiles',$p); } } + return $tlp; } sub _do_leaf_pattern { my ($self,$tlp,$tltree,$type,@patwords) = @_; - my @matchfiles = $tltree->get_files_matching_dir_pattern($type,$patwords); + my @matchfiles = $tltree->get_files_matching_dir_pattern($type,@patwords); my $filemax; foreach my $f (@matchfiles) { $filemax = $tltree->file_svn_lastrevision($f); - $tlp->revision($filemax > $tlp->revision ? : $filemax : $tlp->revision); + $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); } + $tlp->add_files($type,@matchfiles); } sub _do_regexp_pattern { - my ($self,$tltree,$tlp,$filetype,$p) = @_; + my ($self,$tlp,$tltree,$type,$p) = @_; my @matchfiles = $tltree->get_files_matching_regexp_pattern($type,$p); my $filemax; foreach my $f (@matchfiles) { $filemax = $tltree->file_svn_lastrevision($f); - $tlp->revision($filemax > $tlp->revision ? : $filemax : $tlp->revision); + $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); } + $tlp->add_files($type,@matchfiles); } sub pattern_hit { @@ -258,16 +261,13 @@ sub pattern_hit { $pattern =~ /^(d|f|t)\s+(.*)$/; my $pattype = $1; my $patdata = $2; - logit("pattype=...$pattype...patdata=...$patdata...\n"); if ($pattype eq "d") { pop @dirs ; my $foo = join "/",@dirs; - logit("matching [d] >>>$patdata<<< against >>>$foo<<<\n"); if ($foo =~ /^$patdata$/) { return 1; } } elsif ($pattype eq "f") { - logit("matching [f] >>>$patdata<<< against >>>$file<<<\n"); if ($file =~ /^$patdata$/) { return 1; } diff --git a/new-infra/TLTREE.pm b/new-infra/TLTREE.pm index 0240168bd57..9da7844f800 100644 --- a/new-infra/TLTREE.pm +++ b/new-infra/TLTREE.pm @@ -70,7 +70,7 @@ sub _initialize_lines { chdir($oldpwd); } -sub print_tree { +sub print { my $self = shift; $self->walk_tree(\&print_node); } @@ -191,6 +191,7 @@ sub get_files_matching_regexp_pattern { next FILELABEL; } } + return(@returnfiles); } sub _pattern_hit { @@ -242,7 +243,6 @@ sub files_under_path { foreach my $aa (@{$self->{'_filesofdir'}{$p}}) { push_uniq( \@files, $p . "/" . $aa); } - print "p=$p\n"; if (defined($self->{'_subdirsofdir'}{$p})) { foreach my $sd (@{$self->{'_subdirsofdir'}{$p}}) { my @sdf = $self->files_under_path($p . "/" . $sd); diff --git a/new-infra/test-modules.pl b/new-infra/test-modules.pl new file mode 100644 index 00000000000..d054747372c --- /dev/null +++ b/new-infra/test-modules.pl @@ -0,0 +1,23 @@ +#!/usr/bin/env perl -w + +use strict; + +use TLSRC; +use TLP; +use TLTREE; +use Data::Dumper; + +my $tltree = TLTREE->new( 'svnroot' => "/src/TeX/texlive-svn/new-infra" ); +$tltree->init_from_svn; + +foreach my $f (@ARGV) { + my $tlsrc = new TLSRC; + $tlsrc->from_file($f); + my $tlp = $tlsrc->make_tlp($tltree); + my $name = $tlp->name; + open(FOO,">$name.tlp"); + $tlp->writeout(\*FOO); + close(FOO); +} + + diff --git a/new-infra/test-tlsrc.pl b/new-infra/test-tlsrc.pl index 8a2db80660b..2ac1a7d2d9c 100644 --- a/new-infra/test-tlsrc.pl +++ b/new-infra/test-tlsrc.pl @@ -5,7 +5,7 @@ use strict; use TLSRC; my $tlsrc = new TLSRC; -$tlsrc->from_file("tlsrc/foo.tlsrc"); +$tlsrc->from_file("tlsrc/bar.tlsrc"); $tlsrc->writeout(); my $tl = TLSRC->new( 'name' => "foobar", diff --git a/new-infra/test-tltree.pl b/new-infra/test-tltree.pl index 5e718923379..d0648005dec 100644 --- a/new-infra/test-tltree.pl +++ b/new-infra/test-tltree.pl @@ -12,7 +12,7 @@ $tl->init_from_svn; #print Dumper($tl); -#$tl->print_tree; +#$tl->print; my $fn="texmf-dist/fonts/tfm/baz/file1"; print "$fn rev = ", $tl->file_svn_lastrevision($fn), "\n"; @@ -21,7 +21,7 @@ my @foo = $tl->get_files_matching_dir_pattern('binfiles',"texmf-dist","fonts"); print "files under texmf-dist fonts = @foo\n"; -@foo = $tl->get_files_matiching_regexp_pattern('binfiles',"f texmf-dist/.*"); +@foo = $tl->get_files_matching_regexp_pattern('binfiles',"f texmf/.*/bar/.*"); -print "files mathcing f texmf-dist/.*: @foo\n"; +print "files mathcing f texmf/.*/bar/.*: @foo\n"; |