2013-10-15 18:19:59 +00:00
|
|
|
#! /usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
// compare_pot file1 file2 [--email email_addr ...]
|
|
|
|
//
|
2013-10-16 05:46:18 +00:00
|
|
|
// compare two .pot files, ignoring comments and creation time.
|
2013-10-15 18:19:59 +00:00
|
|
|
// If they differ, send email to the given addresses
|
|
|
|
|
|
|
|
function strip_comments($x) {
|
|
|
|
$y = "";
|
|
|
|
foreach ($x as $l) {
|
2013-10-16 05:46:18 +00:00
|
|
|
if (substr($l, 0, 1) == '#') continue;
|
|
|
|
if (strstr($l, "POT-Creation-Date")) continue;
|
|
|
|
$y .= $l;
|
2013-10-15 18:19:59 +00:00
|
|
|
}
|
|
|
|
return $y;
|
|
|
|
}
|
|
|
|
|
|
|
|
function pot_same($f1, $f2) {
|
|
|
|
$c1 = strip_comments(file($f1));
|
|
|
|
$c2 = strip_comments(file($f2));
|
|
|
|
return ($c1 == $c2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($argc < 3) die("Usage\n");
|
|
|
|
if (pot_same($argv[1], $argv[2])) {
|
|
|
|
echo "files match\n";
|
|
|
|
} else {
|
|
|
|
echo "files don't match\n";
|
|
|
|
for ($i=3; $i<$argc; $i++) {
|
|
|
|
mail($argv[$i],
|
|
|
|
$argv[1]." updated",
|
|
|
|
$argv[1]." was updated. Please review, copy to boinc/locale/templates, and commit"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|