summaryrefslogtreecommitdiff
path: root/apkbuild-gem-resolver.in
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-07-09 10:56:11 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-07-09 19:40:38 +0300
commit4567343ea079c0c53830fd9f7875c3f29b3c0ace (patch)
treed52d146be45982805eccdbb9340912327f53fc79 /apkbuild-gem-resolver.in
parent0689344ce64533db1b26bb5f9a8e5dc23a8c8f27 (diff)
downloadabuild-4567343ea079c0c53830fd9f7875c3f29b3c0ace.tar.gz
abuild-4567343ea079c0c53830fd9f7875c3f29b3c0ace.tar.bz2
abuild-4567343ea079c0c53830fd9f7875c3f29b3c0ace.tar.xz
abuild-4567343ea079c0c53830fd9f7875c3f29b3c0ace.zip
apkbuild-gem-resolver: get aport version and gem directly from augeas
Diffstat (limited to 'apkbuild-gem-resolver.in')
-rw-r--r--apkbuild-gem-resolver.in53
1 files changed, 33 insertions, 20 deletions
diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in
index 7262e14..e4ef424 100644
--- a/apkbuild-gem-resolver.in
+++ b/apkbuild-gem-resolver.in
@@ -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