diff options
author | Matt Kraai <kraai> | 2004-05-27 17:34:00 +0000 |
---|---|---|
committer | Matt Kraai <kraai> | 2004-05-27 17:34:00 +0000 |
commit | e7aec00a5a332c003247eae7fd09a3da7816ae9d (patch) | |
tree | 8fa71e5e64290742f49872735415e24e4d90d32d /touch_files.pl | |
parent | 35ab1855150fb9ba24047a30e3c6f4e236215074 (diff) |
Rename touch_old_files.pl to touch_files.pl and make it touch files
for which translations have been removed.
CVS version numbers
touch_files.pl: INITIAL -> 1.1
touch_old_files.pl: 1.4 -> 1.5(DEAD)
Diffstat (limited to 'touch_files.pl')
-rwxr-xr-x | touch_files.pl | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/touch_files.pl b/touch_files.pl new file mode 100755 index 00000000000..ed1a85f63cb --- /dev/null +++ b/touch_files.pl @@ -0,0 +1,65 @@ +#! /usr/bin/perl + +# this script finds new files and touches old ones so that the list of +# languages at the bottom is updated to include the new file. +# or something like that. made by Joey. + +%config = ( + 'wmldir' => '/org/www.debian.org/webwml', + 'datadir' => '/org/www.debian.org/cron/datafiles', + ); + +sub make_listing +{ + unlink ("$config{'datadir'}/wmlfiles.old") if (-f "$config{'datadir'}/wmlfiles.old"); + rename ("$config{'datadir'}/wmlfiles", "$config{'datadir'}/wmlfiles.old") if (-f "$config{'datadir'}/wmlfiles"); + system ("find . -type f -name '*.wml' | sort > $config{'datadir'}/wmlfiles"); +} + +sub obtain_files +{ + my @list; + return unless -s "$config{'datadir'}/wmlfiles.old"; + return unless -s "$config{'datadir'}/wmlfiles"; + if (open (IN, "diff -0 $config{'datadir'}/wmlfiles.old $config{'datadir'}/wmlfiles|")) { + while (<IN>) { + next until (/^[<>] \.\//); + s/^[<>] \.\///; + chomp (); + push (@list, $_); + } + close (IN); + } + return @list; +} + +chdir ($config{'wmldir'}) || die; + +use Getopt::Std; +$opt_d = 0; +unless (getopts('d')) { + print <<_END_; +Usage: $0 [-d] + +This script finds new translations and translations that have been +removed and touches the translations so they rebuild and include a +link to the new ones and remove links to old ones. + + -d Remove files, just not report. +_END_ + exit; +} + +make_listing (); + +@files = obtain_files (); + +foreach $file (@files) { + @components = split (/\//, $file); + shift @components; + my $cmd = "touch */" . join '/', @components; + printf "$cmd\n"; + if ($opt_d) { + system($cmd) == 0 or die; + } +} |