| 1 |
kraai |
1.1 |
#! /usr/bin/perl
|
| 2 |
|
|
|
| 3 |
|
|
# this script finds new files and touches old ones so that the list of
|
| 4 |
|
|
# languages at the bottom is updated to include the new file.
|
| 5 |
|
|
# or something like that. made by Joey.
|
| 6 |
|
|
|
| 7 |
|
|
%config = (
|
| 8 |
|
|
'wmldir' => '/org/www.debian.org/webwml',
|
| 9 |
|
|
'datadir' => '/org/www.debian.org/cron/datafiles',
|
| 10 |
|
|
);
|
| 11 |
|
|
|
| 12 |
|
|
sub make_listing
|
| 13 |
|
|
{
|
| 14 |
|
|
unlink ("$config{'datadir'}/wmlfiles.old") if (-f "$config{'datadir'}/wmlfiles.old");
|
| 15 |
|
|
rename ("$config{'datadir'}/wmlfiles", "$config{'datadir'}/wmlfiles.old") if (-f "$config{'datadir'}/wmlfiles");
|
| 16 |
|
|
system ("find . -type f -name '*.wml' | sort > $config{'datadir'}/wmlfiles");
|
| 17 |
|
|
}
|
| 18 |
|
|
|
| 19 |
|
|
sub obtain_files
|
| 20 |
|
|
{
|
| 21 |
|
|
my @list;
|
| 22 |
|
|
return unless -s "$config{'datadir'}/wmlfiles.old";
|
| 23 |
|
|
return unless -s "$config{'datadir'}/wmlfiles";
|
| 24 |
taffit-guest |
1.2 |
if (open (IN, "diff $config{'datadir'}/wmlfiles.old $config{'datadir'}/wmlfiles|")) {
|
| 25 |
kraai |
1.1 |
while (<IN>) {
|
| 26 |
|
|
next until (/^[<>] \.\//);
|
| 27 |
|
|
s/^[<>] \.\///;
|
| 28 |
|
|
chomp ();
|
| 29 |
|
|
push (@list, $_);
|
| 30 |
|
|
}
|
| 31 |
|
|
close (IN);
|
| 32 |
|
|
}
|
| 33 |
|
|
return @list;
|
| 34 |
|
|
}
|
| 35 |
|
|
|
| 36 |
|
|
chdir ($config{'wmldir'}) || die;
|
| 37 |
|
|
|
| 38 |
|
|
use Getopt::Std;
|
| 39 |
|
|
$opt_d = 0;
|
| 40 |
|
|
unless (getopts('d')) {
|
| 41 |
|
|
print <<_END_;
|
| 42 |
|
|
Usage: $0 [-d]
|
| 43 |
|
|
|
| 44 |
|
|
This script finds new translations and translations that have been
|
| 45 |
|
|
removed and touches the translations so they rebuild and include a
|
| 46 |
|
|
link to the new ones and remove links to old ones.
|
| 47 |
|
|
|
| 48 |
|
|
-d Remove files, just not report.
|
| 49 |
|
|
_END_
|
| 50 |
|
|
exit;
|
| 51 |
|
|
}
|
| 52 |
|
|
|
| 53 |
|
|
make_listing ();
|
| 54 |
|
|
|
| 55 |
|
|
@files = obtain_files ();
|
| 56 |
|
|
|
| 57 |
|
|
foreach $file (@files) {
|
| 58 |
|
|
@components = split (/\//, $file);
|
| 59 |
|
|
shift @components;
|
| 60 |
|
|
my $cmd = "touch */" . join '/', @components;
|
| 61 |
|
|
printf "$cmd\n";
|
| 62 |
|
|
if ($opt_d) {
|
| 63 |
|
|
system($cmd) == 0 or die;
|
| 64 |
|
|
}
|
| 65 |
|
|
}
|