diff options
author | 2009-10-01 16:41:22 +0100 | |
---|---|---|
committer | 2009-10-01 16:57:19 +0100 | |
commit | b7dc3fb576d7683a4925de95d01148ac781c5388 (patch) | |
tree | 1e31b989e06ae3dbb881bfc91e18a64638a0219d /ruby | |
parent | b855bceaa8a5a42bd38144974acce180cd72eb01 (diff) | |
download | paludis-b7dc3fb576d7683a4925de95d01148ac781c5388.tar.gz paludis-b7dc3fb576d7683a4925de95d01148ac781c5388.tar.xz |
Make find_unmanaged_files.rb work without InstalledAction
Diffstat (limited to 'ruby')
-rwxr-xr-x | ruby/demos/find_unmanaged_files.rb | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb index 0aa887526..e66a870b9 100755 --- a/ruby/demos/find_unmanaged_files.rb +++ b/ruby/demos/find_unmanaged_files.rb @@ -8,22 +8,17 @@ include Paludis Log.instance.log_level = LogLevel::Warning Log.instance.program_name = $0 -def get_contents(repo, files, root) +def get_contents(pids, files, root) in_contents= [] - repo.category_names do |cat| - repo.package_names(cat) do |pkg| - repo.package_ids(pkg) do |pid| - next unless pid.supports_action(SupportsActionTest.new(InstalledAction)) - next if pid.contents_key.nil? - contents = pid.contents_key.value - contents.each do |entry| - next if entry.kind_of? ContentsOtherEntry - files.each do |file| - if (root + entry.location_key.value)[0,file.length] == file - in_contents << root + entry.location_key.value - break; - end - end + pids.each do |pid| + next if pid.contents_key.nil? + contents = pid.contents_key.value + contents.each do |entry| + next if entry.kind_of? ContentsOtherEntry + files.each do |file| + if (root + entry.location_key.value)[0,file.length] == file + in_contents << root + entry.location_key.value + break; end end end @@ -102,9 +97,6 @@ end in_fs = [] Find.find(*(files.collect {|f| f.empty? ? "/" : f})) {|file| in_fs << file} -db.repositories do |repo| - next unless repo.some_ids_might_support_action(SupportsActionTest.new(InstalledAction)) - in_fs-= get_contents(repo, files, root) -end +in_fs-= get_contents(env[Selection::AllVersionsUnsorted.new(Generator::All.new | Filter::InstalledAtRoot.new(root))], files, root) puts in_fs |