Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.