summaryrefslogtreecommitdiff
path: root/apkbuild-gem-resolver.in
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-07-09 09:49:10 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-07-09 19:40:38 +0300
commit3b8bfec13dbcd1955af6024d1b218b3b680d60ce (patch)
tree3d5f11be6f7259b82fb740beb213e37f0ca68fd5 /apkbuild-gem-resolver.in
parentd1deffc952b087c350b9b6c910cc8115e129ca56 (diff)
downloadabuild-3b8bfec13dbcd1955af6024d1b218b3b680d60ce.tar.gz
abuild-3b8bfec13dbcd1955af6024d1b218b3b680d60ce.tar.bz2
abuild-3b8bfec13dbcd1955af6024d1b218b3b680d60ce.tar.xz
abuild-3b8bfec13dbcd1955af6024d1b218b3b680d60ce.zip
apkbuild-gem-resolver: correct terminology used in indentifiers
Diffstat (limited to 'apkbuild-gem-resolver.in')
-rw-r--r--apkbuild-gem-resolver.in74
1 files changed, 37 insertions, 37 deletions
diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in
index f19b18f..7ba5780 100644
--- a/apkbuild-gem-resolver.in
+++ b/apkbuild-gem-resolver.in
@@ -9,7 +9,7 @@ require 'rubygems/dependency'
require 'rubygems/resolver'
require 'rubygems/spec_fetcher'
-class Aport
+class Package
RUBY_SUBPACKAGES = {
'2.0.0_p353' => {
'ruby-minitest' => ['minitest', '4.3.2'],
@@ -47,7 +47,7 @@ class Aport
}
}
- @@aports = {}
+ @@packages = {}
@@subpackages = []
def self.initialize testing
@@ -62,8 +62,8 @@ class Aport
repos = ['main']
repos << 'testing' if testing
for repo in repos
- for aport in aug.match "#{apath}/#{repo}/*"
- FileAport.new(aug, aport) unless aport.end_with? '/ruby'
+ for pkg in aug.match "#{apath}/#{repo}/*"
+ Aport.new(aug, pkg) unless pkg.end_with? '/ruby'
end
end
@@ -71,25 +71,25 @@ class Aport
aug.get("#{apath}/main/ruby/APKBUILD/pkgver")
]
gem, version, *deps = attrs
- aport = new name, gem, version
+ pkg = new name, gem, version
for dep in deps
- aport.add_dependency dep
+ pkg.add_dependency dep
end
- @@subpackages << aport
+ @@subpackages << pkg
end
end
- @@aports.each_value do |aport|
- aport.depends do |dep|
- dep.add_user aport
+ @@packages.each_value do |pkg|
+ pkg.depends do |dep|
+ dep.add_user pkg
end
end
end
def self.get name
- aport = @@aports[name]
- raise 'Invalid package name: ' + name unless aport
- aport
+ pkg = @@packages[name]
+ raise 'Invalid package name: ' + name unless pkg
+ pkg
end
def self.ruby_subpkgs
@@ -104,7 +104,7 @@ class Aport
@version = version
@depends = []
@users = []
- @@aports[name] = self
+ @@packages[name] = self
end
def add_dependency name
@@ -115,10 +115,10 @@ class Aport
def depends
for dep in @depends
- unless @@aports.has_key? dep
+ unless @@packages.has_key? dep
raise "Dependency for #{@name} does not exist: #{dep}"
end
- yield @@aports[dep]
+ yield @@packages[dep]
end
end
@@ -133,7 +133,7 @@ class Aport
end
end
-class FileAport < Aport
+class Aport < Package
def initialize aug, path
name = path.split('/')[-1]
@@ -160,12 +160,12 @@ class Update
end
def require_version name, version
- gem = assign(Aport.get(name).gem, name)
+ gem = assign(Package.get(name).gem, name)
@deps << gem.dependency if gem.require_version version
end
def resolve
- Aport.ruby_subpkgs do |pkg|
+ Package.ruby_subpkgs do |pkg|
require_version pkg.name, pkg.version unless @gems[pkg.gem]
end
@@ -187,9 +187,9 @@ class Update
for name, gem in @gems
if gem.updated?
- gem.aport.users do |user|
+ gem.package.users do |user|
ugem = @gems[user.gem]
- if !ugem || ugem.aport.name != user.name
+ if !ugem || ugem.package.name != user.name
Gem::Resolver.new(
[gem.dependency, Gem::Dependency.new(user.gem, user.version)]
).resolve
@@ -206,30 +206,30 @@ class Update
end
end
- def assign name, aport
- aport = Aport.get aport
+ def assign name, package
+ pkg = Package.get package
if @gems.has_key? name
gem = @gems[name]
- return gem if aport == gem.aport
- raise "Conflicting packages for gem #{name}: #{gem.aport.name} and #{aport.name}"
+ return gem if pkg == gem.package
+ raise "Conflicting packages for gem #{name}: #{gem.package.name} and #{pkg.name}"
end
- gem = AportGem.new self, name, aport
+ gem = PackagedGem.new self, name, pkg
@gems[name] = gem
gem
end
private
- class AportGem
- def initialize update, name, aport
+ class PackagedGem
+ def initialize update, name, package
@update = update
@name = name
- @aport = aport
+ @package = package
end
- attr_reader :aport
+ attr_reader :package
def require_version version
if @version
@@ -241,11 +241,11 @@ class Update
end
def version
- @version || @aport.version
+ @version || @package.version
end
def updated?
- version != @aport.version
+ version != @package.version
end
def dependency
@@ -260,7 +260,7 @@ class Update
@obsolete_deps = []
- @aport.depends do |dep|
+ @package.depends do |dep|
gem = @update.assign(dep.gem, dep.name)
gem.check_deps
unless deps.reject! { |sdep| sdep.match? dep.gem, gem.version }
@@ -269,7 +269,7 @@ class Update
end
if deps.length > 0
- raise 'Undeclared dependencies in ' + @aport.name + deps.inject('') {
+ raise 'Undeclared dependencies in ' + @package.name + deps.inject('') {
|s, dep| "#{s}\n#{dep.name} #{dep.requirements_list.join ' '}"
}
end
@@ -278,7 +278,7 @@ class Update
def update
updated? || @obsolete_deps.length > 0 ? (
{
- :name => @aport.name,
+ :name => @package.name,
:version => version,
:obsolete_deps => @obsolete_deps.clone
}
@@ -294,7 +294,7 @@ OptionParser.new do |opts|
testing = t
end
end.parse! ARGV
-Aport.initialize testing
+Package.initialize testing
latest = {}
for source, gems in Gem::SpecFetcher::fetcher.available_specs(:latest)[0]
@@ -307,7 +307,7 @@ update = Update.new
for arg in ARGV
match = /^(([^-]|-[^\d])+)(-(\d.*))?/.match arg
name = match[1]
- update.require_version name, match[4] || latest[Aport.get(name).gem]
+ update.require_version name, match[4] || latest[Package.get(name).gem]
end
update.resolve