Class: Specinfra::Command::Poky::Base::Package

Inherits:
Linux::Base::Package show all
Defined in:
lib/specinfra/command/poky/base/package.rb

Class Method Summary collapse

Methods inherited from Base::Package

check_is_installed_by_cpan, check_is_installed_by_gem, check_is_installed_by_npm, check_is_installed_by_pear, check_is_installed_by_pecl, check_is_installed_by_pip, check_is_installed_by_rvm, check_is_installed_by_td_agent_gem

Methods inherited from Base

create, escape

Class Method Details

.check_is_installed(package, version = nil) ⇒ Object Also known as: check_is_installed_by_opkg



3
4
5
6
7
8
# File 'lib/specinfra/command/poky/base/package.rb', line 3

def check_is_installed(package, version=nil)
  package_escaped = escape(package)
  cmd = "opkg status #{package_escaped} | grep -E '^Version|(user|ok) installed$'"
  cmd = "#{cmd} | grep -E #{escape(version)}" if version
  cmd
end

.get_version(package, opts = nil) ⇒ Object



17
18
19
# File 'lib/specinfra/command/poky/base/package.rb', line 17

def get_version(package, opts=nil)
  "opkg list-installed #{package} | cut -d ' ' -f 3"
end

.install(package, version = nil, option = '') ⇒ Object



12
13
14
15
# File 'lib/specinfra/command/poky/base/package.rb', line 12

def install(package, version=nil, option='')
  # opkg doesn't support to install specific version.
  "opkg install #{option} #{package}"
end

.remove(package, option = '') ⇒ Object



21
22
23
# File 'lib/specinfra/command/poky/base/package.rb', line 21

def remove(package, option='')
  "opkg remove #{option} #{package}"
end