diff options
Diffstat (limited to 'Build/cdbuild/place')
-rwxr-xr-x | Build/cdbuild/place | 127 |
1 files changed, 87 insertions, 40 deletions
diff --git a/Build/cdbuild/place b/Build/cdbuild/place index 60381aa411d..dd45d025f55 100755 --- a/Build/cdbuild/place +++ b/Build/cdbuild/place @@ -8,9 +8,18 @@ # Basic usage: place PKG # to process Build/cdbuild/cooked/PKG. +BEGIN { + chomp ($mydir = `dirname $0`); + unshift (@INC, "$mydir/../../Master/tlpkg"); +} + use File::Basename; use File::Find; use Cwd; +use TeXLive::TLPSRC; +use TeXLive::TLPOBJ; +use TeXLive::TLPDB; +use TeXLive::TLTREE; $newpackage = 0; %dirs = (); # dirs we make changes in @@ -38,22 +47,85 @@ if (-d "texmf-dist") {$Root="texmf-dist"; } elsif (-d "texmf-doc") {$Root="texmf-doc"; } elsif (-d "texmf") {$Root="texmf"; } +# I moved this test BEFORE any action. For now I want this script ONLY to +# work with Documentation/Package and NOT with anything else!!! [np] +if ($Root eq 'texmf-doc') { + $Type = 'Documentation'; +} elsif ($Root eq 'texmf-dist') { + $Type = 'Package'; +} else { + die "cannot handle Root=$Root"; +} -# get list of existing files -my $listsfile = "$M/texmf/lists/$package"; -if (-f $listsfile) { - open (LIST, $listsfile) || die "open($listsfile) failed: $!"; - while (<LIST>) { - chomp; - s/\r$//; - $Old{$_} = 1 if /^[A-z]/; +# initialize TLPDB +my $tlpdb = new TeXLive::TLPDB ( location => "$M/texlive.tlpdb" ); +# create TLTREE from stuff in cooked/$pkg +my $tltree = TeXLive::TLTREE->new( 'svnroot' => "$mydir/$package" ); +$tltree->init_from_files; + +# get package from TLPDB; +my $tlpold = $tlpdb->get_package("$package"); +if (defined($tlpold)) { + # what to do with binfiles, but they are not place-ed!!! + foreach ($tlpold->srcfiles, $tlpold->runfiles, $tlpold->docfiles) { + $Old{$_} = 1; } - close (LIST); +} else { + $newpackage = 1; } -else { - $newpackage=1; + +# create new tlpsrc and tlpobj +my $tlpsrc = TeXLive::TLPSRC; +if (! -r "$M/tlpkg/tlpsrc/$package.tlpsrc") { + $tlpsrc->name("$package"); + $tlpsrc->category($Type); + if (!$chicken) { + open TMP, ">$M/tlpkg/tlpsrc/$package.tlpsrc" or die "Cannot open tlpsrc file!"; + $tlpsrc->writeout(\*TMP); + close TMP + } +} else { + $tlpsrc->from_file("$M/tlpkg/tlpsrc/$package.tlpsrc"); } +my $tlpnew = $tlpsrc->make_tlpobj($tltree); + +# we took over the comparison of files from the ctan2tl script since +# we are here in perl world, which makes it easier ... +if (!defined($tlpold)) { + warn "place: $package not present in $M/texlive.tlpdb\n\n"; +} else { + print "\n\f new vs. present $package\n"; + my @oldfiles; + push @oldfiles, $tlpold->srcfiles; + push @oldfiles, $tlpold->runfiles; + push @oldfiles, $tlpold->docfiles; + `rm -f /tmp/pkgfiles.old`; + foreach (sort @oldfiles) { + `echo $_ >> /tmp/pkgfiles.old`; + } + my @newfiles; + push @newfiles, $tlpnew->srcfiles; + push @newfiles, $tlpnew->runfiles; + push @newfiles, $tlpnew->docfiles; + `rm -f /tmp/pkgfiles.new`; + foreach (sort @newfiles) { + `echo $_ >> /tmp/pkgfiles.new`; + } + print `comm -3 /tmp/pkgfiles.new /tmp/pkgfiles.old`; + my @difffiles = `comm -12 /tmp/pkgfiles.new /tmp/pkgfiles.old`; + chomp(@difffiles); + my $sum = 0; + foreach (@difffiles) { + my @foo = `diff --ignore-all-space -U 0 $M/$_ $mydir/$package/$_`; + $sum += ($#foo + 1); + } + my $nrcommfiles = $#difffiles + 1; + print "$nrcommfiles common files, ~$sum lines different\n\n\f\n"; + #`rm -f /tmp/pkgfiles.new /tmp/pkgfiles.old`; +} + + &xchdir ("$mydir/$package"); find (\&files,"."); foreach $file (sort keys %Old) { @@ -81,45 +153,18 @@ foreach $file (sort keys %New) { } } -my $tpmdir = "$M/$Root/tpm"; - xchdir ($mydir); &my_system ("mv $package $package.done"); -if ($Root eq 'texmf-doc') { - $Type = 'Documentation'; -} elsif ($Root eq 'texmf-dist') { - $Type = 'Package'; -} else { - die "cannot handle Root=$Root"; -} chomp (my $tools = `cd $mydir/../../tools && pwd`); -$SETUP = "$tools/tpm-factory.pl --master=$M --tpm_dir=$tpmdir" - . " --ftp_dir=/var/tmp --arch=all --patterns=auto" - . " --name=$Type/$package"; - -# create tpm if needed -&my_system ("perl $SETUP --new") unless -f "$tpmdir/$package.tpm"; - -# update tpm -&my_system ("perl $SETUP --clean"); - -# create/update lists file -&my_system ("xsltproc --stringparam ROOT $M" - . " $tools/tpm2list.xsl $M/$Root/tpm/$package.tpm"); - - -# add tpm and lists files after they are created. if ($newpackage) { - &add_file ($listsfile); - &add_file ("$tpmdir/$package.tpm"); + &add_file ("$M/tlpkg/tlpsrc/$package.tlpsrc"); } # these two dirs will essentially always change, so just list them. -$dirs{$tpmdir}++; -$dirs{"$M/texmf/lists"}++; +$dirs{"$M/tlpkg/tlpsrc/$package.tlpsrc"}++; # print dirs with changed files, for svn commit purposes. # if other files have been modified in those same dirs, though, this @@ -138,6 +183,8 @@ for my $dir (sort keys %dirs) { # close (DIRLIST) || warn "close($DIRLIST) failed: $!"; +warn "WARNING WARNING Things we SHOULD/COULD do here:\n - Update the texlive.tlpdb\n - Compare the files ACTUALLY present in cooked/package with those included via tlpsrc/tltree generation!!!\n - Create list file\n - Update the list of available packages for web update\n - Create zip file(s)\n\n\n"; + exit (0); |