diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-07-09 10:46:47 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-07-09 19:40:38 +0300 |
commit | 0689344ce64533db1b26bb5f9a8e5dc23a8c8f27 (patch) | |
tree | b9b399bea60b966a59702707b67680209b6bea6a /apkbuild-gem-resolver.in | |
parent | 3764ff5a51a832d35a880ef56359df82b48f1f78 (diff) | |
download | abuild-0689344ce64533db1b26bb5f9a8e5dc23a8c8f27.tar.gz abuild-0689344ce64533db1b26bb5f9a8e5dc23a8c8f27.tar.bz2 abuild-0689344ce64533db1b26bb5f9a8e5dc23a8c8f27.tar.xz abuild-0689344ce64533db1b26bb5f9a8e5dc23a8c8f27.zip |
apkbuild-gem-resolver: augeas object as class member
Diffstat (limited to 'apkbuild-gem-resolver.in')
-rw-r--r-- | apkbuild-gem-resolver.in | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in index 9e4457c..7262e14 100644 --- a/apkbuild-gem-resolver.in +++ b/apkbuild-gem-resolver.in @@ -13,25 +13,26 @@ class Package @@packages = {} def self.initialize testing - Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) do |aug| - dir = Dir.pwd - aug.transform(:lens => 'Shellvars.lns', :incl => dir + '/*/ruby*/APKBUILD') - aug.load - - apath = '/files' + dir - fail if aug.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' - end + @@augeas = Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) + dir = Dir.pwd + @@augeas.transform( + :lens => 'Shellvars.lns', :incl => dir + '/*/ruby*/APKBUILD' + ) + @@augeas.load + + apath = '/files' + dir + fail if @@augeas.match("/augeas#{apath}//error").length > 0 + + repos = ['main'] + repos << 'testing' if testing + for repo in repos + for pkg in @@augeas.match "#{apath}/#{repo}/*" + Aport.new(pkg) unless pkg.end_with? '/ruby' 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| dep.add_user pkg @@ -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 } |