Commit 4567343e authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

apkbuild-gem-resolver: get aport version and gem directly from augeas

parent 0689344c
......@@ -46,10 +46,8 @@ class Package
pkg
end
def initialize name, gem, version
def initialize name
@name = name
@gem = gem
@version = version
@depends = []
@users = []
@@packages[name] = self
......@@ -59,7 +57,7 @@ class Package
@depends << name
end
attr_reader :gem, :name, :version
attr_reader :name
def depends
for dep in @depends
......@@ -83,21 +81,30 @@ end
class Aport < Package
def initialize path
name = path.split('/')[-1]
super path.split('/')[-1]
@path = path + '/APKBUILD/'
get = proc{ |param|
res = @@augeas.get(path + '/APKBUILD/' + param)
raise param + ' not defined for ' + name unless res
res
}
super name, get.call('_gemname'), get.call('pkgver')
for dep in `echo #{get.call('depends')}`.split
for dep in `echo #{get_param 'depends'}`.split
# ruby-gems: workaround for v2.6
add_dependency dep if dep.start_with?('ruby-') && dep != 'ruby-gems'
end
end
def gem
get_param '_gemname'
end
def version
get_param 'pkgver'
end
private
def get_param name
value = @@augeas.get(@path + name)
raise name + ' not defined for ' + @name unless value
value
end
end
class Subpackage < Package
......@@ -140,12 +147,7 @@ class Subpackage < Package
def self.initialize version
for name, attrs in RUBY_SUBPACKAGES[version]
gem, version, *deps = attrs
pkg = new name, gem, version
for dep in deps
pkg.add_dependency dep
end
@@subpackages << pkg
new name, attrs
end
end
......@@ -154,6 +156,17 @@ class Subpackage < Package
yield pkg
end
end
def initialize name, attrs
super name
@gem, @version, *deps = attrs
for dep in deps
add_dependency dep
end
@@subpackages << self
end
attr_reader :gem, :version
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment