diff options
author | Norbert Preining <preining@logic.at> | 2007-05-25 14:12:19 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-05-25 14:12:19 +0000 |
commit | c4d0fdb86e606e03ebde03093d7f14424ac02be5 (patch) | |
tree | 304fd25dc09136d7291008a868cea85758c14c15 /new-infra | |
parent | 535e1925d78f14edf8c4aece8b3d2caf5c85b93b (diff) |
first draft on multi-arch support. needs some work still in TLSRC.pm
TLP.pm should already work. Also added at the same time is the size= tag
on the *files lines.
git-svn-id: svn://tug.org/texlive/trunk@4370 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'new-infra')
-rw-r--r-- | new-infra/Perl-API.txt | 8 | ||||
-rw-r--r-- | new-infra/TLP.pm | 127 | ||||
-rw-r--r-- | new-infra/TLSRC.pm | 52 | ||||
-rw-r--r-- | new-infra/TODO | 8 | ||||
-rw-r--r-- | new-infra/specification.txt | 22 | ||||
-rw-r--r-- | new-infra/test-tlp.pl | 9 |
6 files changed, 169 insertions, 57 deletions
diff --git a/new-infra/Perl-API.txt b/new-infra/Perl-API.txt index 31f8c490305..de9febafe11 100644 --- a/new-infra/Perl-API.txt +++ b/new-infra/Perl-API.txt @@ -77,13 +77,15 @@ Read/Write functions (with argument set, without arg read) adds @files to the list of srcfiles $tlp->add_docfiles(@files) adds @files to the list of docfiles - $tlp->add_binfiles(@files) - adds @files to the list of binfiles $tlp->add_runfiles(@files) adds @files to the list of runfiles + + $tlp->add_binfiles($arch,@files) + adds @files to the list of binfiles for arch=$arch $tlp->add_files($type,@files) - adds @files to the list of $type = (run|doc|bin|src)files + adds @files to the list of $type = (run|doc|src)files + NOT FOR binfiles! Module TLTREE diff --git a/new-infra/TLP.pm b/new-infra/TLP.pm index a36a644cf7c..96450cd62de 100644 --- a/new-infra/TLP.pm +++ b/new-infra/TLP.pm @@ -21,10 +21,15 @@ sub new { longdesc => $params{'longdesc'}, catalogue => $params{'catalogue'}, runfiles => defined($params{'runfiles'}) ? $params{'runfiles'} : [], + runsize => $params{'runsize'}, srcfiles => defined($params{'srcfiles'}) ? $params{'srcfiles'} : [], + srcsize => $params{'srcsize'}, docfiles => defined($params{'docfiles'}) ? $params{'docfiles'} : [], - binfiles => defined($params{'binfiles'}) ? $params{'binfiles'} : [], + docsize => $params{'docsize'}, executes => defined($params{'executes'}) ? $params{'executes'} : [], + # note that binfiles is an ARRAY with keys of $arch! + binfiles => defined($params{'binfiles'}) ? $params{'binfiles'} : {}, + binsize => defined($params{'binsize'}) ? $params{'binsize'} : {}, depends => defined($params{'depends'}) ? $params{'depends'} : [], revision => $params{'revision'}, }; @@ -32,15 +37,6 @@ sub new { return $self; } -# sub from_file { -# my $self = shift; -# if (@_ != 1) { -# die("Need a filename for initialization!"); -# } -# open(TMP,"<$_[0]") || die("Cannot open tlp file: $_[0]"); -# my @lines = <TMP>; -# close(TMP); - sub from_file { my $self = shift; if (@_ != 1) { @@ -54,6 +50,8 @@ sub from_fh { my ($self,$fh,$multi) = @_; my $started = 0; my $lastcmd = ""; + my $arch; + my $size; while (my $line = $fh->getline) { $line =~ /^\s*#/ && next; # skip comment lines @@ -75,7 +73,7 @@ sub from_fh { ($lastcmd eq "srcfiles") || ($lastcmd eq "executes") || ($lastcmd eq "depend") ) { - $line =~ s/^ /$lastcmd /; + $line =~ s/^ /${lastcmd}continued /; } else { die("Continuation of $lastcmd not allowed, please fix tlp!\n"); } @@ -92,8 +90,8 @@ sub from_fh { $self->{'shortdesc'} .= "$1 "; $lastcmd = "shortdesc"; next; - } elsif ($line =~ /^longdesc\s+(.*)$/) { - $self->{'longdesc'} .= "$1 "; + } elsif ($line =~ /^longdesc(continued)?\s+(.*)$/) { + $self->{'longdesc'} .= "$2 "; $lastcmd = "longdesc"; next; } elsif ($line =~ /^revision\s+(.*)$/) { @@ -104,28 +102,54 @@ sub from_fh { $self->catalogue("$1"); $lastcmd = "catalogue"; next; - } elsif ($line =~ /^runfiles\s+(.*)$/) { - push @{$self->{'runfiles'}}, "$1" unless "$1" eq ""; - $lastcmd = "runfiles"; - next; - } elsif ($line =~ /^srcfiles\s+(.*)$/) { - push @{$self->{'srcfiles'}}, "$1" unless "$1" eq ""; - $lastcmd = "srcfiles"; + } elsif ($line =~ /^(doc|src|run)files\s+/) { + my $type = $1; + my @words = split ' ',$line; + # first entry is "XXXfiles", shift it away + $lastcmd = shift @words; + while (@words) { + $_ = shift @words; + if (/^size=(.*)$/) { + $size=$1; + } else { + die "Unknown tag: $line"; + } + } + if (defined($size)) { + $self->{"${type}size"} = $size; + } next; - } elsif ($line =~ /^docfiles\s+(.*)$/) { - push @{$self->{'docfiles'}}, "$1" unless "$1" eq ""; - $lastcmd = "docfiles"; + } elsif ($line =~ /^(doc|src|run)filescontinued\s+(.*)$/) { + push @{$self->{$1."files"}}, "$2"; next; - } elsif ($line =~ /^binfiles\s+(.*)$/) { - push @{$self->{'binfiles'}}, "$1" unless "$1" eq ""; + } elsif ($line =~ /^binfiles\s+/) { + my @words = split ' ',$line; + # first entry is "binfiles", shift it away + shift @words; + while (@words) { + $_ = shift @words; + if (/^arch=(.*)$/) { + $arch=$1; + } elsif (/^size=(.*)$/) { + $size=$1; + } else { + die "Unknown tag: $line"; + } + } + if (defined($size)) { + $self->{'binsize'}{$arch} = $size; + } $lastcmd = "binfiles"; next; - } elsif ($line =~ /^execute\s*(.*)$/) { - push @{$self->{'executes'}}, "$1" unless "$1" eq ""; + } elsif ($line =~ /^binfilescontinued\s+(.*)$/) { + push @{$self->{'binfiles'}{$arch}}, "$1"; + next; + } elsif ($line =~ /^execute(continued)?\s*(.*)$/) { + push @{$self->{'executes'}}, "$2" unless "$2" eq ""; $lastcmd = "execute"; next; - } elsif ($line =~ /^depend\s*(.*)$/) { - push @{$self->{'depends'}}, "$1" unless "$1" eq ""; + } elsif ($line =~ /^depend(continued)?\s*(.*)$/) { + push @{$self->{'depends'}}, "$2" unless "$2" eq ""; $lastcmd = "depend"; next; } else { @@ -170,18 +194,20 @@ sub writeout { print $fd " $_\n"; } } - if (defined($self->{'binfiles'}) && (@{$self->{'binfiles'}})) { - print $fd "binfiles\n"; - foreach (sort @{$self->{'binfiles'}}) { - print $fd " $_\n"; - } - } if (defined($self->{'runfiles'}) && (@{$self->{'runfiles'}})) { print $fd "runfiles\n"; foreach (sort @{$self->{'runfiles'}}) { print $fd " $_\n"; } } + foreach my $arch (keys %{$self->{'binfiles'}}) { + if (@{$self->{'binfiles'}{$arch}}) { + print $fd "binfiles arch=$arch size=", $self->{'binsize'}{$arch}, "\n"; + foreach (sort @{$self->{'binfiles'}{$arch}}) { + print $fd " $_\n"; + } + } + } } sub make_zip { @@ -228,6 +254,11 @@ sub srcfiles { if (@_) { @{ $self->{'srcfiles'} } = @_ } return @{ $self->{'srcfiles'} }; } +sub srcsize { + my $self = shift; + if (@_) { @{ $self->{'srcsize'} } = @_ } + return @{ $self->{'srcsize'} }; +} sub add_srcfiles { my ($self,@files) = @_; push @{ $self->{'srcfiles'} }, @files; @@ -237,30 +268,48 @@ sub docfiles { if (@_) { @{ $self->{'docfiles'} } = @_ } return @{ $self->{'docfiles'} }; } +sub docsize { + my $self = shift; + if (@_) { @{ $self->{'docsize'} } = @_ } + return @{ $self->{'docsize'} }; +} sub add_docfiles { my ($self,@files) = @_; push @{ $self->{'docfiles'} }, @files; } sub binfiles { my $self = shift; - if (@_) { @{ $self->{'binfiles'} } = @_ } - return @{ $self->{'binfiles'} }; + my %newfiles = @_; + if (@_) { $self->{'binfiles'} = \%newfiles } + return $self->{'binfiles'}; +} +sub binsizes { + my $self = shift; + my %newsizes = @_; + if (@_) { $self->{'binsizes'} = \%newsizes } + return $self->{'binsizes'}; } sub add_binfiles { - my ($self,@files) = @_; - push @{ $self->{'binfiles'} }, @files; + my ($self,$arch,@files) = @_; + push @{ $self->{'binfiles'}{$arch} }, @files; } sub runfiles { my $self = shift; if (@_) { @{ $self->{'runfiles'} } = @_ } return @{ $self->{'runfiles'} }; } +sub runsize { + my $self = shift; + if (@_) { @{ $self->{'runsize'} } = @_ } + return @{ $self->{'runsize'} }; +} sub add_runfiles { my ($self,@files) = @_; push @{ $self->{'runfiles'} }, @files; } sub add_files { my ($self,$type,@files) = @_; + die("Cannot use add_files for binfiles, we need that arch!") if ($type eq "bin"); push @{ $self->{$type} }, @files; } sub depends { diff --git a/new-infra/TLSRC.pm b/new-infra/TLSRC.pm index 5effd8451e2..e6ecba9db9b 100644 --- a/new-infra/TLSRC.pm +++ b/new-infra/TLSRC.pm @@ -11,6 +11,11 @@ package TLSRC; use TLP; use TLTREE; +print "WARNING WARNING WARNING\n"; +print "format of TLP files has changed, we need to adapt the TLSRC !!!\n"; +print "Multiple *files arch=... size=....\n"; +die; + sub new { my $class = shift; my %params = @_; @@ -203,35 +208,39 @@ sub make_tlp { $tlp->revision(0); my $filemax; foreach my $p (@{$self->{'runpatterns'}}) { - my ($pattype,@patwords) = split ' ',$p; + my $q = _expand_patterns($p); + my ($pattype,@patwords) = split ' ',$q; if ($pattype eq "t") { $self->_do_leaf_pattern($tlp,$tltree,'runfiles',@patwords); } else { - $self->_do_regexp_pattern($tlp,$tltree,'runfiles',$p); + $self->_do_regexp_pattern($tlp,$tltree,'runfiles',$q); } } foreach my $p (@{$self->{'srcpatterns'}}) { - my ($pattype,@patwords) = split ' ',$p; + my $q = _expand_patterns($p); + my ($pattype,@patwords) = split ' ',$q; if ($pattype eq "t") { $self->_do_leaf_pattern($tlp,$tltree,'srcfiles',@patwords); } else { - $self->_do_regexp_pattern($tlp,$tltree,'srcfiles',$p); + $self->_do_regexp_pattern($tlp,$tltree,'srcfiles',$q); } } foreach my $p (@{$self->{'docpatterns'}}) { - my ($pattype,@patwords) = split ' ',$p; + my $q = _expand_patterns($p); + my ($pattype,@patwords) = split ' ',$q; if ($pattype eq "t") { $self->_do_leaf_pattern($tlp,$tltree,'docfiles',@patwords); } else { - $self->_do_regexp_pattern($tlp,$tltree,'docfiles',$p); + $self->_do_regexp_pattern($tlp,$tltree,'docfiles',$q); } } foreach my $p (@{$self->{'binpatterns'}}) { - my ($pattype,@patwords) = split ' ',$p; + my $q = _expand_patterns($p); + my ($pattype,@patwords) = split ' ',$q; if ($pattype eq "t") { $self->_do_leaf_pattern($tlp,$tltree,'binfiles',@patwords); } else { - $self->_do_regexp_pattern($tlp,$tltree,'binfiles',$p); + $self->_do_regexp_pattern($tlp,$tltree,'binfiles',$q); } } return $tlp; @@ -245,7 +254,12 @@ sub _do_leaf_pattern { $filemax = $tltree->file_svn_lastrevision($f); $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); } - $tlp->add_files($type,@matchfiles); + if ($type eq "bin") { + # we have to do something with the architecture!!! + $tlp->add_binfiles($arch,@matchfiles); + } else { + $tlp->add_files($type,@matchfiles); + } } sub _do_regexp_pattern { @@ -256,7 +270,12 @@ sub _do_regexp_pattern { $filemax = $tltree->file_svn_lastrevision($f); $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); } - $tlp->add_files($type,@matchfiles); + if ($type eq "bin") { + # we have to do something with the architecture!!! + $tlp->add_binfiles($arch,@matchfiles); + } else { + $tlp->add_files($type,@matchfiles); + } } sub pattern_hit { @@ -282,6 +301,19 @@ sub pattern_hit { } # +# sub _expand_patterns +# used to expand embedded variables in patterns like ${arch} etc +# +# only variables of the form +# ${variablename} +# are allowed. +sub _expand_patterns { + my ($p) = @_; + printf STDERR "WARNING: _expand_patterns not implemented\n"; + return ($p); +} + +# # member access functions # sub name { diff --git a/new-infra/TODO b/new-infra/TODO index 88ecccc77f4..710192efea8 100644 --- a/new-infra/TODO +++ b/new-infra/TODO @@ -1,6 +1,14 @@ TODO for new-infra ================== - TLSRC.pm: ${arch} etc for file lists/patterns + needs adaption of the format of *patterns in tlsrc (?we could add + the .exe on Win32 automatically) and *files in tlp + Format should be: + tlp: + runfiles arch=... + file1 + file2 + runfiles arch=... file - move several functions from TLTREE to a module TLUtils (push_uniq etc) - use push_uniq in TLP.pm add_files ... we have multiple occurrences of files - TLP.pm: make_zip function diff --git a/new-infra/specification.txt b/new-infra/specification.txt index d6fb56ed281..05c205ed275 100644 --- a/new-infra/specification.txt +++ b/new-infra/specification.txt @@ -106,16 +106,34 @@ same format as tlsrc, but the keys are shortdesc longdesc catalogue - binfiles runfiles docfiles srcfiles + binfiles execute depend ??? what am I missing ??? Interpretation - obvious + bin|src|doc|runfiles MUST be saved in multi line entries with + continuation lines intended by one (1) space. all of them + can have (must have?) the size tag size=......, in addition + binfiles can have the arch tag arch=... + /---------- + |docfiles size=.... + | file1 + | file2 + | ... + For binfiles the architecture can be given on the binfile line: + /------------ + |binfiles arch=i386-solaris size=.... + | file1 + | file2 + | file3 + | ... + Note that only *ONE* *files entry per tlp is allowed + + rest obvious revision maxmimum of all the last_changed_revisions of all diff --git a/new-infra/test-tlp.pl b/new-infra/test-tlp.pl index b27d219889c..51a3a5f61c6 100644 --- a/new-infra/test-tlp.pl +++ b/new-infra/test-tlp.pl @@ -1,10 +1,13 @@ #!/usr/bin/perl -w use strict; +use Data::Dumper; use TLP; -my $tlsrc = new TLP; -$tlsrc->from_file("tlp/baz.tlp"); -$tlsrc->writeout(); +my $tlp = new TLP; +$tlp->from_file("tlp/bar.tlp"); +#print Dumper($tlp); + +$tlp->writeout(); |