diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-07-09 10:15:06 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-07-09 19:40:38 +0300 |
commit | 3764ff5a51a832d35a880ef56359df82b48f1f78 (patch) | |
tree | d15bf601608563f386e47876e079926e801f1206 /apkbuild-gem-resolver.in | |
parent | 3b8bfec13dbcd1955af6024d1b218b3b680d60ce (diff) | |
download | abuild-3764ff5a51a832d35a880ef56359df82b48f1f78.tar.gz abuild-3764ff5a51a832d35a880ef56359df82b48f1f78.tar.bz2 abuild-3764ff5a51a832d35a880ef56359df82b48f1f78.tar.xz abuild-3764ff5a51a832d35a880ef56359df82b48f1f78.zip |
apkbuild-gem-resolver: Subpackage class
Diffstat (limited to 'apkbuild-gem-resolver.in')
-rw-r--r-- | apkbuild-gem-resolver.in | 113 |
1 files changed, 58 insertions, 55 deletions
diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in index 7ba5780..9e4457c 100644 --- a/apkbuild-gem-resolver.in +++ b/apkbuild-gem-resolver.in @@ -10,45 +10,7 @@ require 'rubygems/resolver' require 'rubygems/spec_fetcher' class Package - RUBY_SUBPACKAGES = { - '2.0.0_p353' => { - 'ruby-minitest' => ['minitest', '4.3.2'], - 'ruby-rake' => ['rake', '0.9.6'], - 'ruby-rdoc' => ['rdoc', '4.0.0', 'ruby-json'] - }, - '2.0.0_p481' => { - 'ruby-minitest' => ['minitest', '4.3.2'], - 'ruby-rake' => ['rake', '0.9.6'], - 'ruby-rdoc' => ['rdoc', '4.0.0', 'ruby-json'] - }, - '2.1.5' => { - 'ruby-json' => ['json', '1.8.1'], - 'ruby-minitest' => ['minitest', '4.7.5'], - 'ruby-rake' => ['rake', '10.1.0'], - 'ruby-rdoc' => ['rdoc', '4.1.0', 'ruby-json'] - }, - '2.2.1' => { - 'ruby-json' => ['json', '1.8.1'], - 'ruby-minitest' => ['minitest', '5.4.3'], - 'ruby-rake' => ['rake', '10.4.2'], - 'ruby-rdoc' => ['rdoc', '4.2.0', 'ruby-json'], - 'ruby-io-console' => [ 'io-console', '0.4.2'] # its actually 0.4.3 but - # that version is not - # published on network - }, - '2.2.2' => { - 'ruby-json' => ['json', '1.8.1'], - 'ruby-minitest' => ['minitest', '5.4.3'], - 'ruby-rake' => ['rake', '10.4.2'], - 'ruby-rdoc' => ['rdoc', '4.2.0', 'ruby-json'], - 'ruby-io-console' => [ 'io-console', '0.4.2'] # its actually 0.4.3 but - # that version is not - # published on network - } - } - @@packages = {} - @@subpackages = [] def self.initialize testing Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) do |aug| @@ -67,16 +29,7 @@ class Package end end - for name, attrs in RUBY_SUBPACKAGES[ - aug.get("#{apath}/main/ruby/APKBUILD/pkgver") - ] - gem, version, *deps = attrs - pkg = new name, gem, version - for dep in deps - pkg.add_dependency dep - end - @@subpackages << pkg - end + Subpackage.initialize aug.get("#{apath}/main/ruby/APKBUILD/pkgver") end @@packages.each_value do |pkg| @@ -92,12 +45,6 @@ class Package pkg end - def self.ruby_subpkgs - for pkg in @@subpackages - yield pkg - end - end - def initialize name, gem, version @name = name @gem = gem @@ -152,6 +99,62 @@ class Aport < Package end end +class Subpackage < Package + RUBY_SUBPACKAGES = { + '2.0.0_p353' => { + 'ruby-minitest' => ['minitest', '4.3.2'], + 'ruby-rake' => ['rake', '0.9.6'], + 'ruby-rdoc' => ['rdoc', '4.0.0', 'ruby-json'] + }, + '2.0.0_p481' => { + 'ruby-minitest' => ['minitest', '4.3.2'], + 'ruby-rake' => ['rake', '0.9.6'], + 'ruby-rdoc' => ['rdoc', '4.0.0', 'ruby-json'] + }, + '2.1.5' => { + 'ruby-json' => ['json', '1.8.1'], + 'ruby-minitest' => ['minitest', '4.7.5'], + 'ruby-rake' => ['rake', '10.1.0'], + 'ruby-rdoc' => ['rdoc', '4.1.0', 'ruby-json'] + }, + '2.2.1' => { + # it's actually 0.4.3 but that version is not published on network + 'ruby-io-console' => ['io-console', '0.4.2'], + 'ruby-json' => ['json', '1.8.1'], + 'ruby-minitest' => ['minitest', '5.4.3'], + 'ruby-rake' => ['rake', '10.4.2'], + 'ruby-rdoc' => ['rdoc', '4.2.0', 'ruby-json'] + }, + '2.2.2' => { + # it's actually 0.4.3 but that version is not published on network + 'ruby-io-console' => ['io-console', '0.4.2'], + 'ruby-json' => ['json', '1.8.1'], + 'ruby-minitest' => ['minitest', '5.4.3'], + 'ruby-rake' => ['rake', '10.4.2'], + 'ruby-rdoc' => ['rdoc', '4.2.0', 'ruby-json'] + } + } + + @@subpackages = [] + + 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 + end + end + + def self.each + for pkg in @@subpackages + yield pkg + end + end +end + class Update def initialize @@ -165,7 +168,7 @@ class Update end def resolve - Package.ruby_subpkgs do |pkg| + for pkg in Subpackage require_version pkg.name, pkg.version unless @gems[pkg.gem] end |