blob: 292237db3523be17c10aa7cef724d48013e4fab8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
#!/usr/bin/env perl
# $Id$
# License: public domain. Originally written by Sebastian Rahtz.
#
# Process a tree in the Build/cdbuild/cooked directory (probably created
# by ctan2tds.pl) and integrate into the main texmf trees.
#
# Basic usage: place PKG
# to process Build/cdbuild/cooked/PKG.
#
use English;
use File::Basename;
use File::Find;
use Cwd;
$newpackage=0;
@zapped=();
if ($ARGV[0] eq "-n") {
$chicken = 1;
shift;
} else {
$chicken = 0;
}
print "place: chicken mode = $chicken\n";
if (@ARGV != 1) {
die "usage: $0 PKGNAME\n";
}
$package=$ARGV[0];
xchdir (dirname($0) . "/cooked");
$mydir = getcwd();
-d "$mydir/$package" || die "$0: No such package in $mydir: $package\n";
xchdir ("../../../Master");
$M = getcwd();
xchdir ("$mydir/$package");
if (-d "texmf-dist") {$Root="texmf-dist"; }
elsif (-d "texmf-doc") {$Root="texmf-doc"; }
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);
}
else {
$newpackage=1;
}
if (! -f "$M/$Root/tpm/$package.tpm") {
&my_system ("svn add $M/$Root/tpm/$package.tpm");
}
xchdir("$mydir/$package");
find(\&files,".");
foreach $file (keys %Old) {
print "* $file: [" . $New{$file} . "]\n";
if (! $New{$file}) {
&my_system ("svn remove $PM/$file");
}
}
# copy files
$Job="tar cf - . | (cd $M && tar xf - )";
&my_system ($Job);
foreach $file (keys %New) {
if (! $Old{$file}) {
&my_system ("svn add $M/$file");
}
}
if ($newpackage) {
&my_system ("svn add $M/texmf/lists/$package");
&my_system ("svn add $M/$Root/tpm/$package.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";
}
$SETUP = "$M/Build/tools/tpm-factory.pl --master=$M --tpm_dir=$M/$Root/tpm"
. " --ftp_dir=/var/tmp --arch=all --patterns=auto"
. " --name=$Type/$package";
if (! -f "$M/$Root/tpm/$package.tpm") {
&my_system ("perl $SETUP --new");
}
&my_system ("perl $SETUP --clean");
&my_system ("xsltproc --stringparam ROOT $M"
. " $M/Tools/tpm2list.xsl $M/$Root/tpm/$package.tpm");
exit (0);
#--------------------------------------
sub dirs
{
local @filenames;
if (-d) {
@filenames=&buildfilelist($File::Find::name,
$_);
if (!@filenames) { rmdir $File::Find::name;}
}}
sub buildfilelist
{
local($me,$name) = @_;
my @files;
opendir(DIR,$me) || cleanup ("cannot open directory $me");
@files =grep(!/^\.\.?/,readdir(DIR));
closedir(DIR);
return @files;
}
sub files
{
if (-f) {
$Shortname=$_;
$This=$File::Find::name;
$This =~ s/^\.\///;
$New{$This}=1;
}
}
sub xchdir
{
my ($dir) = @_;
chdir ($dir) || die "chdir($dir) failed: $!";
print "place: chdir($dir)\n";
}
sub my_system
{
my ($cmd) = @_;
print "place: SYSTEM $cmd\n";
unless ($chicken) {
my $ret = system ($cmd);
print "... failed, status=$ret\n" if $ret != 0;
}
}
|