summaryrefslogtreecommitdiff
path: root/Build/cdbuild
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-05-08 00:13:28 +0000
committerKarl Berry <karl@freefriends.org>2006-05-08 00:13:28 +0000
commitaebc7413643392b97f19dcd5f383185ee502eb27 (patch)
tree948b47a8e82ec23fb8e04b87ae0dfac38545751c /Build/cdbuild
parent20d94fbf6b0adb2c242f1cc856842079eb9e309c (diff)
rewrite more for svn support
git-svn-id: svn://tug.org/texlive/trunk@1572 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/cdbuild')
-rw-r--r--Build/cdbuild/.svnignore2
-rwxr-xr-xBuild/cdbuild/place117
2 files changed, 76 insertions, 43 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;
}
}