mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-09 08:10:23 +00:00
apkbuild-gem-resolver: Subpackage class
This commit is contained in:
parent
3b8bfec13d
commit
3764ff5a51
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user