diff options
author | Karl Berry <karl@freefriends.org> | 2006-05-08 00:13:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-05-08 00:13:28 +0000 |
commit | aebc7413643392b97f19dcd5f383185ee502eb27 (patch) | |
tree | 948b47a8e82ec23fb8e04b87ae0dfac38545751c /Build | |
parent | 20d94fbf6b0adb2c242f1cc856842079eb9e309c (diff) |
rewrite more for svn support
git-svn-id: svn://tug.org/texlive/trunk@1572 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/cdbuild/.svnignore | 2 | ||||
-rwxr-xr-x | Build/cdbuild/place | 117 | ||||
-rwxr-xr-x | Build/tools/ctan2tl | 4 |
3 files changed, 79 insertions, 44 deletions
diff --git a/Build/cdbuild/.svnignore b/Build/cdbuild/.svnignore new file mode 100644 index 00000000000..af7018fd3de --- /dev/null +++ b/Build/cdbuild/.svnignore @@ -0,0 +1,2 @@ +cooked +raw diff --git a/Build/cdbuild/place b/Build/cdbuild/place index 292237db352..55fb9eacfb5 100755 --- a/Build/cdbuild/place +++ b/Build/cdbuild/place @@ -7,14 +7,13 @@ # # Basic usage: place PKG # to process Build/cdbuild/cooked/PKG. -# -use English; + use File::Basename; use File::Find; use Cwd; -$newpackage=0; -@zapped=(); +$newpackage = 0; +%dirs = (); # dirs we make changes in if ($ARGV[0] eq "-n") { $chicken = 1; @@ -24,10 +23,8 @@ if ($ARGV[0] eq "-n") { } print "place: chicken mode = $chicken\n"; -if (@ARGV != 1) { - die "usage: $0 PKGNAME\n"; -} -$package=$ARGV[0]; +die "usage: $0 PKGNAME\n" unless @ARGV == 1; +$package = $ARGV[0]; xchdir (dirname($0) . "/cooked"); $mydir = getcwd(); @@ -43,69 +40,87 @@ elsif (-d "texmf") {$Root="texmf"; } # get list of existing files -if (-f "$M/texmf/lists/$package") { - open(LIST,"$M/texmf/lists/$package"); - while (<LIST>) { - chop; - s/
//; - if (/^[A-z]/) { $Old{$_}=1; } - } - close(LIST); +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; } -if (! -f "$M/$Root/tpm/$package.tpm") { - &my_system ("svn add $M/$Root/tpm/$package.tpm"); -} - - -xchdir("$mydir/$package"); -find(\&files,"."); +xchdir ("$mydir/$package"); +find (\&files,"."); foreach $file (keys %Old) { - print "* $file: [" . $New{$file} . "]\n"; - if (! $New{$file}) { - &my_system ("svn remove $PM/$file"); - } + print "* $file: [retained=$New{$file}]\n"; + if (! $New{$file}) { + &my_system ("svn remove $M/$file"); + $dirs{dirname ("$M/$file")}++; + } } # copy files -$Job="tar cf - . | (cd $M && tar xf - )"; +my $Job = "tar cf - . | (cd $M && tar xf - )"; &my_system ($Job); foreach $file (keys %New) { if (! $Old{$file}) { - &my_system ("svn add $M/$file"); - } + &add_file ("$M/$file"); + } } +my $tpmdir = "$M/$Root/tpm"; + if ($newpackage) { - &my_system ("svn add $M/texmf/lists/$package"); - &my_system ("svn add $M/$Root/tpm/$package.tpm"); + &add_file ($listsfile); + &add_file ("$tpmdir/$package.tpm"); } -xchdir($mydir); -&my_system("mv $package $package.done"); +xchdir ($mydir); +&my_system ("mv $package $package.done"); if ($Root eq 'texmf-doc') { - $Type='Documentation'; + $Type = 'Documentation'; } elsif ($Root eq 'texmf-dist') { - $Type='Package'; + $Type = 'Package'; } else { die "cannot handle Root=$Root"; } -$SETUP = "$M/Build/tools/tpm-factory.pl --master=$M --tpm_dir=$M/$Root/tpm" +chomp (my $tools = `cd $M/../Build/tools && pwd`); + +$SETUP = "$tools/tpm-factory.pl --master=$M --tpm_dir=$tpmdir" . " --ftp_dir=/var/tmp --arch=all --patterns=auto" . " --name=$Type/$package"; -if (! -f "$M/$Root/tpm/$package.tpm") { - &my_system ("perl $SETUP --new"); -} + +# 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" - . " $M/Tools/tpm2list.xsl $M/$Root/tpm/$package.tpm"); + . " $tools/tpm2list.xsl $M/$Root/tpm/$package.tpm"); + + +# these two dirs will essentially always change, so just list them. +$dirs{"$M/$Root/tpm"}++; +$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 +# won't detect it. It would be better to list exactly the *files* which +# should be committed, but ... lazy. +# +for my $dir (sort keys %dirs) { + print "$dir\n"; +} exit (0); @@ -134,13 +149,29 @@ sub buildfilelist sub files { if (-f) { - $Shortname=$_; $This=$File::Find::name; $This =~ s/^\.\///; $New{$This}=1; } } +# add a file to the repository. for svn, we also have to add the +# containing dir, if it is new. +# +sub add_file +{ + my ($newfile) = @_; + + my $newdir = dirname ($newfile); + + unless (-d "$newdir/.svn") { + &my_system ("svn add -N $newdir"); + } + + &my_system ("svn add $newfile"); + $dirs{$newdir}++; +} + sub xchdir { my ($dir) = @_; @@ -156,6 +187,6 @@ sub my_system unless ($chicken) { my $ret = system ($cmd); - print "... failed, status=$ret\n" if $ret != 0; + die "`$cmd' failed, status=$ret, goodbye\n" if $ret != 0; } } diff --git a/Build/tools/ctan2tl b/Build/tools/ctan2tl index 4af6a963c77..b59ce7e1071 100755 --- a/Build/tools/ctan2tl +++ b/Build/tools/ctan2tl @@ -98,7 +98,7 @@ test -d ../cooked || mkdir ../cooked cd ../cooked || exit 1 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 +1 +find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -r +1 # compare to tpm. Master=../../../Master @@ -124,5 +124,7 @@ fi printf "\n\f place $place_chicken\n" rm -rf $pkg.done ../place $place_chicken $pkg +status=$? rm -rf ../raw/$pkg +exit $? |