class RBT::SimplifiedLddOutput

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::SimplifiedLddOutput[]

#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 124
def self.[](i = ARGV)
  new(i)
end
new( i = ARGV, run_already = true ) click to toggle source
#

initialize

The input to this method should be a String such as “/Programs/Python/3.6.2/”.

#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 30
def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  run if run_already
end

Public Instance Methods

hash?()
Alias for: main_dataset?
main_dataset?() click to toggle source
#

main_dataset?

#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 54
def main_dataset?
  @internal_hash[:main_dataset]
end
Also aliased as: hash?
parse_the_result_into_a_hash(result) click to toggle source
#

parse_the_result_into_a_hash

The String this method has to parse may look like this:

"/usr/lib/v4l2convert.so:\n" +
"\tlinux-vdso.so.1 (0x00007ff525647000)\n" +
"\tlibv4l2.so.0 => /usr/lib/libv4l2.so.0 (0x00007ff5255c0000)\n" +
#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 78
def parse_the_result_into_a_hash(result)
  _ = main_dataset? # Easer "pointer".
  @current_pointer = nil
  splitted = result.split(N)
  splitted.each {|entry|
    entry = entry.dup if entry.frozen?
    entry.rstrip! # Always rstrip it.
    if entry.include?(' (')
      entry = entry.split(' (').first.rstrip
    end
    if entry.start_with?("\t")
      modified_entry = entry.lstrip
      if modified_entry.include? '=>'
        modified_entry = modified_entry.split('=>').last.strip
      end
      if modified_entry.include?('not found') and is_on_roebe?
        e tomato('Warning: not found entry for ')+
          steelblue(
            entry.dup.delete(':')
          )+' ('+modified_entry+')'
        e 'This one will NOT be added.'
      else
        _[@current_pointer] << rds(modified_entry)
      end
    else
      @current_pointer = entry.dup.delete(':')
      _[@current_pointer] = []
    end
  }
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 42
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === :main_dataset
  # ======================================================================= #
  @internal_hash[:main_dataset] = {}
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 112
def run
  opne "#{rev}Checking all libraries at "+
       sdir('/usr/lib/')+
       "#{rev} next."
  result = `ldd /usr/lib/*.so* #{ERROR_LINE}`
  parse_the_result_into_a_hash(result)
  store_the_main_hash_into_a_yaml_file
end
store_the_main_hash_into_a_yaml_file() click to toggle source
#

store_the_main_hash_into_a_yaml_file

#
# File lib/rbt/utility_scripts/simplified_ldd_output.rb, line 61
def store_the_main_hash_into_a_yaml_file
  what = YAML.dump(hash?)
  into = rbt_log_dir+'sanitized_ldd_dataset.yml'
  opne "#{rev}Now storing into the file `#{sfile(into)}#{rev}`."
  write_what_into(what, into)
end