From 540f23b2064f049e3e826cfb512e7431c1521f87 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 15 Jun 2007 14:53:00 +0000 Subject: loads of updates I git-svn-id: svn://tug.org/texlive/trunk@4434 c570f23f-e606-0410-a88d-b1316a301751 --- new-infra/Perl-API.txt | 38 ++++-- new-infra/Shell-API.txt | 37 ++++++ new-infra/TLP.pm | 112 +++++++++++++++-- new-infra/TLSRC.pm | 142 ++++++++++++++++----- new-infra/TLTREE.pm | 1 + new-infra/TODO | 119 +++++++++++++++++- new-infra/TeXLiveInfra.sh | 264 +++++++++++++++++++++++++++++++++++++++ new-infra/create_tlp_simple.pl | 30 +++++ new-infra/specification.txt | 26 ++-- new-infra/tlp2tldb.pl | 82 ++++++++++++ new-infra/tlsrc/binaries-a.tlsrc | 1 + new-infra/tlsrc/foo.tlsrc | 1 + new-infra/tlsrc2tldb.pl | 104 +++++++++++++++ new-infra/tlsrc2tlp.pl | 114 +++++++++++++++++ 14 files changed, 1013 insertions(+), 58 deletions(-) create mode 100644 new-infra/Shell-API.txt create mode 100644 new-infra/TeXLiveInfra.sh create mode 100644 new-infra/create_tlp_simple.pl create mode 100644 new-infra/tlp2tldb.pl create mode 100644 new-infra/tlsrc2tldb.pl create mode 100644 new-infra/tlsrc2tlp.pl diff --git a/new-infra/Perl-API.txt b/new-infra/Perl-API.txt index 20d58ed021b..616c7eab40f 100644 --- a/new-infra/Perl-API.txt +++ b/new-infra/Perl-API.txt @@ -62,21 +62,38 @@ Input/Output for comparison with tpm/tlps, will go away $tlp->make_zip($tltree[,$destdir[,$zipname]]); - creates a zip file of the tlp in $destdir (if not - defined then TLP->zipdir is used). + creates a zip file of the arch INDEPENDENT files in tlp + in $destdir (if not defined then TLP->zipdir is used). The file name of the created zipfile is $zipname (if not present $tlp->name.zip) If the package contains "binfiles"; then zip files for - all archs containing binfiles are created, and the zipfile - name is - $zipname-$arch.zip + all archs containing ONLY the binfiles are created, and + the zipfile name is + $zipname.$arch.zip + + (Compatibility with the scheme used before) + + $tlp->make_list($location) + create list files in $location (could be more than one for + packages with binary files) + WARNING: not completely implemented, I need someone who + explains me the list format, I cannot read the + foo2lists.xsl stuff arrggggg Utilities: $tlp->recompute_sizes($tltree) recomputes all the *size fields, see below + $tlp->recompute_revision($tltree) + recomputes the revision of the package $tlp->is_arch_dependent true if it contains bin files, otherwise false + $tlp->total_size + if no arguments given this is + srcsize + docsize + runsize + if args are given then this is + srcsize + docsize + runsize + + + sum_{i in args} binsize{$i} Read/Write functions (with argument set, without arg read) @@ -103,17 +120,22 @@ Read/Write functions (with argument set, without arg read) reads/returns array $tlp->add_srcfiles(@files) + $tlp->remove_srcfiles(@files) adds @files to the list of srcfiles $tlp->add_docfiles(@files) + $tlp->remove_docfiles(@files) adds @files to the list of docfiles $tlp->add_runfiles(@files) - adds @files to the list of runfiles + $tlp->remove_runfiles(@files) + adds/removes @files to the list of runfiles $tlp->add_binfiles($arch,@files) - adds @files to the list of binfiles for arch=$arch + $tlp->remove_binfiles($arch,@files) + adds/removes @files to the list of binfiles for arch=$arch $tlp->add_files($type,@files) - adds @files to the list of $type = (run|doc|src)files + $tlp->remove_files($type,@files) + adds/removes @files to the list of $type = (run|doc|src)files NOT FOR binfiles! diff --git a/new-infra/Shell-API.txt b/new-infra/Shell-API.txt new file mode 100644 index 00000000000..b4bae1b6448 --- /dev/null +++ b/new-infra/Shell-API.txt @@ -0,0 +1,37 @@ +API for Shell interface for new infra +===================================== + +bash will be used, POSIX maybe later + + +Module TLP +---------- + +Read/Write functions (with argument set, without arg read) + + tlp_get_{name,category,revision,shortdesc,longdesc,catalogue} $tlpfile + gets the respective field of the TLP + tlp_get_{src,doc,run}files $tlpfile + gets the list of {src,doc,run}files + tlp_get_{src,doc,run}size $tlpfile + gets the of the respective group of files + tlp_get_available_archs $tlpfile + returns the list of archs present in $tlpfile for binfiles + tlp_get_binfiles $tlpfle $arch + gets the list of binfiles for $arch + tlp_get_binsize $tlpfile $arch + gets the size of binfiles for $arch + tlp_get_{depends,executes} $tlpfile + returns a list depends/executes + + +Module TLDB +----------- + all function under TLP can be used with a tldb_ prefix: + tldb_tlp_get_{name,category,revision,...} $tldbfile "packagename" + gets the respective field of the TLP + + tldb_list_installed_packages $tldbfile + + what else do we need? + diff --git a/new-infra/TLP.pm b/new-infra/TLP.pm index 2045dcdab00..190d9f2b116 100644 --- a/new-infra/TLP.pm +++ b/new-infra/TLP.pm @@ -176,6 +176,22 @@ sub from_fh { 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); @@ -318,20 +334,21 @@ sub make_zip { $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 ($tltree->architectures) { if (defined($self->{'binfiles'}{$t})) { &TLUtils::debug("arch=$t\n"); if ($zipname =~ /^(.*)\.zip$/) { - $zipn = "$1-$t.zip"; + $zipn = "$1.$t.zip"; } else { - $zipn = "$zipname-$t.zip"; + $zipn = "$zipname.$t.zip"; } $self->_make_zip($tltree,$destdir,$zipn,$t); } } - } else { - $self->_make_zip($tltree,$destdir,$zipname,"all"); } } @@ -340,11 +357,12 @@ sub _make_zip { my $root = $tltree->svnroot; my @files = (); my $zipcmd; - push @files, $self->runfiles; - push @files, $self->docfiles; - push @files, $self->srcfiles; 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/) { @@ -381,6 +399,31 @@ sub _make_zip { print "Done $zipname\n" if ($::opt_debug); } +sub make_list { + my ($self,$loc) = @_; + warn "TODO: make_list format of list file is not right!"; + my $nam = $self->name; + mkpath("$loc") if (! -d "$loc"); + open(TMP,">$loc/$nam") or die("Cannot open $loc/$nam"); + foreach (@{$self->depends}) { + print TMP "+$_\n"; + } + foreach (@{$self->runfiles}, @{$self->docfiles}, @{$self->srcfiles}) { + print TMP $_,"\n"; + } + foreach (@{$self->executes}) { + print TMP "!$_\n"; + } + close TMP; + foreach my $t (keys %{$self->{'binfiles'}}) { + open(TMP,">$loc/$nam.$t") or die "Cannot open $loc/$nam.$t"; + foreach (@{$self->{'binfiles'}{$t}}) { + print TMP "$_\n"; + } + close TMP; + } +} + sub is_arch_dependent { my $self = shift; if (keys %{$self->{'binfiles'}}) { @@ -390,6 +433,20 @@ sub is_arch_dependent { } } +# 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 # @@ -435,7 +492,11 @@ sub srcsize { } sub add_srcfiles { my ($self,@files) = @_; - push @{ $self->{'srcfiles'} }, @files; + $self->add_files("src",@files); +} +sub remove_srcfiles { + my ($self,@files) = @_; + $self->remove_files("src",@files); } sub docfiles { my $self = shift; @@ -449,7 +510,11 @@ sub docsize { } sub add_docfiles { my ($self,@files) = @_; - push @{ $self->{'docfiles'} }, @files; + $self->add_files("doc",@files); +} +sub remove_docfiles { + my ($self,@files) = @_; + $self->remove_files("doc",@files); } sub binfiles { my $self = shift; @@ -465,7 +530,17 @@ sub binsizes { } sub add_binfiles { my ($self,$arch,@files) = @_; - push @{ $self->{'binfiles'}{$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; @@ -479,13 +554,28 @@ sub runsize { } sub add_runfiles { my ($self,@files) = @_; - &TLUtils::push_uniq(\@{ $self->{'runfiles'} }, @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'} } = @_ } diff --git a/new-infra/TLSRC.pm b/new-infra/TLSRC.pm index 04cba813d7d..804ebc8ccad 100644 --- a/new-infra/TLSRC.pm +++ b/new-infra/TLSRC.pm @@ -194,23 +194,6 @@ sub writeout { sub make_tlp { my ($self,$tltree) = @_; - # predefined patterns if all are missing - if (! ( (defined($self->{'runpatterns'})) || - (defined($self->{'srcpatterns'})) || - (defined($self->{'docpatterns'})) || - (defined($self->{'binpatterns'})) )) { - if ($self->category eq "Package") { - foreach my $md (qw/bibtex context dvips fonts makeindex metafont - metapost mft omega scripts tex vtex/) { - push @{$self->{'runpatterns'}}, "t texmf-dist $md $self->{'name'}"; - } - push @{$self->{'docpatterns'}}, "t texmf-dist doc $self->{'name'}"; - push @{$self->{'srcpatterns'}}, "t texmf-dist source $self->{'name'}"; - } elsif ($self->category eq "Documentation") { - push @{$self->{'docpatterns'}}, "t texmf-doc doc $self->{'name'}"; - push @{$self->{'srcpatterns'}}, "t texmf-doc source $self->{'name'}"; - } - } my $tlp = TLP->new; $tlp->name($self->name); $tlp->category($self->category); @@ -221,45 +204,142 @@ sub make_tlp { $tlp->depends(@{$self->{'depends'}}) if (defined($self->{'depends'})); $tlp->revision(0); my $filemax; + my $usedefault = 1; + my @allpospats; + my @allnegpats; foreach my $p (@{$self->{'runpatterns'}}) { + if ($p =~ m/^\+!(.*)$/) { + push @allnegpats, $1; + } elsif ($p =~ m/^\+(.*)$/) { + push @allpospats, $1; + } elsif ($p =~ m/^!(.*)$/) { + push @allnegpats, $1; + $usedefault = 0; + } else { + push @allpospats, $p; + $usedefault = 0; + } + } + if ($usedefault) { + if ($self->category eq "Package") { + foreach my $md (qw/bibtex context dvips fonts makeindex metafont + metapost mft omega scripts tex vtex/) { + push @allpospats, "t texmf-dist $md $self->{'name'}"; + } + } + } + foreach my $p (@allpospats) { $self->_do_normal_pattern($p,$tlp,$tltree,'run'); } + foreach my $p (@allnegpats) { + $self->_do_normal_pattern($p,$tlp,$tltree,'run',1); + } + @allpospats = (); + @allnegpats = (); + $usedefault = 1; foreach my $p (@{$self->{'srcpatterns'}}) { + if ($p =~ m/^\+!(.*)$/) { + push @allnegpats, $1; + } elsif ($p =~ m/^\+(.*)$/) { + push @allpospats, $1; + } elsif ($p =~ m/^!(.*)$/) { + push @allnegpats, $1; + $usedefault = 0; + } else { + push @allpospats, $p; + $usedefault = 0; + } + } + if ($usedefault) { + # default patterns for srcfiles + if ($self->category eq "Package") { + push @allpospats, "t texmf-dist source $self->{'name'}"; + } elsif ($self->category eq "Documentation") { + push @allpospats, "t texmf-doc source $self->{'name'}"; + } + } + foreach my $p (@allpospats) { $self->_do_normal_pattern($p,$tlp,$tltree,'src'); } + foreach my $p (@allnegpats) { + $self->_do_normal_pattern($p,$tlp,$tltree,'src',1); + } + @allpospats = (); + @allnegpats = (); + $usedefault = 1; foreach my $p (@{$self->{'docpatterns'}}) { + if ($p =~ m/^\+!(.*)$/) { + push @allnegpats, $1; + } elsif ($p =~ m/^\+(.*)$/) { + push @allpospats, $1; + } elsif ($p =~ m/^!(.*)$/) { + push @allnegpats, $1; + $usedefault = 0; + } else { + push @allpospats, $p; + $usedefault = 0; + } + } + if ($usedefault) { + # default patterns for docfiles + if ($self->category eq "Package") { + push @allpospats, "t texmf-dist doc $self->{'name'}"; + } elsif ($self->category eq "Documentation") { + push @allpospats, "t texmf-doc doc $self->{'name'}"; + } + } + foreach my $p (@allpospats) { $self->_do_normal_pattern($p,$tlp,$tltree,'doc'); } + foreach my $p (@allnegpats) { + $self->_do_normal_pattern($p,$tlp,$tltree,'doc',1); + } + # no default patterns for binfiles + @allpospats = (); + @allnegpats = (); foreach my $p (@{$self->{'binpatterns'}}) { + if ($p =~ m/^\+!(.*)$/) { + push @allnegpats, $1; + } elsif ($p =~ m/^\+(.*)$/) { + push @allpospats, $1; + } elsif ($p =~ m/^!(.*)$/) { + push @allnegpats, $1; + } else { + push @allpospats, $p; + } + } + foreach my $p (@allpospats) { my $matchref; $matchref = $tltree->get_matching_files('bin',$p); my %archmatches = %$matchref; my @archs = $tltree->architectures; - my $filemax; - my @matchfiles; foreach my $arch (@archs) { - @matchfiles = @{$archmatches{$arch}}; - foreach my $f (@matchfiles) { - $filemax = $tltree->file_svn_lastrevision($f); - $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); - } - $tlp->add_binfiles($arch,@matchfiles); + $tlp->add_binfiles($arch,@{$archmatches{$arch}}); + } + } + foreach my $p (@allnegpats) { + my $matchref; + $matchref = $tltree->get_matching_files('bin',$p); + my %archmatches = %$matchref; + my @archs = $tltree->architectures; + foreach my $arch (@archs) { + $tlp->remove_binfiles($arch,@{$archmatches{$arch}}); } } $tlp->recompute_sizes($tltree); + $tlp->recompute_revision($tltree); return $tlp; } sub _do_normal_pattern { - my ($self,$p,$tlp,$tltree,$type) = @_; + my ($self,$p,$tlp,$tltree,$type,$negative) = @_; my $matchref = $tltree->get_matching_files($type,$p); my @matchfiles = @$matchref; - my $filemax; - foreach my $f (@matchfiles) { - $filemax = $tltree->file_svn_lastrevision($f); - $tlp->revision(($filemax > $tlp->revision) ? $filemax : $tlp->revision); + if (defined($negative) && $negative == 1) { + $tlp->remove_files($type,@matchfiles); + } else { + $tlp->add_files($type,@matchfiles); } - $tlp->add_files($type,@matchfiles); } # diff --git a/new-infra/TLTREE.pm b/new-infra/TLTREE.pm index d6b672a2e9c..8b0a9b2a8bb 100644 --- a/new-infra/TLTREE.pm +++ b/new-infra/TLTREE.pm @@ -225,6 +225,7 @@ sub _get_files_matching_glob_pattern { $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) { diff --git a/new-infra/TODO b/new-infra/TODO index 58ad591b97e..7aad077c054 100644 --- a/new-infra/TODO +++ b/new-infra/TODO @@ -2,5 +2,122 @@ TODO for new-infra ================== - create tlsrc file for *all* tpms and write a tpm/tlp comparer so that we can check that the right files etc are included. + partly done, needs fixes for the problematic cases - 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/TeXLiveInfra.sh b/new-infra/TeXLiveInfra.sh new file mode 100644 index 00000000000..e4a6500dd64 --- /dev/null +++ b/new-infra/TeXLiveInfra.sh @@ -0,0 +1,264 @@ +# +# TeXLiveInfra.sh +# shell library for the access to TLDB and TLP +# +# Copyright 2007 Norbert Preining +# +# This file is licensed under the GNU General Public Licence version 2 +# or any later version +# + +die() { + echo $* + exit 1 +} + +test_tlp() { + tlpfile="$1" + if [ ! -r "$tlpfile" ] ; then + die "tlp file not readable: $tlpfile" + fi +} + +# we read the whole tlp again and again +# if we could use some multi-line grepping this could be speed up +# but I guess we would need perl regexp grepping +# BETTER: use an awk program for this, but I am not able to write +# such an awk program. And do we have it available everywhere? +_tlp_get_multi() { + entry="$1" + tlpfile="$2" + arch="$3" + test_tlp "$tlpfile" + ( SAVEDIFS=$IFS ; IFS= ; cat "$tlpfile" | __tlp_get_multi "$entry" "$arch" ) +} +__tlp_get_multi() { + entry="$1" + arch="$2" + if [ "$arch" = "" ] ; then + pat="$entry*" + else + pat="$entry*arch=$arch*" + fi + reading_multi=0 + while read line ; do + case "$line" in + $pat) + reading_multi=1 + ;; + \ *) + if [ $reading_multi = 1 ] ; then + ( IFS=$SAVEDIFS ; echo $line ) + fi + ;; + *) + if [ $reading_multi = 1 ] ; then + # we already have read the interesting part, return now + return + fi + ;; + esac + done +} + +_tlp_get_multi_simple() { + entry="$1" + tlpfile="$2" + test_tlp "$tlpfile" + grep "^$entry" "$tlpfile" | sed -e "s@^$entry[ \t]*@@" +} + +_tlp_get_simple() { + entry="$1" + tlpfile="$2" + field="$3" + prefix="$4" + test_tlp "$tlpfile" + cat "$tlpfile" | __tlp_get_simple $entry $field $prefix +} + +__tlp_get_simple() { + entry="$1" + field="$2" + prefix="$3" + if [ "$field" = "" ] ; then + grep -m 1 "^$entry " | sed -e "s@^$entry[ \t]*@@" | sed -e "s@^$prefix@@" + else + grep -m 1 "^$entry " | awk "{print\$${field}}" | sed -e "s@^$prefix@@" + fi +} + +tlp_get_name() +{ + _tlp_get_simple name "$1" +} +tlp_get_revision() +{ + _tlp_get_simple revision "$1" +} +tlp_get_category () +{ + _tlp_get_simple category "$1" +} +tlp_get_shortdesc () +{ + _tlp_get_simple shortdesc "$1" +} +tlp_get_catalogue () +{ + _tlp_get_simple catalogue "$1" +} +tlp_get_longdesc () +{ + _tlp_get_multi longdesc "$1" +} +tlp_get_depends () +{ + _tlp_get_multi_simple depend "$1" +} +tlp_get_executes () +{ + _tlp_get_multi_simple execute "$1" +} +tlp_get_srcfiles () +{ + _tlp_get_multi srcfiles "$1" +} +tlp_get_docfiles () { + _tlp_get_multi docfiles "$1" +} +tlp_get_runfiles () { + _tlp_get_multi runfiles "$1" +} +tlp_get_srcsize () { + _tlp_get_simple srcfiles "$1" 2 "size=" +} +tlp_get_docsize () +{ + _tlp_get_simple docfiles "$1" 2 "size=" +} +tlp_get_runsize () +{ + _tlp_get_simple runfiles "$1" 2 "size=" +} + +tlp_get_binsize () +{ + tlpfile="$1" + arch="$2" + _tlp_get_simple "binfiles[ \t]*arch=$arch" "$1" 3 "size=" +} +tlp_get_binfiles () +{ + _tlp_get_multi binfile "$1" "$2" +} + +tlp_get_available_arch () +{ + test_tlp "$tlpfile" + grep 'binfiles[ \t]*arch=' "$tlpfile" | awk '{print$2}' | sed -e 's/arch=//' +} + +test_tldb() { + tldbfile="$1" + if [ ! -r "$tldbfile" ] ; then + die "tldb file not readable: $tldbfile" + fi +} + +_tldb_tlp_get_multi() +{ + tldb="$1" + tlp="$2" + entry="$3" + arch="$4" + test_tldb "$tldb" + foundpackage=0 + ( SAVEDIFS=$IFS ; IFS= ; while read line ; do + case "$line" in + name\ $tlp*) + foundpackage=1 + __tlp_get_multi $entry $arch + ;; + *) + if [ $foundpackage = 1 ] ; then + return + fi + ;; + esac + done ) <$tldb +} +_tldb_tlp_get_simple() +{ + tldb="$1" + tlp="$2" + entry="$3" + field="$4" + prefix="$5" + test_tldb "$tldb" + foundpackage=0 + ( SAVEDIFS=$IFS ; IFS= ; while read line ; do + case "$line" in + name\ $tlp*) + foundpackage=1 + __tlp_get_simple $entry $field $prefix + ;; + *) + if [ $foundpackage = 1 ] ; then + return + fi + ;; + esac + done ) <$tldb +} + + +tldb_tlp_get_revision() +{ + _tldb_tlp_get_simple "$1" "$2" revision "$3" "$4" +} +tldb_tlp_get_category () +{ + _tldb_tlp_get_simple "$1" "$2" category "$3" "$4" +} +tldb_tlp_get_shortdesc () +{ + _tldb_tlp_get_simple "$1" "$2" shortdesc "$3" "$4" +} +tldb_tlp_get_catalogue () +{ + _tldb_tlp_get_simple "$1" "$2" catalogue "$3" "$4" +} +tldb_tlp_get_longdesc () +{ + _tldb_tlp_get_multi "$1" "$2" longdesc "$3" +} +tldb_tlp_get_srcfiles () +{ + _tldb_tlp_get_multi "$1" "$2" srcfiles "$3" +} +tldb_tlp_get_docfiles () { + _tldb_tlp_get_multi "$1" "$2" docfiles "$3" +} +tldb_tlp_get_runfiles () { + _tldb_tlp_get_multi "$1" "$2" runfiles "$3" +} +tldb_tlp_get_binfiles () +{ + _tldb_tlp_get_multi "$1" "$2" binfile "$3" +} + +tldb_get_installed_packages () +{ + tldb="$1" + test_tldb "$tldb" + grep ^name "$tldb" | awk '{print$2}' +} + + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # diff --git a/new-infra/create_tlp_simple.pl b/new-infra/create_tlp_simple.pl new file mode 100644 index 00000000000..e8911e190ae --- /dev/null +++ b/new-infra/create_tlp_simple.pl @@ -0,0 +1,30 @@ +#!/usr/bin/env perl -w + +use strict; +use lib '../new-infra'; + +use TLSRC; +use TLP; +use TLTREE; +use Data::Dumper; + +#our $opt_debug=1; + +my $tltree = TLTREE->new( 'svnroot' => "/src/TeX/texlive-svn/Master" ); +print "Initializing tltree start: ", `date`; +$tltree->init_from_statusfile("/src/TeX/texlive-svn/Master/svn.status"); +print "Initializing tltree stop: ", `date`; + +foreach my $f (@ARGV) { + my $tlsrc = new TLSRC; + $tlsrc->from_file($f); + print "WORKING ON $f\n"; + my $tlp = $tlsrc->make_tlp($tltree); + my $name = $tlp->name; + open(FOO,">tlp/$name.tlp"); + $tlp->writeout_simple(\*FOO); + close(FOO); +} + + +print "End of operation: ", `date`; diff --git a/new-infra/specification.txt b/new-infra/specification.txt index 620a37555dd..4c24ce56b8e 100644 --- a/new-infra/specification.txt +++ b/new-infra/specification.txt @@ -35,8 +35,9 @@ catalogue (cheap/expensive means working time) current status: - TYPE PAT + [PREFIX]TYPE PAT TYPE = t f d r + PREFIX = + | +! | ! t word1 ... wordN wordL include all files below all dirs of the form word1/.../wordN/.../wordL/... @@ -52,23 +53,34 @@ catalogue include all files matching /^regexp$/ (expensive) - Note that if one of the patterns section is empty an entry - is automatically generated: + Note that if one of the patterns section is empty OR (!!!) all + provided patterns have the prefix "+" (eg "+f ...."), then + the following patterns are added: for runpatterns: - t texmf-dist topdir $tlp + t texmf-dist topdir $tlp for type = Package (with topdir = bibtex, context, ... see tlsrc2tlp.pl) for docpatterns: - t texmf-dist doc $tlp + t texmf-dist doc $tlp for type = Package + t texmf-doc doc $tlp for type = Documentation for srcpatterns: - t texmf-dist source $tlp + t texmf-dist source $tlp for type = Package + t texmf-doc source $tlp for type = Documentation for binpatterns: NONE!! + + If the prefix contains a ! the pattern is negated, ie after all the + files for positive patterns have been added, those matching the + negative patterns are removed. execute free form is taken one to one into the tlp file depend is taken one to one into the tlp file + made up of + Type/Package + where + Type ::= TLCore | Documentation | Package shortdesc short one line desc @@ -122,7 +134,7 @@ Interpretation maxmimum of all the last_changed_revisions of all contained files -3) tldp file +3) tldb file ------------ concatenation of all the tlp files, separated by empty line(s) diff --git a/new-infra/tlp2tldb.pl b/new-infra/tlp2tldb.pl new file mode 100644 index 00000000000..0d70aff7423 --- /dev/null +++ b/new-infra/tlp2tldb.pl @@ -0,0 +1,82 @@ +#!/usr/bin/env perl -w +# +# tlp2tldb.pl +# convert a set of tlp files (given as arguments) into a 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; + +our $opt_debug = 0; +my $man = 0; +my $help = 0; + +GetOptions("debug!", 'help|?' => \$help, man => \$man) or pod2usage(2); + +pod2usage(1) if $help; +pod2usage(-exitstatus => 0, -verbose => 2) if $man; + +my $tldb = TLDB->new; +foreach my $f (@ARGV) { + my $tlp = new TLP; + $tlp->from_file($f); + $tldb->add_tlp($tlp); +} +$tldb->writeout; + + +__END__ + +=head1 NAME + +tlp2tldb - Converting tlp files into a tldb file + +=head1 SYNOPSIS + +tlp2tldb [options] [tlsrcfiles ...] + + Options: + -help brief help message + -man full documentation + -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<-debug> + +Give debug messages from the TeX Live modules + +=back + +=head1 DESCRIPTION + +B converts TeX Live Package (tlp) files into TeX Live Database +(tldb). + +=cut + diff --git a/new-infra/tlsrc/binaries-a.tlsrc b/new-infra/tlsrc/binaries-a.tlsrc index 2ef6c64830e..aa3838bc8d0 100644 --- a/new-infra/tlsrc/binaries-a.tlsrc +++ b/new-infra/tlsrc/binaries-a.tlsrc @@ -3,3 +3,4 @@ shortdesc binaries for the world longdesc we provide nice binaries for the world longdesc and we want them to rule the world. binpatterns t bin ${ARCH} +docpatterns r texmf/.*/bar/.* diff --git a/new-infra/tlsrc/foo.tlsrc b/new-infra/tlsrc/foo.tlsrc index cff31609465..51e15740980 100644 --- a/new-infra/tlsrc/foo.tlsrc +++ b/new-infra/tlsrc/foo.tlsrc @@ -4,3 +4,4 @@ longdesc the foo package is used for doing useless stuff as here we want to show continued lines execute addMap foo.map +runpatterns +f texmf-dist/fonts/vf/bar/file1 diff --git a/new-infra/tlsrc2tldb.pl b/new-infra/tlsrc2tldb.pl new file mode 100644 index 00000000000..920efdce3f6 --- /dev/null +++ b/new-infra/tlsrc2tldb.pl @@ -0,0 +1,104 @@ +#!/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 converts TeX Live Source (tlsrc) files into TeX Live Database +(tldb). + +=cut + + diff --git a/new-infra/tlsrc2tlp.pl b/new-infra/tlsrc2tlp.pl new file mode 100644 index 00000000000..2c888af4e68 --- /dev/null +++ b/new-infra/tlsrc2tlp.pl @@ -0,0 +1,114 @@ +#!/usr/bin/env perl -w +# +# tlsrc2tlp.pl +# convert a set of tlsrc files (given as arguments) into tlp +# 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 TLTREE; +use Getopt::Long; +use Pod::Usage; +use File::Path; + + +my $opt_master = "/src/TeX/texlive-svn/Master"; +my $opt_outputdir = "./tlp"; +our $opt_debug = 0; +my $man = 0; +my $help = 0; + +GetOptions("debug!", # debug mode + "master=s" => \$opt_master, # location of the tree + "outputdir=s" => \$opt_outputdir, + '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!"; +} + +if (! -d "$opt_outputdir") { + mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; +} + +my $tltree = TLTREE->new( 'svnroot' => "$opt_master" ); +$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,">$opt_outputdir/$name.tlp") or die "Cannot create $opt_outputdir/$name.tlp!"; + $tlp->writeout(\*FOO); + close(FOO); +} + + +__END__ + +=head1 NAME + +tlsrc2tlp - Converting tlsrc files into tlp files + +=head1 SYNOPSIS + +tlsrc2tlp [options] [tlsrcfiles ...] + + Options: + -help brief help message + -man full documentation + -master=s set Master of TeX Live tree + -outputdir=s specify the directory where tlp 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<-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<-outputdir> + +Specifies the location where tlp files are created. Defaults to ./tlp + +=item B<-debug> + +Give debug messages from the TeX Live modules + +=back + +=head1 DESCRIPTION + +B converts TeX Live Source (tlsrc) files into TeX Live Package +files (tlp). + +=cut + + -- cgit v1.2.3