Sha256: 571640bbc8cf14e0fa0082f093a3e1238d5d30714541f862cc93e7a1cc1de14f

Contents?: true

Size: 1.75 KB

Versions: 21

Compression:

Stored size: 1.75 KB

Contents

# Copyright (c) 2013-2015 SUSE LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact SUSE LLC.
#
# To contact SUSE about this file by physical or electronic mail,
# you may find current contact information at www.suse.com

class PackagesInspector < Inspector
  has_priority 20
  def initialize(system, description)
    @system = system
    @description = description
  end

  def inspect(_filter, _options = {})
    @system.check_requirement("rpm", "--version")

    packages = Array.new
    rpm_data = @system.run_command(
      "rpm","-qa","--qf",
      "%{NAME}|%{VERSION}|%{RELEASE}|%{ARCH}|%{VENDOR}|%{SIGMD5}$",
      :stdout=>:capture
    )
    # gpg-pubkeys are no real packages but listed by rpm in the regular
    # package list
    rpm_data.scan(/(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\$/).reject do |name, *attrs|
      name =~ /^gpg-pubkey$/
    end.each do |name, version, release, arch, vendor, checksum|
      packages << Package.new(
        :name     => name,
        :version  => version,
        :release  => release,
        :arch     => arch,
        :vendor   => vendor,
        :checksum => checksum
      )
    end

    @description.packages = PackagesScope.new(packages.sort_by(&:name))
  end

  def summary
    "Found #{@description.packages.size} packages."
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
machinery-tool-1.16.4 plugins/packages/packages_inspector.rb
machinery-tool-1.16.3 plugins/packages/packages_inspector.rb
machinery-tool-1.16.2 plugins/packages/packages_inspector.rb
machinery-tool-1.16.1 plugins/packages/packages_inspector.rb
machinery-tool-1.16.0 plugins/packages/packages_inspector.rb
machinery-tool-1.15.0 plugins/packages/packages_inspector.rb
machinery-tool-1.14.2 plugins/packages/packages_inspector.rb
machinery-tool-1.14.1 plugins/packages/packages_inspector.rb
machinery-tool-1.14.0 plugins/packages/packages_inspector.rb
machinery-tool-1.13.0 plugins/packages/packages_inspector.rb
machinery-tool-1.12.0 plugins/packages/packages_inspector.rb
machinery-tool-1.11.2 plugins/packages/packages_inspector.rb
machinery-tool-1.11.1 plugins/packages/packages_inspector.rb
machinery-tool-1.11.0 plugins/packages/packages_inspector.rb
machinery-tool-1.10.0 plugins/packages/packages_inspector.rb
machinery-tool-1.9.1 plugins/packages/packages_inspector.rb
machinery-tool-1.9.0 plugins/packages/packages_inspector.rb
machinery-tool-1.8.2 plugins/packages/packages_inspector.rb
machinery-tool-1.8.1 plugins/packages/packages_inspector.rb
machinery-tool-1.8.0 plugins/packages/packages_inspector.rb