Sha256: 6155c3705f5f4041af97be359ecba35ec0ea9997b2b0287a7ad770e918954b76

Contents?: true

Size: 755 Bytes

Versions: 13

Compression:

Stored size: 755 Bytes

Contents

require 'dply/helper'

module Dply
  class Rpm
    include Helper

    def libs_to_packages(libs)
      packages = Set.new
      libs.each do |l|
        list = whatprovides(l)
        packages << list if not list.empty?
      end
      return packages
    end

    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}")
      logger.debug command
      output = `#{command}`
      error "running command #{command}" if not $?.exitstatus == 0
      list = output.strip.split.select {|pkg| not filtered? pkg }
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dply-0.2.3 lib/dply/rpm.rb
dply-0.2.2 lib/dply/rpm.rb
dply-0.2.0 lib/dply/rpm.rb
dply-0.1.19 lib/dply/rpm.rb
dply-0.1.18 lib/dply/rpm.rb
dply-0.1.17 lib/dply/rpm.rb
dply-0.1.13 lib/dply/rpm.rb
dply-0.1.12 lib/dply/rpm.rb
dply-0.1.11 lib/dply/rpm.rb
dply-0.1.10 lib/dply/rpm.rb
dply-0.1.9 lib/dply/rpm.rb
dply-0.1.8 lib/dply/rpm.rb
dply-0.1.7 lib/dply/rpm.rb