Class: Rpm2Cpio

Inherits:
CliFuncs show all
Defined in:
lib/cli_funcs_rpm2cpio.rb

Instance Attribute Summary collapse

Attributes inherited from CliFuncs

#base_dir, #data_dir, #ignore_bad_exit

Instance Method Summary collapse

Methods inherited from CliFuncs

#clear_values, #flag_add, #flags_run, #run_and_capture, #set_dirs

Constructor Details

#initializeRpm2Cpio

Returns a new instance of Rpm2Cpio.



8
9
10
11
12
13
14
15
# File 'lib/cli_funcs_rpm2cpio.rb', line 8

def initialize
  super
  @output = ""
  @utility = CliUtils.new("rpm2cpio").utility_path
  @packages_dir = SYSTEM_CONFIG["packages_dir"]
  @default_dist = SYSTEM_CONFIG["default_dist"]
  @rpm_file = ""
end

Instance Attribute Details

#flags_allObject

Returns the value of attribute flags_all.



5
6
7
# File 'lib/cli_funcs_rpm2cpio.rb', line 5

def flags_all
  @flags_all
end

#outputObject (readonly)

Returns the value of attribute output.



6
7
8
# File 'lib/cli_funcs_rpm2cpio.rb', line 6

def output
  @output
end

#rpm_fileObject

Returns the value of attribute rpm_file.



5
6
7
# File 'lib/cli_funcs_rpm2cpio.rb', line 5

def rpm_file
  @rpm_file
end

Instance Method Details

#rpm2cpioObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cli_funcs_rpm2cpio.rb', line 17

def rpm2cpio
  # This should turn capture3 into binary mode just by being set
  opts = Hash.new
  # Run our command and capture the binary output into @output
  begin
    @output, stderr_str, status = Open3.capture3(@utility, @rpm_file, opts)
    puts [@utility, @rpm_file, opts].flatten.inspect if DEBUG
  rescue Exception => e
    puts "Tried to run #{@utility} #{@rpm_file} #{opts.inspect} during Rpm2Cpio.rpm2cpio, received exception: #{e}"
  end
end