Created
August 5, 2016 11:14
-
-
Save mvidner/5bf7911b79b7d576212be89a84c34202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "fileutils" | |
require "pathname" | |
include FileUtils | |
FILTER_OUT_RES = [ | |
"warning: PO file header fuzzy", | |
"warning: older versions of msgfmt will give an error on this", | |
"warning: header field .* still has the initial default value" | |
] | |
FILTER_OUT_CMD = "grep -v -E '(#{FILTER_OUT_RES.join('|')})'" | |
Y2MAKEPOT = "y2tool y2makepot".freeze | |
def differs_in_date_only(filename1, filename2) | |
system "diff --unchanged-group-format='' #{filename1} #{filename2}" \ | |
' | grep -v -E "^(\"POT-Creation-Date:|\"PO-Revision-Date:|#:) "' \ | |
"> /dev/null" | |
$?.exitstatus == 1 | |
end | |
dir = ARGV.fetch(0) | |
dir = Pathname.new(dir) | |
cd dir do | |
puts "-" * 70 | |
system "pwd" | |
rm Dir.glob("*.pot") | |
system "#{Y2MAKEPOT} |& #{FILTER_OUT_CMD}" | |
status = $? | |
p status | |
end | |
pots = Dir.glob(dir + "*.pot").sort | |
puts "Resulting pots: #{pots}" | |
pots.each do |p| | |
base = Pathname.new(p).basename | |
orig = "~/svn/opensuse-i18n/50-pot-trunk/#{base}" | |
if differs_in_date_only(orig, p) | |
puts "Unchanged: #{p}" | |
else | |
puts "UPDATED: #{p}" | |
puts " see diff -u #{orig} #{p}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment