class Archlinux::AurMakepkgCache

combine Aur and Makepkg caches

Attributes

aur_cache[RW]
makepkg_cache[RW]

Public Class Methods

new(*args, **opts) click to toggle source
Calls superclass method Archlinux::InstallPackageList::new
# File lib/aur/install_packages.rb, line 102
def initialize(*args, **opts)
        super
        @aur_cache = AurCache.new(**opts)
        @makepkg_cache = MakepkgCache.new(get_mode: {update: true, clone: true, pkgver: true, view: true}, **opts)
        @ext_query=method(:ext_query)
        #@query_ignore=AurPackageList.official
end

Public Instance Methods

ext_query(*queries, **opts) click to toggle source
# File lib/aur/install_packages.rb, line 110
def ext_query(*queries, **opts)
        devel=queries.select do |query|
                Query.strip(query)=~/(-git|-hg|-svn)$/
        end
        if @install_list_of
                # we only want to check the pkgver of packages we already have; for
                # the others the aur version is enough
                devel=devel & @install_list_of.names
        end
        aur=queries-devel
        r1, l1=@makepkg_cache.as_ext_query(*devel, **opts)
        missing=devel-r1.keys
        r2, l2=@aur_cache.as_ext_query(*(missing+aur), **opts)
        return r1.merge(r2), l1.merge(l2)
end
get_makepkg_list(l) click to toggle source
# File lib/aur/install_packages.rb, line 126
def get_makepkg_list(l)
        got=l.select {|pkg| @makepkg_cache.key?(pkg)}
        got_m=@makepkg_cache.get_makepkg_list(got)
        rest=@aur_cache.get_makepkg_list(l-got)
        MakepkgList.new(l.map do |name|
                strip=Query.strip(name)
                got_m.key?(strip) ? got_m[strip] : rest[strip]
        end, config: @config)
end