Signed-off-by: Lin Jiaxin ljx.joe@qq.com --- lib/common.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/lib/common.rb b/lib/common.rb index 91997baa..cc64eb17 100755 --- a/lib/common.rb +++ b/lib/common.rb @@ -319,3 +319,25 @@ end def delete_file_if_exist(file) File.delete(file) if File.exist?(file) end + +def build_pkg_error_id(line) + line = line.chomp + line = line.gsub(/\b[3-9].[0-9]+[-a-z0-9.]+/, "#") # linux version: 3.17.0-next-20141008-g099669ed + line = line.gsub(/\b[1-9][0-9]-[A-Z][a-z]+-[0-9]{4}\b/, "#") # Date: 28-Dec-2013 + line = line.gsub(/\b0x[0-9a-f]+\b/, "#") # hex number + line = line.gsub(/\b[a-f0-9]{40}\b/, "#") # SHA-1 + line = line.gsub(/\b[0-9][0-9.]*/, "#") # number + line = line.gsub(/#x\b/, "0x") + line = line.gsub(/[\"$]/, "~") + line = line.gsub(/[ \t]/, " ") + line = line.gsub(/\ \ +/, " ") + line = line.gsub(/([^a-zA-Z0-9])\ /, "\1") + line = line.gsub(/\ ([^a-zA-Z])/, "\1") + line = line.gsub(/^\ /, "") + line = line.gsub(/^-/, "") + line = line.gsub(/\ _/, "_") + line = line.tr(" ", "-") + line = line.gsub(/[-_.,;:#![(]+$/, "") + line = line.gsub(/([-_.,;:#!]){3,}/, ":") + line +end