Class: Dply::Deplist

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/dply/deplist.rb

Constant Summary collapse

BASE_PACKAGES =
Set["glibc", "libgcc", "libstdc++", "openssl", "ruby-alt", "jemalloc"]

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #sh, #symlink

Constructor Details

#initialize(tar_path) ⇒ Deplist

Returns a new instance of Deplist.



16
17
18
# File 'lib/dply/deplist.rb', line 16

def initialize(tar_path)
  @tar_path = Pathname.new(tar_path).realpath
end

Instance Method Details

#verify!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dply/deplist.rb', line 20

def verify!
  error "#{@tar_path} not readable" if not File.readable? @tar_path
  tmp_dir do
    logger.info "(in #{Dir.pwd})"
    cmd "tar xf #{@tar_path}"
    pkgs_list = Pkgs.new(Constants::PKGS_YML).runtime

    @libs_files_map = libs_files_map
    libs = @libs_files_map.keys

    if logger.debug?
      require 'pp'
      pp @libs_files_map
    end

    deps = {}
    libs.each do |lib|
      what_provides = Rpm.what_provides(lib)
      if what_provides.empty?
        logger.error "no pkgs provide '#{lib}': required by files: #{@libs_files_map[lib]})"
        @error = true
        next
      end
      deps[lib] = what_provides
    end

    verify_deps(deps, pkgs_list)
    error "packages dependencies not satisfied" if @error
    puts "all dependencies satisfied".green
  end
end