commit rubygem-cfa for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-cfa for openSUSE:Factory checked in at 2018-04-26 13:31:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-cfa (Old) and /work/SRC/openSUSE:Factory/.rubygem-cfa.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-cfa" Thu Apr 26 13:31:36 2018 rev:9 rq:600973 version:0.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-cfa/rubygem-cfa.changes 2018-03-11 18:02:47.644248318 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-cfa.new/rubygem-cfa.changes 2018-04-26 13:31:38.174140329 +0200 @@ -1,0 +2,8 @@ +Thu Mar 15 12:56:30 UTC 2018 - mvidner@suse.com + +- Distinguish between parsing and serializing in error reports. +- Mention the file being parsed, and the position inside, in error + reports (bsc#1077435) +- 0.6.4 + +------------------------------------------------------------------- Old: ---- cfa-0.6.3.gem New: ---- cfa-0.6.4.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-cfa.spec ++++++ --- /var/tmp/diff_new_pack.RLE862/_old 2018-04-26 13:31:38.682121720 +0200 +++ /var/tmp/diff_new_pack.RLE862/_new 2018-04-26 13:31:38.682121720 +0200 @@ -17,7 +17,7 @@ Name: rubygem-cfa -Version: 0.6.3 +Version: 0.6.4 Release: 0 %define mod_name cfa %define mod_full_name %{mod_name}-%{version} ++++++ cfa-0.6.3.gem -> cfa-0.6.4.gem ++++++ Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/augeas_parser.rb new/lib/cfa/augeas_parser.rb --- old/lib/cfa/augeas_parser.rb 2018-03-09 14:50:46.000000000 +0100 +++ new/lib/cfa/augeas_parser.rb 2018-04-25 09:53:05.000000000 +0200 @@ -298,15 +298,20 @@ # require "cfa/augeas_parser" # # parser = CFA::AugeasParser.new("Sysconfig.lns") + # parser.file_name = "/etc/default/grub" # for error reporting # data = parser.parse(File.read("/etc/default/grub")) # # puts data["GRUB_DISABLE_OS_PROBER"] # data["GRUB_DISABLE_OS_PROBER"] = "true" # puts parser.serialize(data) class AugeasParser + # @return [String] optional, used for error reporting + attr_accessor :file_name + # @param lens [String] a lens name, like "Sysconfig.lns" def initialize(lens) @lens = lens + @file_name = nil end # @param raw_string [String] a string to be parsed @@ -324,7 +329,8 @@ root = load_path = nil Augeas.open(root, load_path, Augeas::NO_MODL_AUTOLOAD) do |aug| aug.set("/input", raw_string) - report_error(aug) unless aug.text_store(@lens, "/input", "/store") + report_error(aug, "parsing", file_name) \ + unless aug.text_store(@lens, "/input", "/store") return AugeasReader.read(aug, "/store") end @@ -343,7 +349,7 @@ AugeasWriter.new(aug).write("/store", data) res = aug.text_retrieve(@lens, "/input", "/store", "/output") - report_error(aug) unless res + report_error(aug, "serializing", file_name) unless res return aug.get("/output") end @@ -358,16 +364,30 @@ private # @param aug [::Augeas] - def report_error(aug) + # @param activity ["parsing", "serializing"] for better error messages + # @param file_name [String,nil] a file name + def report_error(aug, activity, file_name) error = aug.error # zero is no error, so problem in lense - if aug.error[:code].nonzero? - raise "Augeas error #{error[:message]}. Details: #{error[:details]}." + if error[:code].nonzero? + raise "Augeas error: #{error[:message]}. Details: #{error[:details]}." end - msg = aug.get("/augeas/text/store/error/message") - location = aug.get("/augeas/text/store/error/lens") - raise "Augeas parsing/serializing error: #{msg} at #{location}" + file_name ||= "(unknown file)" + raise format("Augeas #{activity} error: %<message>s" \ + " at #{file_name}:%<line>s:%<char>s, lens %<lens>s", + aug_get_error(aug)) + end + + def aug_get_error(aug) + { + message: aug.get("/augeas/text/store/error/message"), + line: aug.get("/augeas/text/store/error/line"), + char: aug.get("/augeas/text/store/error/char"), # column + # file, line+column range, like + # "/usr/share/augeas/lenses/dist/hosts.aug:23.12-.42:" + lens: aug.get("/augeas/text/store/error/lens") + } end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/base_model.rb new/lib/cfa/base_model.rb --- old/lib/cfa/base_model.rb 2018-03-09 14:50:46.000000000 +0100 +++ new/lib/cfa/base_model.rb 2018-04-25 09:53:05.000000000 +0200 @@ -39,6 +39,7 @@ # insertion of such values in the first place. def save(changes_only: false) merge_changes if changes_only + @parser.file_name = @file_path if @parser.respond_to?(:file_name=) @file_handler.write(@file_path, @parser.serialize(data)) end @@ -51,6 +52,7 @@ # @raise a *parser* specific error. If the parsed String is malformed, then # depending on the used parser it may raise an error. def load + @parser.file_name = @file_path if @parser.respond_to?(:file_name=) self.data = @parser.parse(@file_handler.read(@file_path)) @loaded = true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-03-09 14:52:12.000000000 +0100 +++ new/metadata 2018-04-25 09:54:45.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: cfa version: !ruby/object:Gem::Version - version: 0.6.3 + version: 0.6.4 platform: ruby authors: - Josef Reidinger autorequire: bindir: bin cert_chain: [] -date: 2018-03-09 00:00:00.000000000 Z +date: 2018-04-25 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: ruby-augeas
participants (1)
-
root@hilbert.suse.de