diff options
author | Norbert Preining <preining@logic.at> | 2007-06-16 16:32:21 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-06-16 16:32:21 +0000 |
commit | 8e0118f7fbebfae6bab089e5d7b16fb86d3a5deb (patch) | |
tree | aa0340fccebc2617e0df06a92810f2f863654968 | |
parent | 4e696440566b8dc5101c0a4d341b8445423e1f84 (diff) |
delete more stuff
git-svn-id: svn://tug.org/texlive/trunk@4441 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | new-infra/Makefile | 7 | ||||
-rw-r--r-- | new-infra/TLDB.pm | 225 | ||||
-rw-r--r-- | new-infra/TLP.pm | 587 | ||||
-rw-r--r-- | new-infra/TLSRC.pm | 419 | ||||
-rw-r--r-- | new-infra/TLTREE.pm | 309 | ||||
-rw-r--r-- | new-infra/TLUtils.pm | 73 | ||||
-rw-r--r-- | new-infra/TODO | 120 | ||||
-rwxr-xr-x | new-infra/etc/create-tlsrc-from-tpm.pl | 326 | ||||
-rwxr-xr-x | new-infra/etc/read-tpm-dump-tpl.pl | 314 | ||||
-rw-r--r-- | new-infra/test-tldb.pl | 31 | ||||
-rw-r--r-- | new-infra/test-tlp.pl | 15 | ||||
-rw-r--r-- | new-infra/test-tlp2.pl | 26 | ||||
-rw-r--r-- | new-infra/test-tlsrc.pl | 15 | ||||
-rw-r--r-- | new-infra/test-tltree.pl | 41 | ||||
-rw-r--r-- | new-infra/tldb2list.pl | 95 | ||||
-rw-r--r-- | new-infra/tlsrc2tldb.pl | 104 |
16 files changed, 0 insertions, 2707 deletions
diff --git a/new-infra/Makefile b/new-infra/Makefile deleted file mode 100644 index b517cbc524a..00000000000 --- a/new-infra/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -all: - mkdir -p tlp - perl create-tlp.pl tlsrc/*.tlsrc - -clean: - rm -rf tlp tlp.old full.tldb diff --git a/new-infra/TLDB.pm b/new-infra/TLDB.pm deleted file mode 100644 index 5084f3febcf..00000000000 --- a/new-infra/TLDB.pm +++ /dev/null @@ -1,225 +0,0 @@ -# -# TLDB.pm -# module for using tldb files -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version - -package TLDB; - -use TLUtils; -use TLP; - -my $_listdir; - -sub new { - my $class = shift; - my %params = @_; - my $self = { - location => $params{'location'}, - tlps => $params{'tlps'} - }; - $_listdir = $params{'listdir'} if defined($params{'listdir'}); - bless $self, $class; - if (defined($self->{'location'})) { - $self->from_file($self->{'location'}); - } - return $self; -} - -sub add_tlp { - my ($self,$tlp) = @_; - $self->{'tlps'}{$tlp->name} = $tlp; -} - -sub from_file { - my $self = shift; - if (@_ != 1) { - die("Need a filename for initialization!"); - } - if (defined($self->{'location'})) { - if ($self->location ne $_[0]) { - printf STDERR "Initialisation from different location as originally given.\nHope you are sure!\n"; - } - } - $self->location($_[0]); - open(TMP,"<$_[0]") || die("Cannot open tldb file: $_[0]"); - my $found = 0; - do { - my $tlp = TLP->new; - &TLUtils::debug("creating tlp ...\n"); - $found = $tlp->from_fh(\*TMP,1); - if ($found) { - $self->add_tlp($tlp); - } - } until (!$found); -} - -sub writeout { - my $self = shift; - my $fd = (@_ ? $_[0] : STDOUT); - foreach (sort keys %{$self->{'tlps'}}) { - &TLUtils::debug("tlpname = $_\n"); - &TLUtils::debug("foo: " . $self->{'tlps'}{$_}->name . "\n"); - $self->{'tlps'}{$_}->writeout($fd); - print $fd "\n"; - } -} - -sub save { - my $self = shift; - open(FOO,">$self->{'location'}") || die("Cannot open $self->{'location'} for writing: $!"); - $self->writeout(\*FOO); - close(FOO); -} - -sub get_package { - my ($self,$pkg) = @_; - if (defined($self->{'tlps'}{$pkg})) { - return($self->{'tlps'}{$pkg}); - } else { - return(undef); - } -} - -sub package_revision { - my ($self,$pkg) = @_; - if (defined($self->{'tlps'}{$pkg})) { - return($self->{'tlps'}{$pkg}->revision); - } else { - return(undef); - } -} - -sub generate_packagelist { - my $self = shift; - my $fd = (@_ ? $_[0] : STDOUT); - foreach (sort keys %{$self->{'tlps'}}) { - print $fd $self->{'tlps'}{$_}->name, " ", $self->{'tlps'}{$_}->revision, "\n"; - } -} - -sub generate_listfiles { - my ($self,$destdir) = @_; - if (not(defined($destdir))) { - $destdir = TLDB->listdir; - } - foreach (sort keys %{$self->{'tlps'}}) { - $tlp = $self->{'tlps'}{$_}; - $self->_generate_listfile($tlp, $destdir, "all"); - if ($tlp->is_arch_dependent) { - foreach my $a (keys %{$tlp->binfiles}) { - $self->_generate_listfile($tlp, $destdir, $a); - } - } - } -} - -sub _generate_listfile { - my ($self,$tlp,$destdir,$arch) = @_; - my @files = (); - my $listname; - if ($arch ne "all") { - my %foo = %{$tlp->binfiles}; - push @files, @{$foo{$arch}}; - $listname = $tlp->name . ".$arch"; - } else { - $listname = $tlp->name; - push @files, $tlp->runfiles; - push @files, $tlp->docfiles; - push @files, $tlp->srcfiles; - } - @files = TLUtils::sort_uniq(@files); - &mkpath("$destdir") if (! -d "$destdir"); - my (@lop, @lot); - foreach my $d ($tlp->depends) { - if ($d =~ m/^Package\/(.*)$/) { - push @lop, $1; - } elsif ($d =~ m/^(TLCore|Documentation)\/(.*)$/) { - push @lot, $2; - } else { - warn "strange depends line: $d\n"; - } - } - open(TMP, ">$destdir/$listname") or die "Cannot open $destdir/$listname!"; - # title and size information for collections and schemes in the - # first two lines, marked with * - if ($listname =~ m/^collection-/) { - print TMP "*Title: ", $tlp->shortdesc, "\n"; - # collections references Packages, we have to collect the sizes of - # all the Package-tlps included - # What is unclear for me is HOW the size is computed for bin-* - # packages. The collection-basicbin contains quite a lot of - # bin-files, but the sizes for the different archs differ. - # I guess we have to take the maximum? - my $s = 0; - foreach my $p (@lop) { - my $subtlp = $self->get_package($p); - if (!defined($subtlp)) { - warn "Strange: $listname references $p, but it is not in tldb"; - } - $s += $subtlp->runsize + $subtlp->srcsize + $subtlp->docsize; - if ($subtlp->is_arch_dependent) { - my %foo = %{$subtlp->binsizes}; - my $max = 0; - foreach $k (keys %foo) { - $max = $foo{$k} if ($foo{$k} > $max); - } - $s += $max; - } - } - # in case the collection itself ships files ... - $s += $tlp->runsize + $tlp->srcsize + $tlp->docsize; - print TMP "*Size: $s\n"; - } elsif ($listname =~ m/^scheme-/) { - print TMP "*Title: ", $tlp->shortdesc, "\n"; - warn "TODO: need computation of sizes for schemes!"; - #print TMP "*Size: ", $tlp->total_size, "\n"; - } - # dependencies and inclusion of packages - foreach my $t (@lot) { - # strange, schemes mark included collections via -, while collections - # themself mark deps on other collections with +. collection are - # never referenced in Packages - if ($listname =~ m/^scheme/) { - print TMP "-"; - } else { - print TMP "+"; - } - print TMP "$t\n"; - } - foreach my $t (@lop) { print TMP "+$t\n"; } - # included files - foreach my $f (@files) { print TMP "$f\n"; } - # also print the listfile itself - print TMP "$destdir/$listname\n"; - # execute statements - foreach my $e ($tlp->executes) { - print TMP "!$e\n"; - } - # finish - close(TMP); -} - -sub location { - my $self = shift; - if (@_) { $self->{'location'} = shift } - return $self->{'location'}; -} - -sub listdir { - my @self = shift; - if (@_) { $_listdir = $_[0] } - return $_listdir; -} - - -1; - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/TLP.pm b/new-infra/TLP.pm deleted file mode 100644 index 915c0506c21..00000000000 --- a/new-infra/TLP.pm +++ /dev/null @@ -1,587 +0,0 @@ -# -# TLP.pm -# module for using tlp files -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version - -package TLP; - -use TLUtils; -use File::Path; -use Cwd; -use TLTREE; -use FileHandle; - -my $_tmp; -my $_zipdir; - -sub new { - my $class = shift; - my %params = @_; - my $self = { - name => $params{'name'}, - category => defined($params{'category'}) ? $params{'category'} : "Package", - shortdesc => $params{'shortdesc'}, - 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'} : [], - 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'}, - }; - $_zipdir = $params{'zipdir'} if defined($params{'zipdir'}); - bless $self, $class; - 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]"); - $self->from_fh(\*TMP); -} - -sub from_fh { - my ($self,$fh,$multi) = @_; - my $started = 0; - my $lastcmd = ""; - my $arch; - my $size; - - while (my $line = $fh->getline) { - &TLUtils::debug("reading line: >>>$line<<<\n"); - &TLUtils::debug("multi=...$multi...\n"); - $line =~ /^\s*#/ && next; # skip comment lines - if ($line =~ /^\s*$/) { - if (!$started) { next; } - if (defined($multi)) { - # we may read from a tldb file - return 1; - } else { - # we are reading one tldb file, nothing else allowed - die("No empty line allowed within tlp files!"); - } - } - if ($line =~ /^ /) { - if ( ($lastcmd eq "longdesc") || - ($lastcmd eq "runfiles") || - ($lastcmd eq "binfiles") || - ($lastcmd eq "docfiles") || - ($lastcmd eq "srcfiles") || - ($lastcmd eq "executes") || - ($lastcmd eq "depend") ) { - $line =~ s/^ /${lastcmd}continued /; - } else { - die("Continuation of $lastcmd not allowed, please fix tlp!\n"); - } - } - if ($line =~ /^name\s*([-\w]+)$/) { - $name = "$1"; - $lastcmd = "name"; - $self->name("$name"); - $started && die("Cannot have two name directives: $line!"); - $started = 1; - } else { - $started || die("First directive needs to be 'name'"); - if ($line =~ /^shortdesc\s+(.*)$/) { - $self->{'shortdesc'} .= "$1"; - $lastcmd = "shortdesc"; - next; - } elsif ($line =~ /^longdesc(continued)?\s+(.*)$/) { - if (defined($1) && ("$1" eq "continued")) { - $self->{'longdesc'} .= " $2"; - } else { - $self->{'longdesc'} = "$2"; - } - $lastcmd = "longdesc"; - next; - } elsif ($line =~ /^category\s+(Package|TLCore|Documentation)$/) { - $self->{'category'} = "$1"; - $lastcmd = "category"; - next; - } elsif ($line =~ /^revision\s+(.*)$/) { - $self->{'revision'} = "$1"; - $lastcmd = "revision"; - next; - } elsif ($line =~ /^catalogue\s+(.*)$/) { - $self->catalogue("$1"); - $lastcmd = "catalogue"; - next; - } 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 =~ /^(doc|src|run)filescontinued\s+(.*)$/) { - push @{$self->{$1."files"}}, "$2"; - next; - } 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 =~ /^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(continued)?\s*(.*)$/) { - push @{$self->{'depends'}}, "$2" unless "$2" eq ""; - $lastcmd = "depend"; - next; - } else { - die("Unknown directive ...$line... , please fix it!"); - } - } - } - return $started; -} - -sub recompute_revision { - my ($self,$tltree) = @_; - my @files; - foreach my $a (keys %{$self->{'binfiles'}}) { - push @files, @{$self->{'binfiles'}{$a}}; - } - push @files, $self->runfiles; - push @files, $self->docfiles; - push @files, $self->srcfiles; - $filemax = 0; - foreach my $f (@files) { - $filemax = $tltree->file_svn_lastrevision($f); - $self->revision(($filemax > $self->revision) ? $filemax : $self->revision); - } -} - -sub recompute_sizes { - my ($self,$tltree) = @_; - $self->{'docsize'} = $self->_recompute_size("doc",$tltree); - $self->{'srcsize'} = $self->_recompute_size("src",$tltree); - $self->{'runsize'} = $self->_recompute_size("run",$tltree); - foreach $a ($tltree->architectures) { - $self->{'binsize'}{$a} = $self->_recompute_size("bin",$tltree,$a); - } -} - - -sub _recompute_size { - my ($self,$type,$tltree,$arch) = @_; - my $size = 0; - if ($type eq "bin") { - my %binfiles = %{$self->{'binfiles'}}; - if (defined($binfiles{$arch})) { - foreach $f (@{$binfiles{$arch}}) { - $size += $tltree->size_of($f); - } - } - } else { - if (defined($self->{"${type}files"}) && (@{$self->{"${type}files"}})) { - foreach $f (@{$self->{"${type}files"}}) { - my $s = $tltree->size_of($f); - if (defined($s)) { - $size += $s; - } else { - printf STDERR "size for $f not defined, strange ...\n"; - } - } - } - } - return $size; -} - -sub writeout { - my $self = shift; - my $fd = (@_ ? $_[0] : STDOUT); - format_name $fd "multilineformat"; - print $fd "name ", $self->name, "\n"; - print $fd "category ", $self->category, "\n"; - defined($self->{'revision'}) && print $fd "revision $self->{'revision'}\n"; - defined($self->{'catalogue'}) && print $fd "catalogue $self->{'catalogue'}\n"; - defined($self->{'shortdesc'}) && print $fd "shortdesc $self->{'shortdesc'}\n"; - if (defined($self->{'longdesc'})) { - $_tmp = "longdesc $self->{'longdesc'}"; - write $fd; - } - if (defined($self->{'depends'})) { - foreach (@{$self->{'depends'}}) { - print $fd "depend $_\n"; - } - } - if (defined($self->{'executes'})) { - foreach (@{$self->{'executes'}}) { - print $fd "execute $_\n"; - } - } - if (defined($self->{'docfiles'}) && (@{$self->{'docfiles'}})) { - print $fd "docfiles size=$self->{'docsize'}\n"; - foreach (sort @{$self->{'docfiles'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'srcfiles'}) && (@{$self->{'srcfiles'}})) { - print $fd "srcfiles size=$self->{'srcsize'}\n"; - foreach (sort @{$self->{'srcfiles'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'runfiles'}) && (@{$self->{'runfiles'}})) { - print $fd "runfiles size=$self->{'runsize'}\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 writeout_simple { - my $self = shift; - my $fd = (@_ ? $_[0] : STDOUT); - format_name $fd "multilineformat"; - print $fd "name ", $self->name, "\n"; - print $fd "category ", $self->category, "\n"; - if (defined($self->{'depends'})) { - foreach (@{$self->{'depends'}}) { - print $fd "depend $_\n"; - } - } - if (defined($self->{'executes'})) { - foreach (@{$self->{'executes'}}) { - print $fd "execute $_\n"; - } - } - if (defined($self->{'docfiles'}) && (@{$self->{'docfiles'}})) { - print $fd "docfiles\n"; - foreach (sort @{$self->{'docfiles'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'srcfiles'}) && (@{$self->{'srcfiles'}})) { - print $fd "srcfiles\n"; - foreach (sort @{$self->{'srcfiles'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'runfiles'}) && (@{$self->{'runfiles'}})) { - print $fd "runfiles\n"; - foreach (sort @{$self->{'runfiles'}}) { - print $fd " $_\n"; - } - } - foreach my $arch (sort keys %{$self->{'binfiles'}}) { - if (@{$self->{'binfiles'}{$arch}}) { - print $fd "binfiles arch=$arch\n"; - foreach (sort @{$self->{'binfiles'}{$arch}}) { - print $fd " $_\n"; - } - } - } -} - - -sub make_zip { - my ($self,$tltree,$destdir,$zipname) = @_; - my $zipn; - if (not(defined($zipname))) { - $zipname = $self->name . ".zip"; - } - if (not(defined($destdir))) { - $destdir = TLP->zipdir; - } - die("Undefined tltree argument!") if (not(defined($tltree))); - # first build the arch independet part - $self->_make_zip($tltree,$destdir,$zipname,"all"); - # now the $pkg.$arch.zip - if ($self->is_arch_dependent) { - foreach my $t (keys %{$self->{'binfiles'}}) { - &TLUtils::debug("arch=$t\n"); - if ($zipname =~ /^(.*)\.zip$/) { - $zipn = "$1.$t.zip"; - } else { - $zipn = "$zipname.$t.zip"; - } - $self->_make_zip($tltree,$destdir,$zipn,$t); - } - } -} - -sub _make_zip { - my ($self,$tltree,$destdir,$zipname,$arch) = @_; - my $root = $tltree->svnroot; - my @files = (); - my $zipcmd; - if ($arch ne "all") { - push @files, @{$self->{'binfiles'}{$arch}}; - } else { - push @files, $self->runfiles; - push @files, $self->docfiles; - push @files, $self->srcfiles; - } - # note that the Tpm.pm module had something like - # if ($zipname =~ /\/binary/ && $^O !~ /MSWin32/) { - # $zipcmd = "| zip -9\@ory " - # } else { - # $zipcmd = "| zip -9\@or " - # } - if ($^O =~ /MSWin32/) { - $nul = "nul"; - $zipcmd = "| zip -9\@or " - } else { - $nul = "/dev/null"; - $zipcmd = "| zip -9\@ory " - } - @files = TLUtils::sort_uniq(@files); - if (!@files) { - &TLUtils::debug("Not creating empty zip file $zipname\n"); - return; - } - &mkpath("$destdir") if (! -d "$destdir"); - my $cwd = &getcwd; - chdir($tltree->svnroot); - unlink($zipname); - print $zipcmd . "$destdir/$zipname" . " > $nul\n" if ($::opt_debug); - open ZIP, $zipcmd . "$destdir/$zipname" . " > $nul"; - map { - if (! -f $_) { - print STDERR "!!!Error: non-existent $_\n"; - } else { - print ZIP "$_\n"; - } - } @files; - close ZIP; - print "Done $zipname\n" if ($::opt_debug); -} - -sub is_arch_dependent { - my $self = shift; - if (keys %{$self->{'binfiles'}}) { - return 1; - } else { - return 0; - } -} - -# computes the total size of a package -# if no arguments are given this is -# docsize + runsize + srcsize -# if arguments are given this is -# docsize + runsize + srcsize + sum_{i in args} binsize arch=$i -sub total_size { - my ($self,@archs) = @_; - my $ret = $self->docsize + $self->runsize + $self->srcsize; - foreach my $a (@archs) { - $ret += ${$self->binsize}{$a}; - } - return($ret); -} - -# -# member access functions -# -sub name { - my $self = shift; - if (@_) { $self->{'name'} = shift } - return $self->{'name'}; -} -sub category { - my $self = shift; - if (@_) { $self->{'category'} = shift } - return $self->{'category'}; -} -sub shortdesc { - my $self = shift; - if (@_) { $self->{'shortdesc'} = shift } - return $self->{'shortdesc'}; -} -sub longdesc { - my $self = shift; - if (@_) { $self->{'longdesc'} = shift } - return $self->{'longdesc'}; -} -sub revision { - my $self = shift; - if (@_) { $self->{'revision'} = shift } - return $self->{'revision'}; -} -sub catalogue { - my $self = shift; - if (@_) { $self->{'catalogue'} = shift } - return $self->{'catalogue'}; -} -sub srcfiles { - my $self = shift; - if (@_) { @{ $self->{'srcfiles'} } = @_ } - return @{ $self->{'srcfiles'} }; -} -sub srcsize { - my $self = shift; - if (@_) { $self->{'srcsize'} = shift } - return ( defined($self->{'srcsize'}) ? $self->{'srcsize'} : 0 ); -} -sub add_srcfiles { - my ($self,@files) = @_; - $self->add_files("src",@files); -} -sub remove_srcfiles { - my ($self,@files) = @_; - $self->remove_files("src",@files); -} -sub docfiles { - my $self = shift; - if (@_) { @{ $self->{'docfiles'} } = @_ } - return @{ $self->{'docfiles'} }; -} -sub docsize { - my $self = shift; - if (@_) { $self->{'docsize'} = shift } - return ( defined($self->{'docsize'}) ? $self->{'docsize'} : 0 ); -} -sub add_docfiles { - my ($self,@files) = @_; - $self->add_files("doc",@files); -} -sub remove_docfiles { - my ($self,@files) = @_; - $self->remove_files("doc",@files); -} -sub binfiles { - my $self = shift; - 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,$arch,@files) = @_; - &TLUtils::push_uniq(\@{ $self->{'binfiles'}{$arch} }, @files); -} -sub remove_binfiles { - my ($self,$arch,@files) = @_; - my @finalfiles; - foreach my $f (@{$self->{'binfiles'}{$arch}}) { - if (not(&TLUtils::member($f,@files))) { - push @finalfiles,$f; - } - } - $self->{'binfiles'}{$arch} = [ @finalfiles ]; -} -sub runfiles { - my $self = shift; - if (@_) { @{ $self->{'runfiles'} } = @_ } - return @{ $self->{'runfiles'} }; -} -sub runsize { - my $self = shift; - if (@_) { $self->{'runsize'} = shift } - return ( defined($self->{'runsize'}) ? $self->{'runsize'} : 0 ); -} -sub add_runfiles { - my ($self,@files) = @_; - $self->add_files("run",@files); -} -sub remove_runfiles { - my ($self,@files) = @_; - $self->remove_files("run",@files); -} -sub add_files { - my ($self,$type,@files) = @_; - die("Cannot use add_files for binfiles, we need that arch!") if ($type eq "bin"); - &TLUtils::push_uniq(\@{ $self->{"${type}files"} }, @files); -} -sub remove_files { - my ($self,$type,@files) = @_; - die("Cannot use add_files for binfiles, we need that arch!") if ($type eq "bin"); - my @finalfiles; - foreach my $f (@{$self->{"${type}files"}}) { - if (not(&TLUtils::member($f,@files))) { - push @finalfiles,$f; - } - } - $self->{"${type}files"} = [ @finalfiles ]; -} -sub depends { - my $self = shift; - if (@_) { @{ $self->{'depends'} } = @_ } - return @{ $self->{'depends'} }; -} -sub executes { - my $self = shift; - if (@_) { @{ $self->{'executes'} } = @_ } - return @{ $self->{'executes'} }; -} - -sub zipdir { - my @self = shift; - if (@_) { $_zipdir = $_[0] } - return $_zipdir; -} - -1; - - - -###### Formats -format multilineformat = -^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$_tmp - ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ -$_tmp -. - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/TLSRC.pm b/new-infra/TLSRC.pm deleted file mode 100644 index 804ebc8ccad..00000000000 --- a/new-infra/TLSRC.pm +++ /dev/null @@ -1,419 +0,0 @@ -# -# TLSRC.pm -# module for using tlsrc files -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version - -package TLSRC; - -use FileHandle; -use TLP; -use TLTREE; - -my $_tmp; - -sub new { - my $class = shift; - my %params = @_; - my $self = { - name => $params{'name'}, - category => defined($params{'category'}) ? $params{'category'} : "Package", - shortdesc => $params{'shortdesc'}, - longdesc => $params{'longdesc'}, - catalogue => $params{'catalogue'}, - runpatterns => $params{'runpatterns'}, - srcpatterns => $params{'srcpatterns'}, - docpatterns => $params{'docpatterns'}, - binpatterns => $params{'binpatterns'}, - executes => defined($params{'executes'}) ? $params{'executes'} : [], - depends => defined($params{'depends'}) ? $params{'depends'} : [], - }; - bless $self, $class; - return $self; -} - -sub from_file { - my $self = shift; - if (@_ != 1) { - die("Need a filename for initialization!"); - } - open(TMP,"<$_[0]") || die("Cannot open tlsrc file: $_[0]"); - my @lines = <TMP>; - close(TMP); - my $name = ""; - # default category = Package - my $category = "Package"; - my $shortdesc = ""; - my $longdesc= ""; - my $catalogue = ""; - my (@executes, @depends); - my (@runpatterns, @docpatterns, @binpatterns, @srcpatterns); - my $started = 0; - my $finished = 0; - my $lastcmd = ""; - - foreach my $line (@lines) { - $line =~ /^\s*#/ && next; # skip comment lines - if ($line =~ /^\s*$/) { - if (!$started) { next; } - if ($finished) { next; } - die("No empty line allowed in tlsrc file $_[0]!"); - } - if ($line =~ /^ /) { - if ( ($lastcmd eq "longdesc") || - ($lastcmd eq "runpatterns") || - ($lastcmd eq "binpatterns") || - ($lastcmd eq "docpatterns") || - ($lastcmd eq "srcpatterns") || - ($lastcmd eq "execute") || - ($lastcmd eq "depend") ) { - $line =~ s/^ /$lastcmd /; - } else { - die("Continuation of $lastcmd not allowed, please fix tlsrc!\n"); - } - } - if ($line =~ /^name\s*([-\w]+)$/) { - $name = "$1"; - $lastcmd = "name"; - $started && die("Cannot have two name directives!"); - $started = 1; - } else { - $started || die("First directive needs to be 'name'"); - if ($line =~ /^shortdesc\s*(.*)$/) { - $shortdesc = "$1"; - $lastcmd = "shortdesc"; - next; - } elsif ($line =~ /^category\s+(Package|TLCore|Documentation)$/) { - $category = "$1"; - $lastcmd = "category"; - next; - } elsif ($line =~ /^longdesc\s+(.*)$/) { - $longdesc .= "$1 "; - $lastcmd = "longdesc"; - next; - } elsif ($line =~ /^catalogue\s+(.*)$/) { - $catalogue = "$1"; - $lastcmd = "catalogue"; - next; - } elsif ($line =~ /^runpatterns\s+(.*)$/) { - push @runpatterns, "$1" if ("$1" ne ""); - $lastcmd = "runpatterns"; - next; - } elsif ($line =~ /^srcpatterns\s+(.*)$/) { - push @srcpatterns, "$1" if ("$1" ne ""); - $lastcmd = "srcpatterns"; - next; - } elsif ($line =~ /^docpatterns\s+(.*)$/) { - push @docpatterns, "$1" if ("$1" ne ""); - $lastcmd = "docpatterns"; - next; - } elsif ($line =~ /^binpatterns\s+(.*)$/) { - push @binpatterns, "$1" if ("$1" ne ""); - $lastcmd = "binpatterns"; - next; - } elsif ($line =~ /^execute\s+(.*)$/) { - push @executes, "$1" if ("$1" ne ""); - $lastcmd = "execute"; - next; - } elsif ($line =~ /^depend\s+(.*)$/) { - push @depends, "$1" if ("$1" ne ""); - $lastcmd = "depend"; - next; - } else { - #die("Unknown directive ...$line... in $_[0], please fix it!"); - print STDERR "Unknown directive ...$line... in $_[0], please fix it!\n"; - } - } - } - $self->name("$name"); - $self->category("$category"); - $self->catalogue($catalogue ne "" ? "$catalogue" : "$name"); - $self->shortdesc("$shortdesc") if ($shortdesc ne ""); - $self->longdesc("$longdesc") if ($longdesc ne ""); - $self->srcpatterns(@srcpatterns) if ($#srcpatterns >= 0); - $self->runpatterns(@runpatterns) if ($#runpatterns >= 0); - $self->binpatterns(@binpatterns) if ($#binpatterns >= 0); - $self->docpatterns(@docpatterns) if ($#docpatterns >= 0); - $self->executes(@executes) if ($#executes >= 0); - $self->depends(@depends) if ($#depends >= 0); -} - -sub writeout { - my $self = shift; - my $fd = (@_ ? $_[0] : STDOUT); - format_name $fd "multilineformat"; - print $fd "name ", $self->name, "\n"; - print $fd "category ", $self->category, "\n"; - print $fd "catalogue $self->{'catalogue'}\n"; - defined($self->{'shortdesc'}) && print $fd "shortdesc $self->{'shortdesc'}\n"; - if (defined($self->{'longdesc'})) { - $_tmp = "longdesc $self->{'longdesc'}"; - write $fd; - } - if (defined($self->{'depends'})) { - foreach (@{$self->{'depends'}}) { - print $fd "depend $_\n"; - } - } - if (defined($self->{'executes'})) { - foreach (@{$self->{'executes'}}) { - print $fd "execute $_\n"; - } - } - if (defined($self->{'srcpatterns'}) && (@{$self->{'srcpatterns'}})) { - print $fd "srcpatterns\n"; - foreach (sort @{$self->{'srcpatterns'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'runpatterns'}) && (@{$self->{'runpatterns'}})) { - print $fd "runpatterns\n"; - foreach (sort @{$self->{'runpatterns'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'docpatterns'}) && (@{$self->{'docpatterns'}})) { - print $fd "docpatterns\n"; - foreach (sort @{$self->{'docpatterns'}}) { - print $fd " $_\n"; - } - } - if (defined($self->{'binpatterns'}) && (@{$self->{'binpatterns'}})) { - print $fd "binpatterns\n"; - foreach (sort @{$self->{'binpatterns'}}) { - print $fd " $_\n"; - } - } -} - -# -# the hard work, generate a TLP file -# - -sub make_tlp { - my ($self,$tltree) = @_; - my $tlp = TLP->new; - $tlp->name($self->name); - $tlp->category($self->category); - $tlp->shortdesc($self->{'shortdesc'}) if (defined($self->{'shortdesc'})); - $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; - 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; - foreach my $arch (@archs) { - $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,$negative) = @_; - my $matchref = $tltree->get_matching_files($type,$p); - my @matchfiles = @$matchref; - if (defined($negative) && $negative == 1) { - $tlp->remove_files($type,@matchfiles); - } else { - $tlp->add_files($type,@matchfiles); - } -} - -# -# member access functions -# -sub name { - my $self = shift; - if (@_) { $self->{'name'} = shift } - return $self->{'name'}; -} -sub category { - my $self = shift; - if (@_) { $self->{'category'} = shift } - return $self->{'category'}; -} -sub shortdesc { - my $self = shift; - if (@_) { $self->{'shortdesc'} = shift } - return $self->{'shortdesc'}; -} -sub longdesc { - my $self = shift; - if (@_) { $self->{'longdesc'} = shift } - return $self->{'longdesc'}; -} -sub catalogue { - my $self = shift; - if (@_) { $self->{'catalogue'} = shift } - return $self->{'catalogue'}; -} -sub srcpatterns { - my $self = shift; - if (@_) { @{ $self->{'srcpatterns'} } = @_ } - return @{ $self->{'srcpatterns'} }; -} -sub docpatterns { - my $self = shift; - if (@_) { @{ $self->{'docpatterns'} } = @_ } - return @{ $self->{'docpatterns'} }; -} -sub binpatterns { - my $self = shift; - if (@_) { @{ $self->{'binpatterns'} } = @_ } - return @{ $self->{'binpatterns'} }; -} -sub depends { - my $self = shift; - if (@_) { @{ $self->{'depends'} } = @_ } - return @{ $self->{'depends'} }; -} -sub runpatterns { - my $self = shift; - if (@_) { @{ $self->{'runpatterns'} } = @_ } - return @{ $self->{'runpatterns'} }; -} -sub executes { - my $self = shift; - if (@_) { @{ $self->{'executes'} } = @_ } - return @{ $self->{'executes'} }; -} - -1; - -# FORMATS -format multilineformat = -^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$_tmp - ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ -$_tmp -. - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/TLTREE.pm b/new-infra/TLTREE.pm deleted file mode 100644 index 8b0a9b2a8bb..00000000000 --- a/new-infra/TLTREE.pm +++ /dev/null @@ -1,309 +0,0 @@ -# -# TLTREE.pm -# helper module to work with the tree of all files -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version - -package TLTREE; - -use TLUtils; - -my @Architectures = qw/alpha-linux hppa-hpux i386-darwin i386-freebsd - i386-linux i386-openbsd i386-solaris mips-irix powerpc-aix powerpc-darwin - powerpc-linux sparc-linux sparc-solaris win32 x86_64-linux/; - -sub new { - my $class = shift; - my %params = @_; - my $self = { - svnroot => $params{'svnroot'}, - # private stuff - _allfiles => {}, - _dirtree => {}, - _dirnames => {}, - _filesofdir => {}, - _subdirsofdir => {}, - }; - bless $self, $class; - return $self; -} - -sub init_from_svn { - my $self = shift; - die("Undefined svn root!") if (!defined($self->{'svnroot'})); - my @lines = `cd $self->{'svnroot'} && svn status -v`; - $self->_initialize_lines(@lines); -} - -sub init_from_statusfile { - my $self = shift; - die("Need a filename of svn status file!") if (@_ != 1); - open(TMP,"<$_[0]") || die("Cannot open svn status file: $_[0]"); - my @lines = <TMP>; - close(TMP); - $self->_initialize_lines(@lines); -} - -sub _initialize_lines { - my $self = shift; - my @lines = @_; - # we first chdir to the svn root, we need it for file tests - my $oldpwd = `pwd`; - chomp($oldpwd); - chdir($self->svnroot) || die("Cannot chdir to SVN root $self->{'svnroot'}!"); - foreach my $l (@lines) { - chomp($l); - next if ($l =~ /^\?/); # ignore files not under version control - if ($l =~ /^(.)(.)(.)(.)(.)(.)..\s*(\d+)\s+([\d\?]+)\s+([\w\?]+)\s+(.+)$/) { - my $lastchanged = $8; - my $entry = "$10"; - next if -d $entry; # TODO: what to do with links??? - $self->{'_allfiles'}{$entry}{'lastchangedrev'} = $lastchanged; - $self->{'_allfiles'}{$entry}{'size'} = (lstat $entry)[7]; - my $fn = TLUtils::basename($entry); - my $dn = TLUtils::dirname($entry); - add_path_to_tree($self->{'_dirtree'}, split("[/\\\\]", $dn)); - push @{$self->{'_filesofdir'}{$dn}}, $fn; - } else { - die("Cannot read svn status output line:\n $l\n"); - } - } - # now do some magic - # - create list of top level dirs with a list of full path names of - # the respective dir attached - $self->walk_tree(\&find_alldirs); - chdir($oldpwd); -} - -sub print { - my $self = shift; - $self->walk_tree(\&print_node); -} - -sub find_alldirs { - my ($self,$node, @stackdir) = @_; - my $tl = $stackdir[-1]; - push @{$self->{'_dirnames'}{$tl}}, join("/", @stackdir); - if (keys(%{$node})) { - my $pa = join("/", @stackdir); - push @{$self->{'_subdirsofdir'}{$pa}}, keys(%{$node}); - } -} - -sub print_node { - my ($self,$node, @stackdir) = @_; - my $dp = join("/", @stackdir); - if ($self->{'_filesofdir'}{$dp}) { - foreach my $f (@{$self->{'_filesofdir'}{$dp}}) { - print "dp=$dp file=$f\n"; - } - } - if (! keys(%{$node})) { - print join("/", @stackdir) . "\n"; - } -} - -sub walk_tree { - my $self = shift; - my (@stack_dir); - $self->_walk_tree1($self->{'_dirtree'},@_, @stack_dir); -} - -sub _walk_tree1 { - my $self = shift; - my ($node,$pre_proc, $post_proc, @stack_dir) = @_; - my $v; - for my $k (keys(%{$node})) { - push @stack_dir, $k; - $v = $node->{$k}; - if ($pre_proc) { &{$pre_proc}($self, $v, @stack_dir) } - $self->_walk_tree1 (\%{$v}, $pre_proc, $post_proc, @stack_dir); - $v = $node->{$k}; - if ($post_proc) { &{$post_proc}($self, $v, @stack_dir) } - pop @stack_dir; - } -} - -sub add_path_to_tree { - my ($node, @path) = @_; - my ($current); - - while (@path) { - $current = shift @path; - if ($$node{$current}) { - $node = $$node{$current}; - } else { - $$node{$current} = { }; - $node = $$node{$current}; - } - } - return $node; -} - -sub file_svn_lastrevision { - my $self = shift; - my $fn = shift; - if (defined($self->{'_allfiles'}{$fn})) { - return($self->{'_allfiles'}{$fn}{'lastchangedrev'}); - } else { - return(undef); - } -} - -sub size_of { - my ($self,$f) = @_; - if (defined($self->{'_allfiles'}{$f})) { - return($self->{'_allfiles'}{$f}{'size'}); - } else { - return(undef); - } -} - -sub get_matching_files { - my ($self, $type, $p) = @_; - if ($type eq "bin") { - # we first substitute arch for ${ARCH} - my %returnfiles; - foreach $a (@Architectures) { - # return empty list of arch!=win32 and pattern matches bin/win32 - # this is a special case to treat with tlsrc files auto generated - # from tpm files - if (($p =~ m@f bin/win32/@) && ($a ne "win32")) { - $returnfiles{$a} = [ ]; - next; - } - my $ARCH = $a; - my $newp; - eval "\$newp = \"$p\""; - my @foo = $self->_get_matching_files($type,$newp); - $returnfiles{$a} = [ @foo ]; - } - return(\%returnfiles); - } else { - my @returnfiles = $self->_get_matching_files($type,$p); - return(\@returnfiles); - } -} - - -sub _get_matching_files { - my ($self, $type, $p) = @_; - my ($pattype,$patdata,@rest) = split ' ',$p; - my @matchfiles; - &TLUtils::debug("check on $pattype,$patdata,@rest\n"); - if ($pattype eq "t") { - @matchfiles = $self->_get_files_matching_dir_pattern($type,$patdata,@rest); - } elsif ($pattype eq "f") { - @matchfiles = $self->_get_files_matching_glob_pattern($type,$patdata); - } elsif ($pattype eq "r") { - @matchfiles = $self->_get_files_matching_regexp_pattern($type,$patdata); - } elsif ($pattype eq "d") { - @matchfiles = $self->files_under_path($patdata); - } else { - die "Unknown pattern $p"; - } - TLUtils::debug("DEBUG: p=$p, matchfiles=@matchfiles\n"); - return @matchfiles; -} - -# -# we transform a glob pattern to a regexp pattern: -# currently supported globs: ? * -# -# sequences of subsitutions: -# . -> \. -# * -> .* -# ? -> . -sub _get_files_matching_glob_pattern { - my $self = shift; - my ($type,$globline) = @_; - my @returnfiles; - my $dirpart = TLUtils::dirname($globline); - my $basepart = TLUtils::basename($globline); - $basepart =~ s/\./\\./g; - $basepart =~ s/\*/.*/g; - $basepart =~ s/\?/./g; - $basepart =~ s/\+/\\+/g; - return unless (defined($self->{'_filesofdir'}{$dirpart})); - my @candfiles = @{$self->{'_filesofdir'}{$dirpart}}; - foreach my $f (@candfiles) { - &TLUtils::debug("matching $f in $dirpart via glob $globline\n"); - if ($f =~ /^$basepart$/) { - &TLUtils::debug("hit: globline=$globline, $dirpart/$f\n"); - push @returnfiles, "$dirpart/$f"; - } - } - return(@returnfiles); -} - -sub _get_files_matching_regexp_pattern { - my $self = shift; - my ($type,$regexp) = @_; - my @returnfiles; - FILELABEL: foreach my $f (keys(%{$self->{'_allfiles'}})) { - if ($f =~ /^$regexp$/) { - TLUtils::push_uniq(\@returnfiles,$f); - next FILELABEL; - } - } - return(@returnfiles); -} - -sub _get_files_matching_dir_pattern { - my ($self,$type,@patwords) = @_; - my $tl = pop @patwords; - my @returnfiles; - if (defined($self->{'_dirnames'}{$tl})) { - foreach my $tld (@{$self->{'_dirnames'}{$tl}}) { - if (index($tld,join("/",@patwords)."/") == 0) { - my @files = $self->files_under_path($tld); - TLUtils::push_uniq(\@returnfiles, @files); - } - } - } - return(@returnfiles); -} - -sub files_under_path { - my $self = shift; - my $p = shift; - my @files = (); - foreach my $aa (@{$self->{'_filesofdir'}{$p}}) { - TLUtils::push_uniq(\@files, $p . "/" . $aa); - } - if (defined($self->{'_subdirsofdir'}{$p})) { - foreach my $sd (@{$self->{'_subdirsofdir'}{$p}}) { - my @sdf = $self->files_under_path($p . "/" . $sd); - TLUtils::push_uniq (\@files, @sdf); - } - } - return @files; -} - - -# -# member access functions -# -sub svnroot { - my $self = shift; - if (@_) { $self->{'svnroot'} = shift }; - return $self->{'svnroot'}; -} -sub architectures { - my $self = shift; - if (@_) { @Architectures = @_ } - return @Architectures; -} - - - -1; - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/TLUtils.pm b/new-infra/TLUtils.pm deleted file mode 100644 index 9589d200cec..00000000000 --- a/new-infra/TLUtils.pm +++ /dev/null @@ -1,73 +0,0 @@ -# -# TLUtils.pm -# common functions for TeX Live Infrastructure -# Copyright 2007 Norbert Preining -# -# based on Fabrice Popineau's FileUtils.pm -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version - -package TLUtils; - -use File::Basename; - -BEGIN { - use Exporter (); - use Cwd; - use File::Path; - use vars qw( @ISA @EXPORT_OK ); - @ISA = qw(Exporter); - @EXPORT_OK = qw( - &sort_uniq - &push_uniq - ); -} - -sub sort_uniq { - my (@l) = @_; - my ($e, $f, @r); - $f = ""; - @l = sort(@l); - foreach $e (@l) { - if ($e ne $f) { - $f = $e; - push @r, $e; - } - } - return @r; -} - -sub push_uniq { - local (*l, @le) = @_; - my ($e); - foreach $e (@le) { - if (! &member($e, @l)) { - push @l, $e; - } - } -} - -sub member { - my ($e, @l) = @_; - my ($f); - foreach $f (@l) { - if ($e eq $f) { - return 1; - } - } - return 0; -} - -sub debug { - print @_ if ($::opt_debug); -} - -1; - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/TODO b/new-infra/TODO deleted file mode 100644 index 840ad915698..00000000000 --- a/new-infra/TODO +++ /dev/null @@ -1,120 +0,0 @@ -TODO for new-infra -================== -- create tlsrc files for missing tpms, should be only the scheme-* stuff -- update.pl: implement more of the 'updater' -- Shell librarys - . test the tlp_ and the tldb_tlp_ functions - . missing functionality? - . rewrite the long read/case with awk/grep/whatever there is -- rewrite install-* scripts to use the shell library - (or rewrite it in perl?) - -install scripts -=============== -collection of usage of list files etc in the install scripts -- get list of schemes by ls *.scheme -- get title/size from the schemes -- list all lang collections by ls collection-lang* -- list all other collections by ls collection-* | grep -v collection-lang - - - - -$ grep LISTS * -common.sh: for i in `grep "^-collection-" $LISTS/$S.scheme | sed -e 's/^-//' -e 's/-/_/g'` - - tlp_get_depends $S.tlp | grep collection- | ... - -common.sh: selected_packages=`grep "^[+\-]" $LISTS/$S.scheme | grep -v collection- | sed -e 's/^.//' -e 's/-/_/'` - - tlp_get_depends $S.tlp | grep -v collection- | ... - -common.sh: selected_collections=`grep "^-collection-" $LISTS/$S.scheme | sed -e 's/^-collection-//'` - - tlp_get_depends $S.tlp | grep "^collection-" ... - -common.sh: morecols=`grep -- "^-" $LISTS/$col | sed 's/.//'` - - tlp_get_depends $col.tlp | grep ... - -common.sh: packages=`grep "^+" $LISTS/$col | sed 's/.//'` - - tlp_get_depends $col.tlp | grep Package/ - -common.sh: eval sort < $LISTS/$col | grep '^\!' | tr ' ' '=' >> $work_dir/$col.jobs - - tlp_get_executes | tr ... - -common.sh: eval sort < $LISTS/$pack | grep '^\!' | tr ' ' '=' >> $work_dir/$col.jobs - - tlp_get_executes | tr ... - -common.sh: more=`grep "^+" $LISTS/$pack | sed 's/.//'` - - tlp_get_depends ... - -install-compr.sh: LISTS=$CDDIR/texmf/lists -install-compr.sh: all_schemes=`(cd $LISTS && ls *.scheme | sed 's/\.scheme//' | sed 's/-/_/' | sort )` - - -install-compr.sh: T=`grep '^\*Title' $LISTS/$S.scheme | sed -e 's/\*Title: //'` - - tldb_tlp_get_title $tldb $S - -install-compr.sh: C=`grep '^\*Size' $LISTS/$S.scheme | sed -e 's/\*Size: //'` - - tldb_tlp_get_size $tldb $S needs hacking, since sizes are currently - not computed for the whole package, but for - the single types of files - -install-compr.sh: all_lang_collections=`(cd $LISTS && ls collection-lang* | sed 's/-/_/g' | sort )` -install-compr.sh: T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` -install-compr.sh: C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` -install-compr.sh: all_collections=`(cd $LISTS; ls collection-* | grep -v collection-lang | sed 's/-/_/g' | sort )` -install-compr.sh: T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` -install-compr.sh: C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` -install-live.sh: LISTS=${OVERRIDE_LISTS-$CDDIR/texmf/lists} -install-live.sh: BIN=${OVERRIDE_LISTS-$CDDIR/bin} -install-live.sh: test -d $LISTS || fatal "$0: $LISTS: no such directory. Are you sure this is the TeX Live CD?" -install-live.sh: systems=`(cd $LISTS; ls bin-tex.* | sed -e 's/bin-tex.//')` -install-live.sh: all_schemes=`(cd $LISTS; ls *.scheme | sed -e 's/-/_/g' -e 's/\.scheme//' | sort )` -install-live.sh: T=`grep '^\*Title' $LISTS/$S.scheme | sed -e 's/\*Title: //'` -install-live.sh: C=`grep '^\*Size' $LISTS/$S.scheme | sed -e 's/\*Size: //'` -install-live.sh: all_lang_collections=`(cd $LISTS; ls collection-lang* | sed 's/-/_/g' | sort )` -install-live.sh: T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` -install-live.sh: C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` -install-live.sh: all_collections=`(cd $LISTS; ls collection* | grep -v collection-lang | sed 's/-/_/g' | sort )` -install-live.sh: T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` -install-live.sh: C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` -install-live.sh: grep "^[A-Za-z0-9]" $LISTS/$I.$arg >> $work_dir/$arg.list -install-live.sh: grep "^[A-Za-z0-9]" $LISTS/$I.$arg >> $work_dir/$arg.list -install-live.sh: if test -f $LISTS/$col; then -install-live.sh: packages=`grep "^+" $LISTS/$col | sed 's/.//'` -install-live.sh: morecols=`grep "^-" $LISTS/$col | sed 's/.//'` -install-live.sh: grep "^[a-z]" $LISTS/$col >> $work_dir/tmp -install-live.sh: grep '^\!' $LISTS/$col >> $work_dir/tmp.jobs -install-live.sh: if test -f $LISTS/$col.$this; then -install-live.sh: grep "^[\!a-z]" $LISTS/$col.$this >> $work_dir/tmp -install-live.sh: test -s $LISTS/$pack || return -install-live.sh: grep "^[A-Za-z0-9]" $LISTS/$pack >> $work_dir/ptmp -install-live.sh: grep '^\!' $LISTS/$pack >> $work_dir/ptmp.jobs -install-live.sh: if test -f $LISTS/$pack.$this; then -install-live.sh: grep "^[A-Za-z0-9]" $LISTS/$pack.$this >> $work_dir/ptmp -install-live.sh: for i in `grep "^+" $LISTS/$pack | sed 's/.//'` -install-pkg-compr.sh: morecols=`grep "^-" $LISTS/$name | sed 's/.//'` -install-pkg-compr.sh: packages=`grep "^+" $LISTS/$name | sed 's/.//'` -install-pkg-compr.sh: grep "^[a-z]" $LISTS/$name >> tmp -install-pkg-compr.sh: if test -f $LISTS/$binlist; then -install-pkg-compr.sh: grep "^[a-z]" $LISTS/$binlist >> tmp -install-pkg-compr.sh:LISTS=${listdir-${OVERRIDE_LISTS-$CDDIR/texmf/lists}} -install-pkg-compr.sh: colfile=$LISTS/collection-$col -install-pkg-compr.sh: pkgfile=$LISTS/$pkg -install-pkg-live.sh: list_files $LISTS/$i -install-pkg-live.sh: if test -f $LISTS/$binlist; then -install-pkg-live.sh: grep "^[a-z]" $LISTS/$binlist >> tmp -install-pkg-live.sh:LISTS=${listdir-${OVERRIDE_LISTS-$CDDIR/texmf/lists}} -install-pkg-live.sh:test -d $LISTS || fatal "$0: $LISTS: no such directory. Are you sure this is the TeX Live CD?" -install-pkg-live.sh: colfile=$LISTS/collection-$col -install-pkg-live.sh: list_files $LISTS/collection-$col -install-pkg-live.sh: pkgfile=$LISTS/$pkg -install-pkg-live.sh: list_files $LISTS/$pkg diff --git a/new-infra/etc/create-tlsrc-from-tpm.pl b/new-infra/etc/create-tlsrc-from-tpm.pl deleted file mode 100755 index 096011ee745..00000000000 --- a/new-infra/etc/create-tlsrc-from-tpm.pl +++ /dev/null @@ -1,326 +0,0 @@ -#!/usr/bin/env perl -# -# tpm2deb-source.pl -# machinery to create debian packages from TeX Live depot -# (c) 2005, 2006 Norbert Preining -# -# $Id: tpm2deb-source.pl 2691 2007-04-16 09:42:22Z frank $ -# -# configuration is done via the file tpm2deb.cfg -# - -use strict; -no strict 'refs'; -# use warnings; -# no warnings 'uninitialized'; - -my $_tmp; - -my $opt_master; -our $opt_nosrcpkg; -our $opt_noremove; -my $globalreclevel; -my $oldsrcdir; -my $datadump ; - -BEGIN { - my $upstream_modules = "/usr/share/tex-common/"; - unshift (@INC, "./all/debian"); - unshift (@INC, $upstream_modules); -} - -my ($mydir,$mmydir); -($mydir = $0) =~ s,/[^/]*$,,; -if ($mydir eq $0) { $mydir = `pwd` ; chomp($mydir); } -if (!($mydir =~ m,/.*,,)) { $mmydir = `pwd`; chomp($mmydir); $mydir = "$mmydir/$mydir" ; } - - -# $opt_master = "./LocalTPM"; -my $opt_debug = 0; -$opt_nosrcpkg = 0; -$opt_noremove = 0; -$globalreclevel = 1; -$oldsrcdir = "./src"; -$datadump = "tpm.data"; - -use Getopt::Long; -# use Data::Dumper; - -#use Strict; -use File::Basename; -use File::Copy; -use File::Path; -use File::Temp qw/ tempfile tempdir /; -use Storable; -## not needed, atm we are calling eperl binary use Parse::ePerl; -#use XML::DOM; -use Cwd; -#use FileUtils qw(canon_dir cleandir make_link newpath member -# normalize substitute_var_val dirname diff_list remove_list -# rec_rmdir sync_dir walk_dir start_redirection stop_redirection); -#use Tpm; -# -# Configuration for destination of files -# DONT USER DOUBLE QUOTES; THESE VARIABLES HAVE TO GET REEVALUATED -# AFTER $tmpdir IS SET!! -# -my $changelog = ""; -my $changelogversion = ""; -my $changelogextraversion = ""; -my $changelogrevision = ""; -my $changelogdistribution = ""; -my $allowed_dists = "(unstable|UNRELEASED|sarge-backports|etch-backports|stable-security|experimental)"; - - -our $Master; - -$Master = `pwd`; -chomp($Master); -my $TpmGlobalPath = $Master; -my $DataGlobalPath = $Master; - -unshift (@INC, "$Master/../Build/tools"); -File::Basename::fileparse_set_fstype('unix'); - - -use Getopt::Long; -use File::Basename; -use File::Copy; -use File::Path; -use File::Temp qw/ tempfile tempdir /; -use Storable; -use Cwd; -use Tpm; - -our (%TeXLive); -our (%Config,%TpmData); -our %TexmfTreeOfType = ( "TLCore" => "texmf", - "Documentation" => "texmf-doc", - "Package" => "texmf-dist"); -our @TpmCategories = keys %TexmfTreeOfType; -our %TypeOfTexmfTree = reverse %TexmfTreeOfType; - -# pre set $opt_master to ./LocalTPM which contains also the Tools dir -# this is set in the main script, and changed with commandline option. -# should it maybe be deleted here? - -my $opt_onlyscripts; - -sub populate_TpmData_from_dump { - my $datafile = $_[0]; - my $tpmdataref = retrieve($datafile); - %TpmData = %{$tpmdataref}; -} - -sub load_collection_tpm_data { - # local functions - sub trim { - my ($str) = @_; - $str =~ s/^[\n\s]+//; - $str =~ s/[\n\s]+$//; - return $str; - } - sub get_requires { - my ($tpm,$type) = @_; - my %requires = $tpm->getHash("Requires"); - my @keylist = keys %requires; - my @tlcorereqlist = (); - my @packagereqlist = (); - if ($type eq '') { - $type = "all"; - } - foreach my $k (keys %requires) { - foreach my $e (@{$requires{$k}}) { - # manually exclude Windows-only packages - if ($e eq "bin-bzip2") {} - elsif ($e eq "bin-xpdf") {} - elsif ($e eq "bin-chktex") {} - elsif ($e eq "bin-ghostscript") {} - elsif ($e eq "bin-gzip") {} - elsif ($e eq "bin-jpeg2ps") {} - elsif ($e eq "bin-perl") {} - elsif ($e eq "bin-windvi") {} - elsif ($e eq "lib-freetype2") {} - elsif ($e eq "lib-gd") {} - elsif ($e eq "lib-geturl") {} - elsif ($e eq "lib-gnu") {} - elsif ($e eq "lib-gs") {} - elsif ($e eq "lib-jpeg") {} - elsif ($e eq "lib-md5") {} - elsif ($e eq "lib-png") {} - elsif ($e eq "lib-regex") {} - elsif ($e eq "lib-texmfmp") {} - elsif ($e eq "lib-tiff") {} - elsif ($e eq "lib-ttf") {} - elsif ($e eq "lib-xpdf") {} - elsif ($e eq "lib-xpm") {} - elsif ($e eq "lib-zlib") {} - elsif ($e =~ /^bin-(.*)$/) { - push @packagereqlist, "$k/$e"; - } - elsif ($e =~ /^hyphen-(.*)$/){ - push @packagereqlist, "$k/$e"; - } - elsif ($k eq "TLCore") { - push @tlcorereqlist, "$k/$e"; - } else { - push @packagereqlist, "$k/$e"; - } - } - } - if ($type eq '' || $type eq 'all') { - my %foo; - $foo{'TLCore'} = \@tlcorereqlist; - $foo{'Package'} = \@packagereqlist; - #my @foo=(@tlcorereqlist,@packagereqlist); - #return(@foo); - return(\%foo); - } elsif ($type eq 'TLCore') { - return(@tlcorereqlist); - } elsif ($type eq 'Package') { - return(@packagereqlist); - } else { - die("Don't know this type: $type!\n"); - } - } - # start of real function - print "Start loading tpm data ... \n"; - foreach my $t ('TLCore', 'Documentation', 'Package') { - my $subtree = ${TexmfTreeOfType}{$t}; - foreach my $f (<$Master/$subtree/tpm/*.tpm>) { - print "Working on $f\n"; - my $shortn = basename($f); - $shortn =~ s,\.tpm$,,; - if (($t eq 'TLCore') && ($shortn =~ m/^scheme-/)) { next ; } - my $tpm = Tpm->new("$subtree/tpm/$shortn.tpm"); - $TpmData{$t}{$shortn}{'BinPatterns'} = [ $tpm->getList("BinPatterns") ]; - $TpmData{$t}{$shortn}{'DocPatterns'} = [ $tpm->getList("DocPatterns") ]; - $TpmData{$t}{$shortn}{'RunPatterns'} = [ $tpm->getList("RunPatterns") ]; - $TpmData{$t}{$shortn}{'SourcePatterns'} = [ $tpm->getList("SourcePatterns") ]; - $TpmData{$t}{$shortn}{'BinFiles'} = [ $tpm->getFileList("BinFiles") ]; - $TpmData{$t}{$shortn}{'DocFiles'} = [ $tpm->getFileList("DocFiles") ]; - $TpmData{$t}{$shortn}{'RunFiles'} = [ $tpm->getFileList("RunFiles") ]; - $TpmData{$t}{$shortn}{'SourceFiles'} = [ $tpm->getFileList("SourceFiles") ]; - $TpmData{$t}{$shortn}{'RemoteFiles'} = [ $tpm->getFileList("RemoteFiles") ]; - $TpmData{$t}{$shortn}{'Title'} = trim($tpm->getAttribute("Title")); - # print "got title $TpmData{$t}{$shortn}{'Title'}\n"; - $TpmData{$t}{$shortn}{'Description'} = trim($tpm->getAttribute("Description")); - $TpmData{$t}{$shortn}{'License'} = trim($tpm->getAttribute("License")); - my @foo = $tpm->getList("Installation"); - $TpmData{$t}{$shortn}{'Installation'} = \@foo ; - my $alldeps = get_requires($tpm,'all'); - my @incs = @{$alldeps->{'Package'}}; - my @deps = @{$alldeps->{'TLCore'}}; - $TpmData{$t}{$shortn}{'Package'} = \@incs; - $TpmData{$t}{$shortn}{'TLCore'} = \@deps; - } - } - print " ... done\n"; -} - -sub create_tlsrc_files { - print "Creating tlsrc files TpmData\n\n"; - #foreach my $t ('TLCore', 'Documentation', 'Package') { - foreach my $t ('TLCore', 'Documentation') { - print "Creating tlsrc for $t:\n"; - my %foo = %{$TpmData{$t}}; - foreach my $p (keys %foo) { - open (FOO,">tlsrc/$p.tlsrc") || die("Cannot open tlsrc/$p.tlsrc!"); - print FOO "name $p\n"; - print FOO "category $t\n"; - if ($TpmData{$t}{$p}{'Title'} !~ /^[[:space:]]*$/) { - print FOO "shortdesc $TpmData{$t}{$p}{'Title'}\n"; - } - $_tmp = "$TpmData{$t}{$p}{'Description'}"; - if (defined($_tmp) && ($_tmp !~ /^[[:space:]]*$/)) { - $_tmp = "longdesc $_tmp"; - write FOO; - } - #print FOO "longdesc $TpmData{$t}{$p}{'Description'}\n"; - foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { - print FOO "depend $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { - print FOO "depend $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'SourcePatterns'}}) { - print FOO "SourcePatterns f $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'BinPatterns'}}) { - print FOO "binpatterns f $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'DocPatterns'}}) { - print FOO "docpatterns f $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'RunPatterns'}}) { - next if ($foo =~ /\.tpm$/); - print FOO "runpatterns f $foo\n"; - } - foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { - my %foo = %{$ex}; - print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; - } - close(FOO); - } - } - return (0); - foreach my $t ('Package') { - print "Creating tlsrc for $t:\n"; - my %foo = %{$TpmData{$t}}; - foreach my $p (keys %foo) { - open (FOO,">tlsrc/$p.tlsrc") || die("Cannot open tlsrc/$p.tlsrc!"); - print FOO "name $p\n"; - foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { - print FOO "depend $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { - print FOO "depend $foo\n"; - } - foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { - my %foo = %{$ex}; - print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; - } - close(FOO); - } - } -} - - -&main(@ARGV); - -1; - -# variables needed outside of main -my $version; -my $revision; -my $extraversion; -my $date; -my $arch; -my $shortl; - -sub main { - ${Tpm::MasterDir} = $TeXLive{'all'}{'tpm_global_path'}; - $arch = "all"; - ${Tpm::CurrentArch} = "i386-linux"; - ${Tpm::MasterDir} = $Master; - load_collection_tpm_data(); - create_tlsrc_files(); -} - -##################################### -# -# Formats -# -format FOO = -^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$_tmp - ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$_tmp -. - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/etc/read-tpm-dump-tpl.pl b/new-infra/etc/read-tpm-dump-tpl.pl deleted file mode 100755 index a35072c0da8..00000000000 --- a/new-infra/etc/read-tpm-dump-tpl.pl +++ /dev/null @@ -1,314 +0,0 @@ -#!/usr/bin/env perl -# -# tpm2deb-source.pl -# machinery to create debian packages from TeX Live depot -# (c) 2005, 2006 Norbert Preining -# -# $Id: tpm2deb-source.pl 2691 2007-04-16 09:42:22Z frank $ -# -# configuration is done via the file tpm2deb.cfg -# - -use strict; -no strict 'refs'; -# use warnings; -# no warnings 'uninitialized'; - -my $opt_master; -our $opt_debug; -our $opt_nosrcpkg; -our $opt_noremove; -my $globalreclevel; -my $oldsrcdir; -my $datadump ; - -BEGIN { - my $upstream_modules = "/usr/share/tex-common/"; - unshift (@INC, "./all/debian"); - unshift (@INC, $upstream_modules); -} - -my ($mydir,$mmydir); -($mydir = $0) =~ s,/[^/]*$,,; -if ($mydir eq $0) { $mydir = `pwd` ; chomp($mydir); } -if (!($mydir =~ m,/.*,,)) { $mmydir = `pwd`; chomp($mmydir); $mydir = "$mmydir/$mydir" ; } - - -# $opt_master = "./LocalTPM"; -$opt_debug = 0; -$opt_nosrcpkg = 0; -$opt_noremove = 0; -$globalreclevel = 1; -$oldsrcdir = "./src"; -$datadump = "tpm.data"; - -use Getopt::Long; -# use Data::Dumper; - -#use Strict; -use File::Basename; -use File::Copy; -use File::Path; -use File::Temp qw/ tempfile tempdir /; -use Storable; -## not needed, atm we are calling eperl binary use Parse::ePerl; -#use XML::DOM; -use Cwd; -#use FileUtils qw(canon_dir cleandir make_link newpath member -# normalize substitute_var_val dirname diff_list remove_list -# rec_rmdir sync_dir walk_dir start_redirection stop_redirection); -#use Tpm; -# -# Configuration for destination of files -# DONT USER DOUBLE QUOTES; THESE VARIABLES HAVE TO GET REEVALUATED -# AFTER $tmpdir IS SET!! -# -my $changelog = ""; -my $changelogversion = ""; -my $changelogextraversion = ""; -my $changelogrevision = ""; -my $changelogdistribution = ""; -my $allowed_dists = "(unstable|UNRELEASED|sarge-backports|etch-backports|stable-security|experimental)"; - - -our $Master; -our %TpmData; - -$Master = `pwd`; -chomp($Master); -my $TpmGlobalPath = $Master; -my $DataGlobalPath = $Master; - -unshift (@INC, "$Master/../Build/tools"); -File::Basename::fileparse_set_fstype('unix'); - - -use Getopt::Long; -use File::Basename; -use File::Copy; -use File::Path; -use File::Temp qw/ tempfile tempdir /; -use Storable; -use Cwd; -use Tpm; - -our (%TeXLive); -our (%Config,%TpmData); -our %TexmfTreeOfType = ( "TLCore" => "texmf", - "Documentation" => "texmf-doc", - "Package" => "texmf-dist"); -our @TpmCategories = keys %TexmfTreeOfType; -our %TypeOfTexmfTree = reverse %TexmfTreeOfType; - -# pre set $opt_master to ./LocalTPM which contains also the Tools dir -# this is set in the main script, and changed with commandline option. -# should it maybe be deleted here? - -my $opt_debug; -my $opt_onlyscripts; - -sub populate_TpmData_from_dump { - my $datafile = $_[0]; - my $tpmdataref = retrieve($datafile); - %TpmData = %{$tpmdataref}; -} - -sub load_collection_tpm_data { - # local functions - sub trim { - my ($str) = @_; - $str =~ s/^[\n\s]+//; - $str =~ s/[\n\s]+$//; - return $str; - } - sub get_requires { - my ($tpm,$type) = @_; - my %requires = $tpm->getHash("Requires"); - my @keylist = keys %requires; - my @tlcorereqlist = (); - my @packagereqlist = (); - if ($type eq '') { - $type = "all"; - } - foreach my $k (keys %requires) { - foreach my $e (@{$requires{$k}}) { - # manually exclude Windows-only packages - if ($e eq "bin-bzip2") {} - elsif ($e eq "bin-xpdf") {} - elsif ($e eq "bin-chktex") {} - elsif ($e eq "bin-ghostscript") {} - elsif ($e eq "bin-gzip") {} - elsif ($e eq "bin-jpeg2ps") {} - elsif ($e eq "bin-perl") {} - elsif ($e eq "bin-windvi") {} - elsif ($e eq "lib-freetype2") {} - elsif ($e eq "lib-gd") {} - elsif ($e eq "lib-geturl") {} - elsif ($e eq "lib-gnu") {} - elsif ($e eq "lib-gs") {} - elsif ($e eq "lib-jpeg") {} - elsif ($e eq "lib-md5") {} - elsif ($e eq "lib-png") {} - elsif ($e eq "lib-regex") {} - elsif ($e eq "lib-texmfmp") {} - elsif ($e eq "lib-tiff") {} - elsif ($e eq "lib-ttf") {} - elsif ($e eq "lib-xpdf") {} - elsif ($e eq "lib-xpm") {} - elsif ($e eq "lib-zlib") {} - elsif ($e =~ /^bin-(.*)$/) { - push @packagereqlist, "$k/$e"; - } - elsif ($e =~ /^hyphen-(.*)$/){ - push @packagereqlist, "$k/$e"; - } - elsif ($k eq "TLCore") { - push @tlcorereqlist, "$k/$e"; - } else { - push @packagereqlist, "$k/$e"; - } - } - } - if ($type eq '' || $type eq 'all') { - my %foo; - $foo{'TLCore'} = \@tlcorereqlist; - $foo{'Package'} = \@packagereqlist; - #my @foo=(@tlcorereqlist,@packagereqlist); - #return(@foo); - return(\%foo); - } elsif ($type eq 'TLCore') { - return(@tlcorereqlist); - } elsif ($type eq 'Package') { - return(@packagereqlist); - } else { - die("Don't know this type: $type!\n"); - } - } - # start of real function - print "Start loading tpm data ... \n"; - foreach my $t ('TLCore', 'Documentation', 'Package') { - my $subtree = ${TexmfTreeOfType}{$t}; - foreach my $f (<$Master/$subtree/tpm/*.tpm>) { - print "Working on $f\n"; - my $shortn = basename($f); - $shortn =~ s,\.tpm$,,; - if (($t eq 'TLCore') && ($shortn =~ m/^scheme-/)) { next ; } - my $tpm = Tpm->new("$subtree/tpm/$shortn.tpm"); - foreach my $a (@Tpm::ArchList) { - ${Tpm::CurrentArch} = $a; - $TpmData{$t}{$shortn}{'BinFiles'}{$a} = [ $tpm->getFileList("BinFiles") ]; - } - #$TpmData{$t}{$shortn}{'BinFiles'} = [ $tpm->getFileList("BinFiles") ]; - $TpmData{$t}{$shortn}{'DocFiles'} = [ $tpm->getFileList("DocFiles") ]; - $TpmData{$t}{$shortn}{'RunFiles'} = [ $tpm->getFileList("RunFiles") ]; - $TpmData{$t}{$shortn}{'SourceFiles'} = [ $tpm->getFileList("SourceFiles") ]; - $TpmData{$t}{$shortn}{'RemoteFiles'} = [ $tpm->getFileList("RemoteFiles") ]; - $TpmData{$t}{$shortn}{'Title'} = trim($tpm->getAttribute("Title")); - # print "got title $TpmData{$t}{$shortn}{'Title'}\n"; - $TpmData{$t}{$shortn}{'Description'} = trim($tpm->getAttribute("Description")); - $TpmData{$t}{$shortn}{'License'} = trim($tpm->getAttribute("License")); - my @foo = $tpm->getList("Installation"); - $TpmData{$t}{$shortn}{'Installation'} = \@foo ; - my $alldeps = get_requires($tpm,'all'); - my @incs = @{$alldeps->{'Package'}}; - my @deps = @{$alldeps->{'TLCore'}}; - $TpmData{$t}{$shortn}{'Package'} = \@incs; - $TpmData{$t}{$shortn}{'TLCore'} = \@deps; - } - } - print " ... done\n"; -} - -sub dump_tpm_data { - print "Dumping TpmData\n\n"; - foreach my $t ('TLCore', 'Documentation', 'Package') { - #foreach my $t ('Package') { - print "Dumping $t:\n"; - my %foo = %{$TpmData{$t}}; - foreach my $p (keys %foo) { - open (FOO,">tlptpm/$p.tlp") || die("Cannot open tlptpm/$p.tpmtlp!"); - print FOO "name $p\n"; - print FOO "category $t\n"; - foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { - print FOO "depend $foo\n"; - } - foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { - print FOO "depend $foo\n"; - } - foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { - my %foo = %{$ex}; - print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; - } - my @foo; - @foo = @{$TpmData{$t}{$p}{'DocFiles'}}; - if ($#foo >= 0) { - print FOO "docfiles\n"; - foreach my $foo (sort @foo) { - print FOO " $foo\n"; - } - } - @foo = @{$TpmData{$t}{$p}{'SourceFiles'}}; - if ($#foo >= 0) { - print FOO "srcfiles\n"; - foreach my $foo (sort @foo) { - print FOO " $foo\n"; - } - } - @foo = @{$TpmData{$t}{$p}{'RunFiles'}}; - if ($#foo >= 1) { - print FOO "runfiles\n"; - foreach my $foo (sort @foo) { - next if ($foo =~ /\.tpm$/); - print FOO " $foo\n"; - } - } - @foo = @{$TpmData{$t}{$p}{'RemoteFiles'}}; - if ($#foo >= 0) { - print FOO "remotefiles\n"; - foreach my $foo (sort @foo) { - print FOO " $foo\n"; - } - } - foreach my $a (sort @Tpm::ArchList) { - @foo = @{$TpmData{$t}{$p}{'BinFiles'}{$a}}; - if ($#foo >= 0) { - print FOO "binfiles arch=$a\n"; - foreach my $foo (sort @foo) { - print FOO " $foo\n"; - } - } - } - close(FOO); - } - } -} - - -&main(@ARGV); - -1; - -# variables needed outside of main -my $version; -my $revision; -my $extraversion; -my $date; -my $arch; -my $shortl; - -sub main { - ${Tpm::MasterDir} = $TeXLive{'all'}{'tpm_global_path'}; - $arch = "all"; - ${Tpm::CurrentArch} = "i386-linux"; - ${Tpm::MasterDir} = $Master; - load_collection_tpm_data(); - dump_tpm_data(); -} - - -### Local Variables: -### perl-indent-level: 4 -### tab-width: 4 -### indent-tabs-mode: t -### End: -# vim:set tabstop=4: # diff --git a/new-infra/test-tldb.pl b/new-infra/test-tldb.pl deleted file mode 100644 index 9238c4f1e77..00000000000 --- a/new-infra/test-tldb.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env perl -w - -use strict; - -use TLSRC; -use TLP; -use TLDB; -use TLTREE; - -#our $opt_debug=1; - -my $tldb = new TLDB; -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); - $tldb->add_tlp($tlp); -} - -$tldb->location("test.tldb"); -$tldb->save; - -print "=========================\n"; - -my $tldbnew = new TLDB; -$tldbnew->from_file("test.tldb"); -$tldbnew->writeout; - diff --git a/new-infra/test-tlp.pl b/new-infra/test-tlp.pl deleted file mode 100644 index b709f49cf0a..00000000000 --- a/new-infra/test-tlp.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env perl -w - -use strict; -use Data::Dumper; - -use TLP; - -my $tlp = new TLP; -$tlp->from_file("tlp/bar.tlp"); -#print Dumper($tlp); - -$tlp->writeout(); - -print "executes: " , $tlp->executes, "...\n"; - diff --git a/new-infra/test-tlp2.pl b/new-infra/test-tlp2.pl deleted file mode 100644 index 7b58b792fc7..00000000000 --- a/new-infra/test-tlp2.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env perl -w - -use strict; - -use TLSRC; -use TLP; -use TLTREE; -use Data::Dumper; - -#our $opt_debug = 1; - -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,">tlp/$name.tlp"); - $tlp->writeout(\*FOO); - close(FOO); - $tlp->make_zip($tltree,"./zip"); # name absent, use the name of the tlp -} - - diff --git a/new-infra/test-tlsrc.pl b/new-infra/test-tlsrc.pl deleted file mode 100644 index 7a6017f55cb..00000000000 --- a/new-infra/test-tlsrc.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env perl -w - -use strict; - -use TLSRC; - -my $tlsrc = new TLSRC; -$tlsrc->from_file("tlsrc/bar.tlsrc"); -$tlsrc->writeout(); - -my $tl = TLSRC->new( 'name' => "foobar", - 'shortdesc' => "The foobar packages", - 'catalogue' => "foobarcatalogue", - 'depends' => [ 1, 2, 3 ] ); -$tl->writeout(\*STDERR); diff --git a/new-infra/test-tltree.pl b/new-infra/test-tltree.pl deleted file mode 100644 index b6728323946..00000000000 --- a/new-infra/test-tltree.pl +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env perl -w - -use lib '/src/TeX/texlive-svn/new-infra'; - -use strict; - -our $opt_debug=1; - -use TLTREE; -use Data::Dumper; - -my $tl = TLTREE->new( 'svnroot' => "/src/TeX/texlive-svn/new-infra" ); - -print "svnroot = ", $tl->svnroot, "\n"; -$tl->init_from_svn; - -print Dumper($tl); - -#$tl->print; - -my $fn="texmf-dist/fonts/tfm/baz/file1"; -print "$fn rev = ", $tl->file_svn_lastrevision($fn), "\n"; - -my $foo = $tl->get_matching_files("run","t texmf-dist fonts"); - -print "files under texmf-dist fonts = @$foo\n"; - -$foo = $tl->get_matching_files('run',"f texmf/.*/bar/.*"); - -print "files mathcing f texmf/.*/bar/.*: @$foo\n"; - -$foo = $tl->get_matching_files('bin','f bin/${ARCH}/.*'); - -foreach (keys %$foo) { - my @a = @{$foo->{$_}}; - print "arch=$_: @a\n"; -} - - -$foo = $tl->get_matching_files('run','f texmf-dist/fonts/tfm/bar/file?'); -print "file matching g texmf-dist/fonts/tfm/bar/file?: @$foo\n"; diff --git a/new-infra/tldb2list.pl b/new-infra/tldb2list.pl deleted file mode 100644 index 68c2fe73c67..00000000000 --- a/new-infra/tldb2list.pl +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env perl -w -# -# tldb2list.pl -# create list file from tldb -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version -# - -BEGIN { - ($mydir = $0) =~ s,/[^/]*$,,; - unshift (@INC, $mydir); -} - -use strict; - -use TLP; -use TLDB; -use Getopt::Long; -use Pod::Usage; -use File::Path; - - -my $opt_outputdir = "new-list"; -our $opt_debug = 0; -my $man = 0; -my $help = 0; - -GetOptions("debug!", # debug mode - "outputdir=s" => \$opt_outputdir, - 'help|?' => \$help, man => \$man - ) or pod2usage(2); - -pod2usage(1) if $help; -pod2usage(1) if ($#ARGV<0); -pod2usage(-exitstatus => 0, -verbose => 2) if $man; - -if (! -d "$opt_outputdir") { - mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; -} - - -die "Cannot read tldb file $ARGV[0]." if (! -r "$ARGV[0]"); - -my $tldb = new TLDB ( location => "$ARGV[0]" ); - -$tldb->generate_listfiles($opt_outputdir); - -__END__ - -=head1 NAME - -tldb2list - Generates list files from a TeX Live Database - -=head1 SYNOPSIS - -tldb2list [options] texlive.tldb - - Options: - -help brief help message - -man full documentation - -outputdir=s specify the directory where list files are created - -debug get debug messages from TL* modules - -=head1 OPTIONS - -=over 8 - -=item B<-help> - -Print a brief help message and exits. - -=item B<-man> - -Prints the manual page and exits. - -=item B<-outputdir> - -Specifies the location where list files are created. Defaults to ./new-list - -=item B<-debug> - -Give debug messages from the TeX Live modules - -=back - -=head1 DESCRIPTION - -B<tldb2list> generates list files necessary for the installer from the -TeX Live Database. - -=cut - - diff --git a/new-infra/tlsrc2tldb.pl b/new-infra/tlsrc2tldb.pl deleted file mode 100644 index 920efdce3f6..00000000000 --- a/new-infra/tlsrc2tldb.pl +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env perl -w -# -# tlsrc2tldb.pl -# convert a set of tlsrc files (given as arguments) into tldb -# Copyright 2007 Norbert Preining -# -# This file is licensed under the GNU General Public Licence version 2 -# or any later version -# - -BEGIN { - ($mydir = $0) =~ s,/[^/]*$,,; - unshift (@INC, $mydir); -} - -use strict; - -use TLSRC; -use TLP; -use TLDB; -use TLTREE; -use Getopt::Long; -use Pod::Usage; -use File::Path; - - -my $opt_master = "/src/TeX/texlive-svn/Master"; -our $opt_debug = 0; -my $man = 0; -my $help = 0; - -GetOptions("debug!", # debug mode - "master=s" => \$opt_master, # location of the tree - 'help|?' => \$help, man => \$man - ) or pod2usage(2); - -pod2usage(1) if $help; -pod2usage(-exitstatus => 0, -verbose => 2) if $man; - -if (! -d "$opt_master") { - die "Master $opt_master does not exists!"; -} - -my $tltree = TLTREE->new( 'svnroot' => "$opt_master" ); -$tltree->init_from_svn; - -my $tldb = TLDB->new; - -foreach my $f (@ARGV) { - my $tlsrc = new TLSRC; - $tlsrc->from_file($f); - my $tlp = $tlsrc->make_tlp($tltree); - $tldb->add_tlp($tlp); -} - -$tldb->writeout; - -__END__ - -=head1 NAME - -tlsrc2tldb - Converting tlsrc files into tldb file - -=head1 SYNOPSIS - -tlsrc2tldb [options] [tlsrcfiles ...] - - Options: - -help brief help message - -man full documentation - -master=s set Master of TeX Live tree - -debug get debug messages from TL* modules - -=head1 OPTIONS - -=over 8 - -=item B<-help> - -Print a brief help message and exits. - -=item B<-man> - -Prints the manual page and exits. - -=item B<-master> - -The location given by B<-master> must point to a valid svn repository -of TeX Live Master direcory. Defaults to /src/TeX/texlive-svn/Master - -=item B<-debug> - -Give debug messages from the TeX Live modules - -=back - -=head1 DESCRIPTION - -B<tlsrc2tldb> converts TeX Live Source (tlsrc) files into TeX Live Database -(tldb). - -=cut - - |