Sha256: aaec67b70b34decf977a42b8cdd772208e53ec8b17cf370cbc20ad10a93542ea

Contents?: true

Size: 706 Bytes

Versions: 5

Compression:

Stored size: 706 Bytes

Contents

require 'dply/helper'

module Dply
  class Rpm
    include Helper

    def libs_packages_map(libs)
      h = {}
      libs.each do |lib|
        list = whatprovides(lib)
        h[lib] = list if not list.empty?
      end
      return h
    end

    private

    def filtered?(pkg)
      @filtered ||= ["glibc", "libgcc", "libstdc++", "openssl", "ruby-alt", "jemalloc"]
      @filtered.include? pkg.strip
    end

    def whatprovides(lib)
      lib = "#{lib}()(64bit)"
      command = %(rpm --queryformat "%{NAME} " -q --whatprovides "#{lib}")
      output = cmd command, return_output: true, shell: true, display: false
      list = output.strip.split.select {|pkg| not filtered? pkg }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dply-0.2.9 lib/dply/rpm.rb
dply-0.2.8 lib/dply/rpm.rb
dply-0.2.7 lib/dply/rpm.rb
dply-0.2.6 lib/dply/rpm.rb
dply-0.2.5 lib/dply/rpm.rb