aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2009-10-01 16:48:58 +0100
committerAvatar Richard Brown <rbrown@exherbo.org> 2009-10-01 16:57:19 +0100
commit70d3c637576ef388d35376f17030b37cf4b7767f (patch)
treec90bb7c484db68539ee9478659bba7d8132dec8c
parentb7dc3fb576d7683a4925de95d01148ac781c5388 (diff)
downloadpaludis-70d3c637576ef388d35376f17030b37cf4b7767f.tar.gz
paludis-70d3c637576ef388d35376f17030b37cf4b7767f.tar.xz
Unconfuse myself
-rwxr-xr-xruby/demos/find_unmanaged_files.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index e66a870..ee4c452 100755
--- a/ruby/demos/find_unmanaged_files.rb
+++ b/ruby/demos/find_unmanaged_files.rb
@@ -8,15 +8,15 @@ include Paludis
Log.instance.log_level = LogLevel::Warning
Log.instance.program_name = $0
-def get_contents(pids, files, root)
+def get_contents(pids, directories, root)
in_contents= []
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
+ directories.each do |directory|
+ if (root + entry.location_key.value)[0,directory.length] == directory
in_contents << root + entry.location_key.value
break;
end
@@ -75,7 +75,7 @@ env = Paludis::EnvironmentFactory.instance.create env_spec
db = env.package_database
root = env.root[-1] == ?/ ? env.root.chop : env.root
-files = []
+directories = []
if ARGV.empty?
puts "No directory to check"
@@ -90,13 +90,13 @@ else
puts "#{file} is not under ${ROOT} (#{root}/)"
exit 1
end
- files << (file[-1] == ?/ ? file.chop : file)
+ directories << (file[-1] == ?/ ? file.chop : file)
end
end
in_fs = []
-Find.find(*(files.collect {|f| f.empty? ? "/" : f})) {|file| in_fs << file}
+Find.find(*(directories.collect {|d| d.empty? ? "/" : d})) {|file| in_fs << file}
-in_fs-= get_contents(env[Selection::AllVersionsUnsorted.new(Generator::All.new | Filter::InstalledAtRoot.new(root))], files, root)
+in_fs-= get_contents(env[Selection::AllVersionsUnsorted.new(Generator::All.new | Filter::InstalledAtRoot.new(root))], directories, root)
puts in_fs