class Archlinux::InstallPackageList

class that support installation (ie define install_method)

Public Class Methods

new(*args, **opts) click to toggle source
Calls superclass method
# File lib/aur/install_packages.rb, line 7
def initialize(*args, **opts)
        super
        @install_method=method(:install_method)
end

Public Instance Methods

get_makepkg_list(l) click to toggle source
# File lib/aur/install_packages.rb, line 12
def get_makepkg_list(l)
        MakepkgList.new(l.map {|p| Query.strip(p)}, config: @config)
end
install_method(l, **opts, &b) click to toggle source
# File lib/aur/install_packages.rb, line 16
def install_method(l, **opts, &b)
        # if we are used as a source, fall back to the upstream method
        if @install_list&.respond_to?(:install_method)
                @install_list.install_method(l, **opts, &b)
        else
                m=get_makepkg_list(l)
                info=opts.delete(:pkgs_info)
                if info
                        tops=info[:top_pkgs].keys
                        deps=info[:all_pkgs].keys-tops
                        #if we cache the makepkg, we need to update both deps and tops
                        #in case we did a previous install
                        # require 'pry'; binding.pry
                        deps.each { |dep| m[Query.strip(dep)]&.asdeps=true }
                        tops.each { |dep| m[Query.strip(dep)]&.asdeps=false }
                end
                m=b.call(m) if b #return false to prevent install
                m.install(**opts) if m
        end
end