mosesdecoder/scripts/ems/fix-info.perl
Jeroen Vermeulen ef028446f3 Add license notices to scripts.
This is not pleasant to read (and much, much less pleasant to write!) but
sort of necessary in an open project.  Right now it's quite hard to figure
out what is licensed how, which doesn't matter much to most people but can
suddenly become very important when people want to know what they're being
allowed to do.

I kept the notices as short as I could.  As far as I could see, everything
without a clear license notice is LGPL v2.1 or later.
2015-05-29 18:30:26 +07:00

38 lines
835 B
Perl
Executable File

#!/usr/bin/env perl
#
# This file is part of moses. Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.
use warnings;
use strict;
my ($file,$step) = @ARGV;
$step = "*" unless defined($step);
die("fix-info.perl file [step]") unless defined($file);
die("file not found") unless -e $file;
die("full path!") unless $file =~ /^\//;
my @filestat = stat($file);
my $newtime = $filestat[9];
open(LS,"ls steps/$step/*INFO|") || die;
while(my $info = <LS>) {
chop($info);
my @INFO = `cat $info`;
my $changed = 0;
foreach (@INFO) {
if (/$file .*\[/) {
$changed++;
s/($file) (.*\[)\d+/$1 $2$newtime/g;
}
}
if ($changed) {
print "updating $info\n";
open(INFO,">$info");
foreach (@INFO) { print INFO $_; }
close(INFO);
}
}
close(LS);