lib/specinfra/command/arch/base/package.rb in specinfra-2.0.0.beta50 vs lib/specinfra/command/arch/base/package.rb in specinfra-2.0.0.beta51
- old
+ new
@@ -1,11 +1,12 @@
class Specinfra::Command::Arch::Base::Package < Specinfra::Command::Linux::Base::Package
class << self
def check_is_installed(package,version=nil)
if version
- "pacman -Q | grep #{escape(package)} #{escape(version)}"
+ grep = version.include?('-') ? "^#{escape(version)}$" : "^#{escape(version)}-"
+ "pacman -Q #{escape(package)} | awk '{print $2}' | grep '#{grep}'"
else
- "pacman -Q | grep #{escape(package)}"
+ "pacman -Q #{escape(package)}"
end
end
def get_version(package, opts=nil)
"pacman -Qi #{package} | grep Version | awk '{print $3}'"