diff options
65 files changed, 723 insertions, 0 deletions
diff --git a/new-infra/Makefile b/new-infra/Makefile new file mode 100644 index 00000000000..0ad364dca02 --- /dev/null +++ b/new-infra/Makefile @@ -0,0 +1,12 @@ + +all: + mkdir tlp + perl tlsrc2tlp.pl tlsrc/*.tlsrc + bash tlp2tldb.sh tlp/*.tlp > full.tldb + mv tlp tlp.old + mkdir tlp + perl use_tldb.pl full.tldb + diff -urN tlp.old tlp + +clean: + rm -rf tlp tlp.old full.tldb diff --git a/new-infra/README b/new-infra/README new file mode 100644 index 00000000000..ea0e49a153a --- /dev/null +++ b/new-infra/README @@ -0,0 +1,20 @@ +A short example implementation + +make runs the following commands: + +1) generates tlp from tlsrc/*.tlsrc + currently implemented is the auto generation of packages + if no pattern is given (see tlsrc/foo.tlsrc) and more + complicated patterns (using perl regexp atm). + +2) generates a tldb from tlp/*.tlp + trivial concatenation with empty lines between + +3) moves tlp to tlp.old + +4) re-generates the tlp from the tldb + use_tldb defines a function read_tldb_file which reads the whole + file into a hash + +5) compares tlp.old and tlp + diff --git a/new-infra/specification.txt b/new-infra/specification.txt new file mode 100644 index 00000000000..4364ad00cb1 --- /dev/null +++ b/new-infra/specification.txt @@ -0,0 +1,84 @@ +Specifications +============== + +(I opt AGAINST @foobar, this makes perl code much more complicate!) + +1) tlsrc +-------- +one file *WITHOUT* empty lines (but beginning and end) +every line looks like + key value +possible keys are + name (must be first) + shortdesc + longdesc + catalogue + runpattern + srcpattern + docpattern + binpattern + execute + depend + +Interpretation: +name + name of the package + +catalogue + name of the respective Catalogue entry, if missing, same as name + +(run|src|doc|bin)pattern + list of pattern of the form + TYPE PAT + where + TYPE = d f + and PAT is a free text + if there is a line + pattern d texmf-dist/.*/foobar + then all files in leaf directories named foobar under texmf-dist + are included + a line + pattern f bin/${ARCH}/.*${EXT} + includes all files which are in bin/$ARCH/ and have extension ${EXT} + where ARCH and EXT are expanded by the tlsrc interpreter + +execute free from + is taken one to one into the tlp file + +depend + is taken one to one into the tlp file + +shortdesc + short one line desc + is taken one to one into the tlp file + if missing can be taken from Catalogue + +longdesc + longer multiline dscription + is taken one to one into the tlp file + if missing can be taken from Catalogue + +2) tlp file +----------- +same format as tlsrc, but the keys are + name + revision + shortdesc + longdesc + catalogue + binfiles + runfiles + docfiles + srcfiles + execute + depend + ??? what am I missing ??? + +Interpretation + obvious + +3) tldp file +------------ +concatenation of all the tlp files, separated by empty line(s) + + diff --git a/new-infra/texmf-dist/fonts/map/bar/file1 b/new-infra/texmf-dist/fonts/map/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/bar/file1 diff --git a/new-infra/texmf-dist/fonts/map/bar/file2 b/new-infra/texmf-dist/fonts/map/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/bar/file2 diff --git a/new-infra/texmf-dist/fonts/map/bar/file3 b/new-infra/texmf-dist/fonts/map/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/bar/file3 diff --git a/new-infra/texmf-dist/fonts/map/baz/file1 b/new-infra/texmf-dist/fonts/map/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/baz/file1 diff --git a/new-infra/texmf-dist/fonts/map/baz/file2 b/new-infra/texmf-dist/fonts/map/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/baz/file2 diff --git a/new-infra/texmf-dist/fonts/map/baz/file3 b/new-infra/texmf-dist/fonts/map/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/baz/file3 diff --git a/new-infra/texmf-dist/fonts/map/foo/file1 b/new-infra/texmf-dist/fonts/map/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/foo/file1 diff --git a/new-infra/texmf-dist/fonts/map/foo/file2 b/new-infra/texmf-dist/fonts/map/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/foo/file2 diff --git a/new-infra/texmf-dist/fonts/map/foo/file3 b/new-infra/texmf-dist/fonts/map/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/map/foo/file3 diff --git a/new-infra/texmf-dist/fonts/tfm/bar/file1 b/new-infra/texmf-dist/fonts/tfm/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/bar/file1 diff --git a/new-infra/texmf-dist/fonts/tfm/bar/file2 b/new-infra/texmf-dist/fonts/tfm/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/bar/file2 diff --git a/new-infra/texmf-dist/fonts/tfm/bar/file3 b/new-infra/texmf-dist/fonts/tfm/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/bar/file3 diff --git a/new-infra/texmf-dist/fonts/tfm/baz/file1 b/new-infra/texmf-dist/fonts/tfm/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/baz/file1 diff --git a/new-infra/texmf-dist/fonts/tfm/baz/file2 b/new-infra/texmf-dist/fonts/tfm/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/baz/file2 diff --git a/new-infra/texmf-dist/fonts/tfm/baz/file3 b/new-infra/texmf-dist/fonts/tfm/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/baz/file3 diff --git a/new-infra/texmf-dist/fonts/tfm/foo/file1 b/new-infra/texmf-dist/fonts/tfm/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/foo/file1 diff --git a/new-infra/texmf-dist/fonts/tfm/foo/file2 b/new-infra/texmf-dist/fonts/tfm/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/foo/file2 diff --git a/new-infra/texmf-dist/fonts/tfm/foo/file3 b/new-infra/texmf-dist/fonts/tfm/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/tfm/foo/file3 diff --git a/new-infra/texmf-dist/fonts/vf/bar/file1 b/new-infra/texmf-dist/fonts/vf/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/bar/file1 diff --git a/new-infra/texmf-dist/fonts/vf/bar/file2 b/new-infra/texmf-dist/fonts/vf/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/bar/file2 diff --git a/new-infra/texmf-dist/fonts/vf/bar/file3 b/new-infra/texmf-dist/fonts/vf/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/bar/file3 diff --git a/new-infra/texmf-dist/fonts/vf/baz/file1 b/new-infra/texmf-dist/fonts/vf/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/baz/file1 diff --git a/new-infra/texmf-dist/fonts/vf/baz/file2 b/new-infra/texmf-dist/fonts/vf/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/baz/file2 diff --git a/new-infra/texmf-dist/fonts/vf/baz/file3 b/new-infra/texmf-dist/fonts/vf/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/baz/file3 diff --git a/new-infra/texmf-dist/fonts/vf/foo/file1 b/new-infra/texmf-dist/fonts/vf/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/foo/file1 diff --git a/new-infra/texmf-dist/fonts/vf/foo/file2 b/new-infra/texmf-dist/fonts/vf/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/foo/file2 diff --git a/new-infra/texmf-dist/fonts/vf/foo/file3 b/new-infra/texmf-dist/fonts/vf/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/fonts/vf/foo/file3 diff --git a/new-infra/texmf-dist/tex/latex/bar/file1 b/new-infra/texmf-dist/tex/latex/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/bar/file1 diff --git a/new-infra/texmf-dist/tex/latex/bar/file2 b/new-infra/texmf-dist/tex/latex/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/bar/file2 diff --git a/new-infra/texmf-dist/tex/latex/bar/file3 b/new-infra/texmf-dist/tex/latex/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/bar/file3 diff --git a/new-infra/texmf-dist/tex/latex/baz/file1 b/new-infra/texmf-dist/tex/latex/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/baz/file1 diff --git a/new-infra/texmf-dist/tex/latex/baz/file2 b/new-infra/texmf-dist/tex/latex/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/baz/file2 diff --git a/new-infra/texmf-dist/tex/latex/baz/file3 b/new-infra/texmf-dist/tex/latex/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/baz/file3 diff --git a/new-infra/texmf-dist/tex/latex/foo/file1 b/new-infra/texmf-dist/tex/latex/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/foo/file1 diff --git a/new-infra/texmf-dist/tex/latex/foo/file2 b/new-infra/texmf-dist/tex/latex/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/foo/file2 diff --git a/new-infra/texmf-dist/tex/latex/foo/file3 b/new-infra/texmf-dist/tex/latex/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-dist/tex/latex/foo/file3 diff --git a/new-infra/texmf-doc/doc/bar/file1 b/new-infra/texmf-doc/doc/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/bar/file1 diff --git a/new-infra/texmf-doc/doc/bar/file2 b/new-infra/texmf-doc/doc/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/bar/file2 diff --git a/new-infra/texmf-doc/doc/bar/file3 b/new-infra/texmf-doc/doc/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/bar/file3 diff --git a/new-infra/texmf-doc/doc/baz/file1 b/new-infra/texmf-doc/doc/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/baz/file1 diff --git a/new-infra/texmf-doc/doc/baz/file2 b/new-infra/texmf-doc/doc/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/baz/file2 diff --git a/new-infra/texmf-doc/doc/baz/file3 b/new-infra/texmf-doc/doc/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/baz/file3 diff --git a/new-infra/texmf-doc/doc/foo/file1 b/new-infra/texmf-doc/doc/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/foo/file1 diff --git a/new-infra/texmf-doc/doc/foo/file2 b/new-infra/texmf-doc/doc/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/foo/file2 diff --git a/new-infra/texmf-doc/doc/foo/file3 b/new-infra/texmf-doc/doc/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf-doc/doc/foo/file3 diff --git a/new-infra/texmf/test/bar/aaa/file1 b/new-infra/texmf/test/bar/aaa/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/test/bar/aaa/file1 diff --git a/new-infra/texmf/test/bar/aaa/file2 b/new-infra/texmf/test/bar/aaa/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/test/bar/aaa/file2 diff --git a/new-infra/texmf/test/bar/aaa/file3 b/new-infra/texmf/test/bar/aaa/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/test/bar/aaa/file3 diff --git a/new-infra/texmf/tmp1/tmp2/bar/file1 b/new-infra/texmf/tmp1/tmp2/bar/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/bar/file1 diff --git a/new-infra/texmf/tmp1/tmp2/bar/file2 b/new-infra/texmf/tmp1/tmp2/bar/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/bar/file2 diff --git a/new-infra/texmf/tmp1/tmp2/bar/file3 b/new-infra/texmf/tmp1/tmp2/bar/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/bar/file3 diff --git a/new-infra/texmf/tmp1/tmp2/baz/file1 b/new-infra/texmf/tmp1/tmp2/baz/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/baz/file1 diff --git a/new-infra/texmf/tmp1/tmp2/baz/file2 b/new-infra/texmf/tmp1/tmp2/baz/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/baz/file2 diff --git a/new-infra/texmf/tmp1/tmp2/baz/file3 b/new-infra/texmf/tmp1/tmp2/baz/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/baz/file3 diff --git a/new-infra/texmf/tmp1/tmp2/foo/file1 b/new-infra/texmf/tmp1/tmp2/foo/file1 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/foo/file1 diff --git a/new-infra/texmf/tmp1/tmp2/foo/file2 b/new-infra/texmf/tmp1/tmp2/foo/file2 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/foo/file2 diff --git a/new-infra/texmf/tmp1/tmp2/foo/file3 b/new-infra/texmf/tmp1/tmp2/foo/file3 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/new-infra/texmf/tmp1/tmp2/foo/file3 diff --git a/new-infra/tlp2tldb.sh b/new-infra/tlp2tldb.sh new file mode 100644 index 00000000000..d7bb6138138 --- /dev/null +++ b/new-infra/tlp2tldb.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for i in "$@" ; do + cat $i + echo "" +done + diff --git a/new-infra/tlsrc/bar.tlsrc b/new-infra/tlsrc/bar.tlsrc new file mode 100644 index 00000000000..fb13f1e373d --- /dev/null +++ b/new-infra/tlsrc/bar.tlsrc @@ -0,0 +1,14 @@ +name bar +shortdesc the bar ckage +longdesc the bar package is used for doing useless + stuff as here we want to show + continued lines aof i opidf poi posidpfo ispodf posdf posopd fj + o sdpjf poj pdsjf pjdsf pjsodfj opkjsdf jsokdfjopksjf pojsdpfj s + oj spodfj kj okfjsdof jsodkjf opksjdf kjsdfkj skdfjsdf jsjdf ojksdf + js odfj oskjdf oksjfokjsdokfjsodkfj oskdjf oksjdfokjsdokfjsdokf + jksopjdfo sj dfokj sdokjf oksdjf ksdojfosd fjosdjf osdokfj +depend othercoll +depend another collection +depend foo +runpattern d texmf-dist/.*/bar +binpattern f texmf/.*/bar/.* diff --git a/new-infra/tlsrc/foo.tlsrc b/new-infra/tlsrc/foo.tlsrc new file mode 100644 index 00000000000..cff31609465 --- /dev/null +++ b/new-infra/tlsrc/foo.tlsrc @@ -0,0 +1,6 @@ +name foo +shortdesc the foo package +longdesc the foo package is used for doing useless + stuff as here we want to show + continued lines +execute addMap foo.map diff --git a/new-infra/tlsrc2tlp.pl b/new-infra/tlsrc2tlp.pl new file mode 100644 index 00000000000..7e98fa0d8db --- /dev/null +++ b/new-infra/tlsrc2tlp.pl @@ -0,0 +1,339 @@ +#!/usr/bin/perl -w +# +# tlsrc2tlp.pl +# generate tlp files from tlsrc files +# (c) 2007 Norbert Preining +# +# This file is licensed under the GNU General Public Licence version 2 +# (not later) + +use strict; + +my %tls; +my %tldb; +my $opt_debug = 0; +my %AllFiles; + +my $tlpline; + +&main(@ARGV); + +1; + + + + +sub main { + my (@tlsrc) = @_; + foreach my $f (@tlsrc) { + read_tlsrc_file($f); + } + initialize_all_files(); + foreach my $f (keys %tls) { + generate_tlp_data($f); + } + foreach my $f (keys %tldb) { + write_tlp_file($f); + } + foreach my $f (keys %AllFiles) { + if ($AllFiles{$f} eq "") { + print STDERR "Not covered file: $f\n"; + } + } +} + +sub read_tlsrc_file { + my ($tlsrc) = @_; + open(TMP,"<$tlsrc") || die("Cannot open $tlsrc: $!"); + my @lines = <TMP>; + close(TMP); + my $name = ""; + my $shortdesc = ""; + my $longdesc= ""; + my $catalogue = ""; + my (@executes, @depends); + my (@runpatterns, @docpatterns, @binpatterns, @srcpatterns); + my $started = 0; + my $finished = 0; + my $lastcmd = ""; + + logit("Working on $tlsrc\n"); + 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 files!"); + } + if ($line =~ /^ /) { + if ( ($lastcmd eq "longdesc") || + ($lastcmd eq "runpattern") || + ($lastcmd eq "binpattern") || + ($lastcmd eq "docpattern") || + ($lastcmd eq "srcpattern") || + ($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+)$/) { + logit("found name: $1\n"); + $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*(.*)$/) { + logit("found shortdesc: $1\n"); + $shortdesc .= "$1 "; + $lastcmd = "shortdesc"; + next; + } elsif ($line =~ /^longdesc\s*(.*)$/) { + logit("found longdesc: $1\n"); + $longdesc .= "$1 "; + $lastcmd = "longdesc"; + next; + } elsif ($line =~ /^catalogue\s*(.*)$/) { + logit("found catalogue: $1\n"); + $catalogue .= "$1 "; + $lastcmd = "catalogue"; + next; + } elsif ($line =~ /^runpattern\s*(.*)$/) { + logit("found runpattern: $1\n"); + push @runpatterns, "$1"; + $lastcmd = "runpattern"; + next; + } elsif ($line =~ /^srcpattern\s*(.*)$/) { + logit("found srcpattern: $1\n"); + push @srcpatterns, "$1"; + $lastcmd = "srcpattern"; + next; + } elsif ($line =~ /^docpattern\s*(.*)$/) { + logit("found docpattern: $1\n"); + push @docpatterns, "$1"; + $lastcmd = "docpattern"; + next; + } elsif ($line =~ /^binpattern\s*(.*)$/) { + logit("found binpattern: $1\n"); + push @binpatterns, "$1"; + $lastcmd = "binpattern"; + next; + } elsif ($line =~ /^execute\s*(.*)$/) { + logit("found execute: $1\n"); + push @executes, "$1"; + $lastcmd = "execute"; + next; + } elsif ($line =~ /^depend\s*(.*)$/) { + logit("found depend: $1\n"); + push @depends, "$1"; + $lastcmd = "depend"; + next; + } else { + die("Unknown directive ...$line... in $tlsrc, please fix it!"); + } + } + } + logit("Done reading the source file, filling the data structure!\n"); + if ($catalogue ne "") { + $tls{$name}{'catalogue'} = "$catalogue"; + } else { + $tls{$name}{'catalogue'} = "$name"; + } + if ($shortdesc ne "") { + $tls{$name}{'shortdesc'} = "$shortdesc"; + } + if ($longdesc ne "") { + $tls{$name}{'longdesc'} = "$longdesc"; + } + if ($#srcpatterns >= 0) { + $tls{$name}{'srcpatterns'} = [ @srcpatterns ]; + } + if ($#runpatterns >= 0) { + $tls{$name}{'runpatterns'} = [ @runpatterns ]; + } + if ($#binpatterns >= 0) { + $tls{$name}{'binpatterns'} = [ @binpatterns ]; + } + if ($#docpatterns >= 0) { + $tls{$name}{'docpatterns'} = [ @docpatterns ]; + } + if ($#executes >= 0) { + $tls{$name}{'executes'} = [ @executes ]; + } + if ($#depends>= 0) { + $tls{$name}{'depends'} = [ @depends ]; + } +} + +sub initialize_all_files { + foreach my $f (`find texmf texmf-dist texmf-doc -type f`) { + chomp($f); + $AllFiles{$f} = ""; + } +} + +sub generate_tlp_data { + my ($tlp) = @_; + # predefined runpattern if all are missing + if (!(defined($tls{$tlp}{'runpatterns'}))) { + my $l = "d texmf-dist/.*/$tlp"; + @{$tls{$tlp}{'runpatterns'}} = ("$l"); + } + $tldb{$tlp}{'name'} = $tls{$tlp}; + if (defined($tls{$tlp}{'shortdesc'})) { + $tldb{$tlp}{'shortdesc'} = $tls{$tlp}{'shortdesc'}; + } + if (defined($tls{$tlp}{'longdesc'})) { + $tldb{$tlp}{'longdesc'} = $tls{$tlp}{'longdesc'}; + } + if (defined($tls{$tlp}{'catalogue'})) { + $tldb{$tlp}{'catalogue'} = $tls{$tlp}{'catalogue'}; + } + if (defined($tls{$tlp}{'executes'})) { + $tldb{$tlp}{'executes'} = $tls{$tlp}{'executes'}; + } + if (defined($tls{$tlp}{'depends'})) { + $tldb{$tlp}{'depends'} = $tls{$tlp}{'depends'}; + } + $tldb{$tlp}{'runfiles'} = [ ]; + $tldb{$tlp}{'docfiles'} = [ ]; + $tldb{$tlp}{'binfiles'} = [ ]; + $tldb{$tlp}{'srcfiles'} = [ ]; + FILELABEL: foreach my $f (keys %AllFiles) { + foreach my $p (@{$tls{$tlp}{'runpatterns'}}) { + if (pattern_hit($f,$p,"run")) { + $AllFiles{$f} = 1; + logit("Hit\n"); + $tldb{$tlp}{'runfiles'} = [ @{$tldb{$tlp}{'runfiles'}}, $f ]; + next FILELABEL; + } + } + foreach my $p (@{$tls{$tlp}{'docpatterns'}}) { + if (pattern_hit($f,$p,"doc")) { + $AllFiles{$f} = 1; + logit("Hit\n"); + $tldb{$tlp}{'docfiles'} = [ @{$tldb{$tlp}{'docfiles'}}, $f ]; + next FILELABEL; + } + } + foreach my $p (@{$tls{$tlp}{'binpatterns'}}) { + if (pattern_hit($f,$p,"bin")) { + $AllFiles{$f} = 1; + logit("Hit\n"); + $tldb{$tlp}{'binfiles'} = [ @{$tldb{$tlp}{'binfiles'}}, $f ]; + next FILELABEL; + } + } + foreach my $p (@{$tls{$tlp}{'srcpatterns'}}) { + if (pattern_hit($f,$p,"src")) { + $AllFiles{$f} = 1; + logit("Hit\n"); + $tldb{$tlp}{'srcfiles'} = [ @{$tldb{$tlp}{'srcfiles'}}, $f ]; + next FILELABEL; + } + } + } +} + +sub write_tlp_file { + my ($tlp) = @_; + open(TLP,">tlp/$tlp.tlp") || die("Cannot open tlp/$tlp.tlp for writing: $!"); + print TLP "name $tlp\n"; + if (defined($tldb{$tlp}{'shortdesc'})) { + $tlpline = "shortdesc $tldb{$tlp}{'shortdesc'}"; + write TLP; + } + if (defined($tldb{$tlp}{'longdesc'})) { + $tlpline = "longdesc $tldb{$tlp}{'longdesc'}"; + write TLP; + } + if (defined($tldb{$tlp}{'catalogue'})) { + print TLP "catalogue $tldb{$tlp}{'catalogue'}\n"; + } + my @tmp; + if (defined($tldb{$tlp}{'executes'})) { + foreach (@{$tldb{$tlp}{'executes'}}) { + print TLP "execute $_\n"; + } + } + if (defined($tldb{$tlp}{'depends'})) { + foreach (@{$tldb{$tlp}{'depends'}}) { + print TLP "depend $_\n"; + } + } + @tmp = @{$tldb{$tlp}{'docfiles'}}; + if ($#tmp >= 0) { + print TLP "docfiles\n"; + foreach (@tmp) { + print TLP " $_\n"; + } + } + @tmp = @{$tldb{$tlp}{'srcfiles'}}; + if ($#tmp >= 0) { + print TLP "srcfiles\n"; + foreach (@tmp) { + print TLP " $_\n"; + } + } + @tmp = @{$tldb{$tlp}{'binfiles'}}; + if ($#tmp >= 0) { + print TLP "binfiles\n"; + foreach (@tmp) { + print TLP " $_\n"; + } + } + @tmp = @{$tldb{$tlp}{'runfiles'}}; + if ($#tmp >= 0) { + print TLP "runfiles\n"; + foreach (@tmp) { + print TLP " $_\n"; + } + } + close(TLP); +} + +sub logit { + $opt_debug && print STDERR @_; +} + +sub pattern_hit { + my ($file, $pattern, $patterntype) = @_; + $pattern =~ /^(d|f) (.*)$/; + my $pattype = $1; + my $patdata = $2; + if ($pattype eq "d") { + my $dirn = `dirname $file`; # bad, should be rewritten + chomp($dirn); + logit("matching >>>$patdata<<< against >>>$dirn<<<\n"); + if ($dirn =~ /^$patdata$/) { + return 1; + } + } elsif ($pattype eq "f") { + logit("matching >>>$patdata<<< against >>>$file<<<\n"); + if ($file =~ /^$patdata$/) { + return 1; + } + } else { + die("Unknown pattern specification: $pattern!"); + } +} + + +###### Formats +format TLP = +^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$tlpline + ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ +$tlpline +. + + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # diff --git a/new-infra/use_tldb.pl b/new-infra/use_tldb.pl new file mode 100644 index 00000000000..d9342a0267b --- /dev/null +++ b/new-infra/use_tldb.pl @@ -0,0 +1,241 @@ +#!/usr/bin/perl -w +# +# use_tldb.pl +# use the tldb file which is nothing else then a concatenation of +# single tlp files +# (c) 2007 Norbert Preining +# +# This file is licensed under the GNU General Public Licence version 2 +# (not later) + +use strict; + +my %tldb; +my $opt_debug = 0; + +my $tlpline; + +&main(@ARGV); + +1; + + + + +sub main { + my ($tldb) = @_; + read_tldb_file($tldb); + foreach my $f (keys %tldb) { + write_tlp_file($f); + } +} + +sub read_tldb_file { + my ($tldb) = @_; + open(TMP,"<$tldb") || die("Cannot open $tldb: $!"); + my @lines = <TMP>; + close(TMP); + my $name = ""; + my $shortdesc = ""; + my $longdesc= ""; + my $catalogue = ""; + my (@executes, @depends); + my (@runfiles, @docfiles, @binfiles, @srcfiles); + my $started = 0; + my $lastcmd = + + logit("Working on $tldb\n"); + foreach my $line (@lines) { + logit("line=>>>$line<<<\n"); + $line =~ /^\s*#/ && next; # skip comment lines + if ($line =~ /^\s*$/) { + if ($started) { + # one entry is finished, we have to fill the hash and + # clean the tmp variables + # clear the tmp variables + @runfiles = @docfiles = @srcfiles = @binfiles = (); + @executes = @depends = (); + $shortdesc = $longdesc = $catalogue = ""; + $started = 0; + next; + } else { + # ignore empty lines between tlps + next; + } + } + if ($line =~ /^ /) { + if ( ($lastcmd eq "longdesc") || + ($lastcmd eq "runfiles") || + ($lastcmd eq "binfiles") || + ($lastcmd eq "docfiles") || + ($lastcmd eq "srcfiles") || + ($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+)$/) { + logit("found name: $1\n"); + $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*(.*)$/) { + logit("found shortdesc: $1\n"); + $tldb{$name}{'shortdesc'} .= "$1 "; + $lastcmd = "shortdesc"; + next; + } elsif ($line =~ /^longdesc\s*(.*)$/) { + logit("found longdesc: $1\n"); + $tldb{$name}{'longdesc'} .= "$1 "; + $lastcmd = "longdesc"; + next; + } elsif ($line =~ /^catalogue\s*(.*)$/) { + logit("found catalogue: $1\n"); + $tldb{$name}{'catalogue'} = "$1"; + $lastcmd = "catalogue"; + next; + } elsif ($line =~ /^runfiles\s*(.*)$/) { + logit("found runfiles: $1\n"); + push @{$tldb{$name}{'runfiles'}}, "$1" unless "$1" eq ""; + $lastcmd = "runfiles"; + next; + } elsif ($line =~ /^srcfiles\s*(.*)$/) { + logit("found srcfiles: $1\n"); + push @{$tldb{$name}{'srcfiles'}}, "$1" unless "$1" eq ""; + $lastcmd = "srcfiles"; + next; + } elsif ($line =~ /^docfiles\s*(.*)$/) { + logit("found docfiles: $1\n"); + push @{$tldb{$name}{'docfiles'}}, "$1" unless "$1" eq ""; + $lastcmd = "docfiles"; + next; + } elsif ($line =~ /^binfiles\s*(.*)$/) { + logit("found binfiles: $1\n"); + push @{$tldb{$name}{'binfiles'}}, "$1" unless "$1" eq ""; + $lastcmd = "binfiles"; + next; + } elsif ($line =~ /^execute\s*(.*)$/) { + logit("found execute: $1\n"); + push @{$tldb{$name}{'executes'}}, "$1" unless "$1" eq ""; + $lastcmd = "execute"; + next; + } elsif ($line =~ /^depend\s*(.*)$/) { + logit("found depend: $1\n"); + push @{$tldb{$name}{'depends'}}, "$1" unless "$1" eq ""; + $lastcmd = "depend"; + next; + } else { + die("Unknown directive ...$line... in $tldb, please fix it!"); + } + } + } + logit("Done reading the tldb file, filling the data structure!\n"); + if ($catalogue ne "") { + $tldb{$name}{'catalogue'} = "$catalogue"; + } else { + $tldb{$name}{'catalogue'} = "$name"; + } + if ($shortdesc ne "") { + $tldb{$name}{'shortdesc'} = "$shortdesc"; + } + if ($longdesc ne "") { + $tldb{$name}{'longdesc'} = "$longdesc"; + } + if ($#srcfiles >= 0) { + $tldb{$name}{'srcfiles'} = [ @srcfiles ]; + } + if ($#runfiles >= 0) { + $tldb{$name}{'runfiles'} = [ @runfiles ]; + } + if ($#binfiles >= 0) { + $tldb{$name}{'binfiles'} = [ @binfiles ]; + } + if ($#docfiles >= 0) { + $tldb{$name}{'docfiles'} = [ @docfiles ]; + } + if ($#executes >= 0) { + $tldb{$name}{'executes'} = [ @executes ]; + } + if ($#depends>= 0) { + $tldb{$name}{'depends'} = [ @depends ]; + } +} + +sub write_tlp_file { + my ($tlp) = @_; + open(TLP,">tlp/$tlp.tlp") || die("Cannot open tlp/$tlp.tlp for writing: $!"); + print TLP "name $tlp\n"; + if (defined($tldb{$tlp}{'shortdesc'})) { + $tlpline = "shortdesc $tldb{$tlp}{'shortdesc'}"; + write TLP; + } + if (defined($tldb{$tlp}{'longdesc'})) { + $tlpline = "longdesc $tldb{$tlp}{'longdesc'}"; + write TLP; + } + if (defined($tldb{$tlp}{'catalogue'})) { + print TLP "catalogue $tldb{$tlp}{'catalogue'}\n"; + } + my @tmp; + if (defined($tldb{$tlp}{'executes'})) { + foreach (@{$tldb{$tlp}{'executes'}}) { + print TLP "execute $_\n"; + } + } + if (defined($tldb{$tlp}{'depends'})) { + foreach (@{$tldb{$tlp}{'depends'}}) { + print TLP "depend $_\n"; + } + } + if (defined($tldb{$tlp}{'docfiles'})) { + print TLP "docfiles\n"; + foreach (@{$tldb{$tlp}{'docfiles'}}) { + print TLP " $_\n"; + } + } + if (defined($tldb{$tlp}{'srcfiles'})) { + print TLP "srcfiles\n"; + foreach (@{$tldb{$tlp}{'srcfiles'}}) { + print TLP " $_\n"; + } + } + if (defined($tldb{$tlp}{'binfiles'})) { + print TLP "binfiles\n"; + foreach (@{$tldb{$tlp}{'binfiles'}}) { + print TLP " $_\n"; + } + } + if (defined($tldb{$tlp}{'runfiles'})) { + print TLP "runfiles\n"; + foreach (@{$tldb{$tlp}{'runfiles'}}) { + print TLP " $_\n"; + } + } + close(TLP); +} + +sub logit { + $opt_debug && print STDERR @_; +} + + +###### Formats +format TLP = +^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$tlpline + ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ +$tlpline +. + + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # |