Class: PKGWizard::RPM

Inherits:
Object
  • Object
show all
Defined in:
lib/pkg-wizard/rpm.rb

Instance Method Summary collapse

Constructor Details

#initialize(pkg) ⇒ RPM

Returns a new instance of RPM.

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/pkg-wizard/rpm.rb', line 11

def initialize(pkg)
  @pkg = pkg.strip.chomp
  raise ArgumentError.new("Invalid package.") if pkg !~ /.*\.rpm$/
  raise ArgumentError.new("Invalid package.") if not File.exist?(pkg)
end

Instance Method Details

#source_package_nameObject



17
18
19
20
21
22
23
# File 'lib/pkg-wizard/rpm.rb', line 17

def source_package_name
  info = `rpm -qi -qp #{@pkg} 2>/dev/null`.lines
  info.find do |s|
    s =~ /Source RPM\s*:(.*)$/
  end
  $1.strip.chomp
end