Module: RBT::Errors::MapLineToASpecificError
- Defined in:
- lib/rbt/errors/map_line_to_a_specific_error.rb
Overview
RBT::Errors::MapLineToASpecificError
Class Method Summary collapse
-
.all_programs_and_errors? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.all_programs_and_errors? ========================================================================= #.
-
.behaviour_changes? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.behaviour_changes? ========================================================================= #.
-
.do_not_run_ldconfig ⇒ Object
# === RBT::Errors::MapLineToASpecificError.do_not_run_ldconfig ========================================================================= #.
-
.do_not_run_make ⇒ Object
# === RBT::Errors::MapLineToASpecificError.do_not_run_make ========================================================================= #.
-
.do_not_run_make_install ⇒ Object
# === RBT::Errors::MapLineToASpecificError.do_not_run_make_install ========================================================================= #.
-
.do_not_run_ninja ⇒ Object
# === RBT::Errors::MapLineToASpecificError.do_not_run_ninja ========================================================================= #.
-
.do_not_strip_binaries ⇒ Object
# === RBT::Errors::MapLineToASpecificError.do_not_strip_binaries ========================================================================= #.
-
.e(i = '') ⇒ Object
# === RBT::Errors::MapLineToASpecificError.e ========================================================================= #.
-
.erroneous_libtool_entry? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.erroneous_libtool_entry? ========================================================================= #.
-
.missing_package? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.missing_package? ========================================================================= #.
-
.no_postinstall_step ⇒ Object
# === RBT::Errors::MapLineToASpecificError.no_postinstall_step ========================================================================= #.
-
.parse_this_line(i) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.parse_this_line ========================================================================= #.
-
.problem_is(i, optional_problem_is = nil) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.problem_is? ========================================================================= #.
-
.problem_is? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.problem_is? ========================================================================= #.
-
.register_required_dependency(name_of_the_program = nil, program_version = nil) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.register_required_dependency ========================================================================= #.
-
.register_this_behaviour_change(i) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.register_this_behaviour_change.
-
.register_this_erroneous_libtool_entry(i) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.register_this_erroneous_libtool_entry ========================================================================= #.
-
.register_this_error(i) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.register_this_error.
-
.register_this_missing_package(i) ⇒ Object
# === RBT::Errors::MapLineToASpecificError.register_this_missing_package.
-
.registered_errors? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.registered_errors?.
-
.required_dependency? ⇒ Boolean
# === RBT::Errors::MapLineToASpecificError.required_dependency? ========================================================================= #.
-
.reset ⇒ Object
# === RBT::Errors::MapLineToASpecificError.reset (reset tag) ========================================================================= #.
-
.we_can_not_continue ⇒ Object
# === RBT::Errors::MapLineToASpecificError.we_can_not_continue ========================================================================= #.
-
.we_can_not_continue_and_we_will_not_run_make_install ⇒ Object
# === RBT::Errors::MapLineToASpecificError.we_can_not_continue_and_we_will_not_run_make_install ========================================================================= #.
Class Method Details
.all_programs_and_errors? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.all_programs_and_errors?
#
67 68 69 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 67 def self.all_programs_and_errors? @all_programs_and_errors_will_be_registered_here end |
.behaviour_changes? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.behaviour_changes?
#
96 97 98 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 96 def self.behaviour_changes? @behaviour_changes end |
.do_not_run_ldconfig ⇒ Object
#
RBT::Errors::MapLineToASpecificError.do_not_run_ldconfig
#
152 153 154 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 152 def self.do_not_run_ldconfig register_this_behaviour_change __method__ end |
.do_not_run_make ⇒ Object
#
RBT::Errors::MapLineToASpecificError.do_not_run_make
#
194 195 196 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 194 def self.do_not_run_make register_this_behaviour_change __method__ end |
.do_not_run_make_install ⇒ Object
#
RBT::Errors::MapLineToASpecificError.do_not_run_make_install
#
187 188 189 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 187 def self.do_not_run_make_install register_this_behaviour_change __method__ end |
.do_not_run_ninja ⇒ Object
#
RBT::Errors::MapLineToASpecificError.do_not_run_ninja
#
166 167 168 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 166 def self.do_not_run_ninja register_this_behaviour_change __method__ end |
.do_not_strip_binaries ⇒ Object
#
RBT::Errors::MapLineToASpecificError.do_not_strip_binaries
#
201 202 203 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 201 def self.do_not_strip_binaries register_this_behaviour_change __method__ end |
.e(i = '') ⇒ Object
#
RBT::Errors::MapLineToASpecificError.e
#
208 209 210 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 208 def self.e(i = '') puts i end |
.erroneous_libtool_entry? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.erroneous_libtool_entry?
#
112 113 114 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 112 def self.erroneous_libtool_entry? @erroneous_libtool_entry end |
.missing_package? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.missing_package?
#
74 75 76 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 74 def self.missing_package? @missing_package end |
.no_postinstall_step ⇒ Object
#
RBT::Errors::MapLineToASpecificError.no_postinstall_step
#
159 160 161 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 159 def self.no_postinstall_step register_this_behaviour_change __method__ end |
.parse_this_line(i) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.parse_this_line
#
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# 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) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.problem_is?
#
129 130 131 132 133 134 135 136 137 |
# 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? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.problem_is?
#
82 83 84 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 82 def self.problem_is? @problem_is end |
.register_required_dependency(name_of_the_program = nil, program_version = nil) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.register_required_dependency
#
50 51 52 53 54 55 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 50 def self.register_required_dependency( name_of_the_program = nil, program_version = nil ) @required_dependency << [name_of_the_program, program_version] end |
.register_this_behaviour_change(i) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.register_this_behaviour_change
This method can be used to register which “behaviour changes” are possible.
#
145 146 147 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 145 def self.register_this_behaviour_change(i) @behaviour_changes << i end |
.register_this_erroneous_libtool_entry(i) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.register_this_erroneous_libtool_entry
#
89 90 91 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 89 def self.register_this_erroneous_libtool_entry(i) @erroneous_libtool_entry << i end |
.register_this_error(i) ⇒ Object
#
RBT::Errors::MapLineToASpecificError.register_this_error
Use this method to register any error.
#
121 122 123 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 121 def self.register_this_error(i) @registered_errors << i end |
.register_this_missing_package(i) ⇒ Object
#
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.
#
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
# 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? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.registered_errors?
Feedback all errors here.
#
105 106 107 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 105 def self.registered_errors? @registered_errors end |
.required_dependency? ⇒ Boolean
#
RBT::Errors::MapLineToASpecificError.required_dependency?
#
60 61 62 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 60 def self.required_dependency? @required_dependency end |
.reset ⇒ Object
#
RBT::Errors::MapLineToASpecificError.reset (reset tag)
#
33 34 35 36 37 38 39 40 |
# 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 ⇒ Object
#
RBT::Errors::MapLineToASpecificError.we_can_not_continue
#
180 181 182 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 180 def self.we_can_not_continue register_this_behaviour_change __method__ end |
.we_can_not_continue_and_we_will_not_run_make_install ⇒ Object
#
RBT::Errors::MapLineToASpecificError.we_can_not_continue_and_we_will_not_run_make_install
#
173 174 175 |
# File 'lib/rbt/errors/map_line_to_a_specific_error.rb', line 173 def self.we_can_not_continue_and_we_will_not_run_make_install register_this_behaviour_change __method__ end |