module RBT::Errors::MapLineToASpecificError
Public Class Methods
all_programs_and_errors?()
click to toggle source
behaviour_changes?()
click to toggle source
do_not_run_ldconfig()
click to toggle source
do_not_run_make()
click to toggle source
do_not_run_make_install()
click to toggle source
do_not_run_ninja()
click to toggle source
do_not_strip_binaries()
click to toggle source
e(i = '')
click to toggle source
erroneous_libtool_entry?()
click to toggle source
missing_package?()
click to toggle source
no_postinstall_step()
click to toggle source
parse_this_line(i)
click to toggle source
#¶ ↑
RBT::Errors::MapLineToASpecificError.parse_this_line
¶ ↑
#¶ ↑
# File lib/rbt/errors/map_line_to_a_specific_error.rb, line 215 def self.parse_this_line(i) # ======================================================================= # # === General error handling # # Here, we should also gather general errors. These will be colourized, # and can also optional include an error_is or problem_is line, to be # more specific and indicative of an error. # ======================================================================= # if i.start_with?("Couldn't find include") or # ==================================================================== # # === Some configure error # ==================================================================== # i.start_with?('configure: error:') or i.include?('ld: warning:') if i.include? '.gir' error_is :gir_file_could_not_be_found end if i.start_with?('configure: error:') error_is :configure_error if i.include?('headers not found') and i.include?('required') error_is :configure_error_could_not_find_certain_headers end end do_not_run_make do_not_run_make_install do_not_strip_binaries no_postinstall_step do_not_run_ldconfig # ======================================================================= # # === -- No package 'gwenhywfar' found # or # === *** The required package libxfce4util-1.0 was not found on your system. # # We have to be careful, as vlc may also show such a message: # # "configure: WARNING: No package 'libsystemd' found." # # This is just a WARNING, so exlcude that. # ======================================================================= # elsif (i.include?('No package') and !i.include?('WARNING:') and i.include?(' found')) or (i.include?('The required package')) # ===================================================================== # # In this case we must register which package was not found. # ===================================================================== # register_this_missing_package(i) error_is :required_package_was_not_found # ======================================================================= # # === Vala-specific error # # An example for this is: # # Package `librsvg-2.0' not found in specified Vala API # # ======================================================================= # elsif i.include?('Package ') and i.include?('not found in specified Vala API') register_this_missing_package(i) error_is :required_package_was_not_found # ======================================================================= # # === Cmake warning that a required package was not found # ======================================================================= # elsif i.include?('A required package was not found') error_is :required_package_was_not_found # ======================================================================= # # === /System/Index/bin/ld: error: cannot find -lxml2 # ======================================================================= # elsif i.include? 'ld: error: cannot find -l' error_is :ld_could_not_find_a_library we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === collect2: error: ld returned 1 exit status # ======================================================================= # elsif i.include?('collect2: error: ld returned 1 exit status') error_is :collect2_and_ld_returned_an_error # ======================================================================= # # === ninja: build stopped: subcommand failed # ======================================================================= # elsif i.include?('ninja: build stopped: subcommand failed') error_is :ninja_build_encountered_an_error # ======================================================================= # # === Must specify at least one directory name. # # This error happens mostly when meson could not use a proper directory. # ======================================================================= # elsif i.include?('Must specify at least one directory name.') error_is :unable_to_find_a_proper_build_directory do_not_run_ninja # ======================================================================= # # === CMake Error: we could not find the file CMakeLists.txt # ======================================================================= # elsif i.include?('CMake Error: The source directory') and i.include?('does not appear to contain CMakeLists.txt.') error_is :cmake_could_not_find_a_cmakelists_txt_file # ======================================================================= # # === CMake Error at CMakeLists.txt # ======================================================================= # elsif i.include?('CMake Error at CMakeLists.txt:') and i.include?('find_package') error_is :cmake_error_we_could_not_find_a_package # ======================================================================= # # === cc1: some warnings being treated as errors # ======================================================================= # elsif i.include?('cc1: some warnings being treated as errors') error_is :cc1_treats_some_warnings_as_errors end # ======================================================================= # # === General make-related errors # ======================================================================= # if i.include?("make: *** No rule to make target 'install'. Stop.") or i.include?('error adding symbols') or (i.include?('make: ***') and i.include?(' Error 2')) or (i.include?('make: ***') and i.include?(' Stop.')) # ===================================================================== # # When we notice that "make install" can not possibly work, then # there is no need to run ldconfig - so we will disable that. # ===================================================================== # do_not_run_ldconfig if i.include?('error adding symbols') register_error :error_adding_symbols elsif (i.include?('make: ***') and i.include?(' Error 2')) or (i.include?('make: ***') and i.include?(' Stop.')) error_is :make_encountered_some_error do_not_run_make_install end end # ======================================================================= # # === Failed to find required LADSPA header ladspa.h # # Missing a specific header file, ladspa # ======================================================================= # if i.include? 'Failed to find required LADSPA header ladspa.h' problem_is :missing_header_ladspa we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === Some C .h file is missing # # In this case the compilation procedure usually can not continue, as # it will miss some relevant file (the .h file) necessary for # continuing. # ======================================================================= # elsif i.include?('.h: No such file or directory') if i.include?('.c:') problem_is(:missing_c_header_file, i) we_can_not_continue_and_we_will_not_run_make_install # ===================================================================== # # === Handle fatal errors next # # This may look like any of the following: # # /usr/include/json-c/json.h:31:10: fatal error: json_object_iterator.h: No such file or directory # dev.h:12:10: fatal error: libusb.h: No such file or directory # # ===================================================================== # elsif i.include?(' fatal error: ') problem_is(:missing_c_header_file, i) we_can_not_continue_and_we_will_not_run_make_install end # ======================================================================= # # === Meson-related errors # ======================================================================= # elsif i.include?("Command 'meson' not found") or i.include?('sh: meson: command not found') error_is :meson_could_not_be_found # ======================================================================= # # === Meson had some Unicode-related error # ======================================================================= # elsif i.include? 'UnicodeEncodeError: ' error_is :meson_encountered_a_unicode_encode_error we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === More Meson-related errors # ======================================================================= # elsif i.include?('meson.')and i.include?('ERROR: ') # ===================================================================== # # Detect the specific error at hand next: # ===================================================================== # error_is :meson_encountered_an_error if i.include? 'Invalid version of dependency, need' error_is :meson_discovered_an_invalid_version_of_a_dependency # =================================================================== # # See: http://rubular.com/r/ADXLYIvc6f # =================================================================== # regex_to_use = /Invalid version of dependency, need '(.+)' \['\S+(.+)'\]/ i =~ regex_to_use # =================================================================== # # We register this as an invalid dependency next: # =================================================================== # register_required_dependency($1.to_s.dup, $2.to_s.dup) end # ======================================================================= # # === configure: error: totem playlist parsing library not found or too old # # This error may occur when the user does not have the totem-playlist # installed. # ======================================================================= # elsif i.include? 'configure: error: totem playlist parsing library not found or too old' problem_is :totem_playlist_was_not_found we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === Error adding symbols (collect2: error: ld returned 1 exit status) # ======================================================================= # elsif i.include? 'error adding symbols: bad value' error_is :bad_value_for_symbols # ======================================================================= # # === Handle Python invalid syntax situation # # This entry point specifically exists to handle python2-grammer # related errors - in particular a SyntaxError. When such an error # is encountered, compilation/installation is likely to fail, if # it depends on python for being compiled/installed. # ======================================================================= # elsif i.include? 'SyntaxError: invalid syntax' error_is :python_syntax_error_invalid_syntax # ======================================================================= # # === Handle Python import-errors # ======================================================================= # elsif i.include? 'ImportError: ' # ===================================================================== # # For example: # ImportError: ./.libs/_giscanner.so: undefined symbol: PyString_AsString # ===================================================================== # if i.include? '.so: undefined symbol' problem_is :python_import_error_undefined_symbol we_can_not_continue # ===================================================================== # # === Handle missing python-modules next # # An example would be: # # ImportError: No module named libxml2 # # ===================================================================== # elsif i.include? 'ImportError: No module named' this_module_is_missing = i.scan(/ImportError: No module named (.+)/).flatten problem_is :python_import_error_missing_module, this_module_is_missing we_can_not_continue end # ======================================================================= # # === I/O error : Attempt to load network entity # ======================================================================= # elsif i.include? 'I/O error : Attempt to load network entity ' problem_is :docbook_failed_to_load_a_network_entity we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === Jam is missing # ======================================================================= # elsif i.include? 'configure: error: Jam is missing!' problem_is :jam_is_missing we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === libtool error: cannot install to a directory # ======================================================================= # elsif i.include?('libtool: error: error: cannot install') and i.include?('to a directory not ending in') problem_is :libtool_can_not_install_to_another_prefix we_can_not_continue_and_we_will_not_run_make_install # ======================================================================= # # === Encountered an invalid libtool archive # # An example for such an invalid line would be: # /usr/bin/sed: can't read /usr/lib/libfontconfig.la: No such file or directory # ======================================================================= # elsif ( (i.include?('libtool: ')) and (i.include?('error: ')) ) or (i.include?('.la: No such file or directory')) # ===================================================================== # # Next we will catch all libtool-related errors. # ===================================================================== # # ===================================================================== # # === .la: No such file or directory # # For example, for: # # /usr/bin/sed: can't read /usr/lib/libfontconfig.la: No such file or directory # # ===================================================================== # if i.include?('.la: No such file or directory') error_is :libtool_could_not_find_an_existing_la_file do_not_run_make_install # =================================================================== # # We will also extract the faulty libtool file next: # =================================================================== # use_this_regex = /: (.+\.la): No such file or directory/ if (i =~ use_this_regex) i = $1.to_s.dup end # ===================================================================== # # === is not a valid libtool archive # # A typical error for this if-clause may be: # libtool: error: '/usr/lib/libfontconfig.la' is not a valid libtool archive # ===================================================================== # elsif i.include?('is not a valid libtool archive') problem_is :encountered_an_invalid_libtool_archive do_not_run_make_install if (i =~ /error: '(.+\.la)' is not a valid libtool archive/) i = $1.to_s.dup end # ===================================================================== # # === cannot find the library # # Specifically the error may be like so: # # libtool: error: cannot find the library '/Programs/Pango/1.42.3/lib/libpango-1.0.la' or unhandled argument '/Programs/Pango/1.42.3/lib/libpango-1.0.la' # # ===================================================================== # elsif i.include?('cannot find the library') use_this_regex = /libtool:\s*error: cannot find the library '(\S+)' or unhandled/ # See: http://rubular.com/r/NKm5erjg1A error_is :libtool_could_not_find_the_library do_not_run_make_install if (i =~ use_this_regex) i = $1.to_s.dup # ← We have to store it here, so it can be fixed automatically lateron. end end register_this_erroneous_libtool_entry(i) # ======================================================================= # # === Some unspecified cmake error occurred during configure # ======================================================================= # elsif i.include? '-- Configuring incomplete, errors occurred!' problem_is :incomplete_configure_error_via_cmake we_can_not_continue_and_we_will_not_run_make_install end end
problem_is( i, optional_problem_is = nil )
click to toggle source
#¶ ↑
RBT::Errors::MapLineToASpecificError.problem_is?
¶ ↑
#¶ ↑
# File lib/rbt/errors/map_line_to_a_specific_error.rb, line 129 def self.problem_is( i, optional_problem_is = nil ) i = [i].flatten.compact i << optional_problem_is if optional_problem_is @problem_is << i @all_programs_and_errors_will_be_registered_here << i end
problem_is?()
click to toggle source
register_required_dependency( name_of_the_program = nil, program_version = nil )
click to toggle source
register_this_behaviour_change(i)
click to toggle source
register_this_erroneous_libtool_entry(i)
click to toggle source
register_this_error(i)
click to toggle source
register_this_missing_package(i)
click to toggle source
#¶ ↑
RBT::Errors::MapLineToASpecificError.register_this_missing_package
¶ ↑
We will register missing packages through this method. If the input includes a String such as “No package”, then we will only capture the name of the package itself.
Valid input to this method may include this:
The required package libxfce4util-1.0 was not found on your system.
#¶ ↑
# File lib/rbt/errors/map_line_to_a_specific_error.rb, line 551 def self.register_this_missing_package(i) if i.include? " No package '" i = i.scan(/ No package '(.+)' found/).flatten.first elsif i.include? 'The required package ' i = i.scan(/The required package (.+) was not found on your system/).flatten.first # ===================================================================== # # Next, do some ad-hoc sanitizing if a string such as "-1.0" is # included. This may be the case for e. g. "libxfce4util-1.0". # ===================================================================== # if i and i.include?('-') and (i =~ /\d{1}/) i = ProgramInformation.return_short_name(i) end end @missing_package << i end
registered_errors?()
click to toggle source
required_dependency?()
click to toggle source
reset()
click to toggle source
#¶ ↑
RBT::Errors::MapLineToASpecificError.reset
(reset tag)¶ ↑
#¶ ↑
# File lib/rbt/errors/map_line_to_a_specific_error.rb, line 33 def self.reset @registered_errors = [] @behaviour_changes = [] @problem_is = [] @erroneous_libtool_entry = [] @required_dependency = [] @missing_package = [] # ← Store missing packages here. end
we_can_not_continue()
click to toggle source
we_can_not_continue_and_we_will_not_run_make_install()
click to toggle source