class Archlinux::LocalRepo
Attributes
config[RW]
dir[RW]
Public Class Methods
new(dir="/var/lib/pacman/local", config: Archlinux.config)
click to toggle source
# File lib/aur/repos.rb, line 157 def initialize(dir="/var/lib/pacman/local", config: Archlinux.config) @dir=Pathname.new(dir) @config=config end
Public Instance Methods
infos()
click to toggle source
# File lib/aur/repos.rb, line 162 def infos #todo: this is essentially the same code as for db repo; factorize this? list=[] @dir.glob("*/desc").each do |desc| pkg={repo: :local}; mode=nil desc.read.each_line do |l| l.chomp! next if l.empty? if (m=l.match(/^%([A-Z0-9]*)%$/)) mode=m[1].downcase.to_sym else l=l.to_i if mode==:csize or mode==:isize l=Time.at(l.to_i) if mode==:builddate Archlinux.add_to_hash(pkg, mode, l) end end list << pkg end list end
packages(refresh=false)
click to toggle source
# File lib/aur/repos.rb, line 183 def packages(refresh=false) @packages=nil if refresh @packages ||= @config.to_packages(infos) end