aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2009-10-01 16:41:22 +0100
committerAvatar Richard Brown <rbrown@exherbo.org> 2009-10-01 16:57:19 +0100
commitb7dc3fb576d7683a4925de95d01148ac781c5388 (patch)
tree1e31b989e06ae3dbb881bfc91e18a64638a0219d
parentb855bceaa8a5a42bd38144974acce180cd72eb01 (diff)
downloadpaludis-b7dc3fb576d7683a4925de95d01148ac781c5388.tar.gz
paludis-b7dc3fb576d7683a4925de95d01148ac781c5388.tar.xz
Make find_unmanaged_files.rb work without InstalledAction
-rwxr-xr-xruby/demos/find_unmanaged_files.rb30
1 files changed, 11 insertions, 19 deletions
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index 0aa8875..e66a870 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