apkbuild-gem-resolver: aport update descriptors

This commit is contained in:
Kaarle Ritvanen 2015-07-09 09:17:38 +03:00
parent 1e3d4338a5
commit d1deffc952
1 changed files with 19 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/ruby
# APKBUILD dependency resolver for RubyGems
# Copyright (C) 2014 Kaarle Ritvanen
# Copyright (C) 2014-2015 Kaarle Ritvanen
require 'augeas'
require 'optparse'
@ -201,12 +201,8 @@ class Update
def each
@gems.each_value do |gem|
obs = gem.obsolete_deps
obs = obs.length == 0 ? nil : " (obsolete dependencies: #{obs.join ', '})"
if gem.updated? || obs
yield "#{gem.aport.name}-#{gem.version}#{obs}"
end
update = gem.update
yield update if update
end
end
@ -233,7 +229,7 @@ class Update
@aport = aport
end
attr_reader :aport, :obsolete_deps
attr_reader :aport
def require_version version
if @version
@ -278,6 +274,16 @@ class Update
}
end
end
def update
updated? || @obsolete_deps.length > 0 ? (
{
:name => @aport.name,
:version => version,
:obsolete_deps => @obsolete_deps.clone
}
) : nil
end
end
end
@ -306,6 +312,9 @@ end
update.resolve
for aport in update
puts aport
for pkg in update
obs = pkg[:obsolete_deps]
obs = obs.length == 0 ? nil : " (obsolete dependencies: #{obs.join ', '})"
puts "#{pkg[:name]}-#{pkg[:version]}#{obs}"
end