apkbuild-gem-resolver: augeas object as class member
This commit is contained in:
parent
3764ff5a51
commit
0689344ce6
@ -13,24 +13,25 @@ class Package
|
||||
@@packages = {}
|
||||
|
||||
def self.initialize testing
|
||||
Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) do |aug|
|
||||
@@augeas = Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD)
|
||||
dir = Dir.pwd
|
||||
aug.transform(:lens => 'Shellvars.lns', :incl => dir + '/*/ruby*/APKBUILD')
|
||||
aug.load
|
||||
@@augeas.transform(
|
||||
:lens => 'Shellvars.lns', :incl => dir + '/*/ruby*/APKBUILD'
|
||||
)
|
||||
@@augeas.load
|
||||
|
||||
apath = '/files' + dir
|
||||
fail if aug.match("/augeas#{apath}//error").length > 0
|
||||
fail if @@augeas.match("/augeas#{apath}//error").length > 0
|
||||
|
||||
repos = ['main']
|
||||
repos << 'testing' if testing
|
||||
for repo in repos
|
||||
for pkg in aug.match "#{apath}/#{repo}/*"
|
||||
Aport.new(aug, pkg) unless pkg.end_with? '/ruby'
|
||||
for pkg in @@augeas.match "#{apath}/#{repo}/*"
|
||||
Aport.new(pkg) unless pkg.end_with? '/ruby'
|
||||
end
|
||||
end
|
||||
|
||||
Subpackage.initialize aug.get("#{apath}/main/ruby/APKBUILD/pkgver")
|
||||
end
|
||||
Subpackage.initialize @@augeas.get("#{apath}/main/ruby/APKBUILD/pkgver")
|
||||
|
||||
@@packages.each_value do |pkg|
|
||||
pkg.depends do |dep|
|
||||
@ -81,11 +82,11 @@ class Package
|
||||
end
|
||||
|
||||
class Aport < Package
|
||||
def initialize aug, path
|
||||
def initialize path
|
||||
name = path.split('/')[-1]
|
||||
|
||||
get = proc{ |param|
|
||||
res = aug.get(path + '/APKBUILD/' + param)
|
||||
res = @@augeas.get(path + '/APKBUILD/' + param)
|
||||
raise param + ' not defined for ' + name unless res
|
||||
res
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user