diff options
author | Norbert Preining <preining@logic.at> | 2007-06-22 08:48:35 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-06-22 08:48:35 +0000 |
commit | 42871161d18b95e44b4ed1d8548f143de6e82c24 (patch) | |
tree | 11c0010ba4dcf6e4326412f0035468f6f1027fd6 | |
parent | 86772000ce73e63e072a7e2991aab7bf2214515a (diff) |
move the comparison from ctan2tl (shell) to place (perl) and implement
the comparison by using tlpsrc->make_tlpobk($tltree) from the $tltree
in cooked/$package.
git-svn-id: svn://tug.org/texlive/trunk@4491 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/cdbuild/place.newinfra | 132 | ||||
-rwxr-xr-x | Build/tools/ctan2tl.newinfra | 33 |
2 files changed, 69 insertions, 96 deletions
diff --git a/Build/cdbuild/place.newinfra b/Build/cdbuild/place.newinfra index 35820be9c12..ee643352642 100755 --- a/Build/cdbuild/place.newinfra +++ b/Build/cdbuild/place.newinfra @@ -47,35 +47,84 @@ 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"; +} # 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 $tlp = $tlpdb->get_package("$package"); -if (defined($tlp)) { +my $tlpold = $tlpdb->get_package("$package"); +if (defined($tlpold)) { # what to do with binfiles, but they are not place-ed!!! - foreach ($tlp->srcfiles, $tlp->runfiles, $tlp->docfiles) { + foreach ($tlpold->srcfiles, $tlpold->runfiles, $tlpold->docfiles) { $Old{$_} = 1; } } else { $newpackage = 1; } -# TLP REPLACES: -# 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]/; -# } -# close (LIST); -#} -#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)) { + print STDERR "$package: not present in $M/texlive.tlpdb\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`; + } + `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"; + #`rm -f /tmp/pkgfiles.new /tmp/pkgfiles.old`; +} + &xchdir ("$mydir/$package"); find (\&files,"."); @@ -104,63 +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`); -# TLP removed -#$SETUP = "$tools/tpm-factory.pl --master=$M --tpm_dir=$tpmdir" -# . " --ftp_dir=/var/tmp --arch=all --patterns=auto" -# . " --name=$Type/$package"; - -# TLP changed: -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 - } -} - -# TLP replaces -# 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) { - # TLP MISSING, do we generate the list file? - #&add_file ($listsfile); - # TLP changed &add_file ("$M/tlpkg/tlpsrc/$package.tlpsrc"); - #&add_file ("$tpmdir/$package.tpm"); } # these two dirs will essentially always change, so just list them. $dirs{"$M/tlpkg/tlpsrc/$package.tlpsrc"}++; -#$dirs{$tpmdir}++; -#$dirs{"$M/texmf/lists"}++; # print dirs with changed files, for svn commit purposes. # if other files have been modified in those same dirs, though, this @@ -179,6 +183,8 @@ for my $dir (sort keys %dirs) { # close (DIRLIST) || warn "close($DIRLIST) failed: $!"; +printf STDERR, "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); diff --git a/Build/tools/ctan2tl.newinfra b/Build/tools/ctan2tl.newinfra index 00312137ddb..9b7c65a076b 100755 --- a/Build/tools/ctan2tl.newinfra +++ b/Build/tools/ctan2tl.newinfra @@ -111,39 +111,6 @@ printf "\n\f cooked\n" find -depth -type d | xargs rmdir 2>/dev/null find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -r +1 -# compare to tpm. -Master=../../../Master -. $Master/tlpkg/lib/TeXLiveInfra.sh -tpmfile=`ls $Master/texmf*/tpm/$pkg.tpm 2>/dev/null` -if ! grep -q "^name $pkg" $Master/texlive.tlpdb ; then - echo "$0: not present in $Master/texlive.tlpdb" >&2 -else - printf "\n\f new vs. present $tpmfile\n" - rm -f /tmp/pkgfiles.* - # remove leading text in case of lines starting with texmf. - # Then assume all actual files do start with texmf. - tldb_tlp_get_srcfiles $Master/texlive.tlpdb $pkg > /tmp/pkgfiles.tpm.foo - tldb_tlp_get_runfiles $Master/texlive.tlpdb $pkg >> /tmp/pkgfiles.tpm.foo - tldb_tlp_get_docfiles $Master/texlive.tlpdb $pkg >> /tmp/pkgfiles.tpm.foo - sort /tmp/pkgfiles.tpm.foo >/tmp/pkgfiles.tpm - # - # list of files in the new package we've just cooked. - (cd $pkg && find \! -type d -print) | grep -v '/cooked/' \ - | sed -e 's,^\./,,' | sort >/tmp/pkgfiles.new - # - comm -3 /tmp/pkgfiles.new /tmp/pkgfiles.tpm - # - comm -12 /tmp/pkgfiles.new /tmp/pkgfiles.tpm >/tmp/tldiff.com - # - for common_file in `cat /tmp/tldiff.com`; do - diff --ignore-all-space -u -U 0 $Master/$common_file $pkg/$common_file - done >/tmp/tldiff - diff_lines=`wc -l </tmp/tldiff` - diff_lines=`expr $diff_lines / 2` - printf "%d common files, ~%d lines different (/tmp/tldiff)\n" \ - `wc -l </tmp/tldiff.com` $diff_lines -fi - printf "\n\f place.newinfra $place_chicken\n" rm -rf $pkg.done ../place.newinfra $place_chicken $pkg |