aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2012-10-19 18:38:30 -0700
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-10-20 18:08:29 +0100
commit4ebc2c4a82c19035dad2eb8fd4462a60a1a94c8a (patch)
tree94c6ef9001954cec4361da5633d38ead5d8bce2e
parent49241ddf5495e4336bba2501a34d97eebe4b9102 (diff)
downloadpaludis-4ebc2c4a82c19035dad2eb8fd4462a60a1a94c8a.tar.gz
paludis-4ebc2c4a82c19035dad2eb8fd4462a60a1a94c8a.tar.xz
ruby: remove find_unamanged_files
This demo is no longer useful given cave print-unmanaged-files Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
-rw-r--r--ruby/demos/Makefile.am1
-rwxr-xr-xruby/demos/find_unmanaged_files.rb101
2 files changed, 0 insertions, 102 deletions
diff --git a/ruby/demos/Makefile.am b/ruby/demos/Makefile.am
index d6f054c..8194277 100644
--- a/ruby/demos/Makefile.am
+++ b/ruby/demos/Makefile.am
@@ -15,7 +15,6 @@ DEFS= \
IF_RUBY_DEMOS = \
version_spec_distributions.rb \
- find_unmanaged_files.rb \
latest_stable.rb \
playman.rb
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
deleted file mode 100755
index 1e752db..0000000
--- a/ruby/demos/find_unmanaged_files.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env ruby
-# vim: set sw=4 sts=4 et tw=80 :
-#
-%w[Paludis find getoptlong].each {|x| require x}
-
-include Paludis
-
-Log.instance.log_level = LogLevel::Warning
-Log.instance.program_name = $0
-
-def get_contents(pids, directories, root)
- in_contents= []
- pids.each do |pid|
- contents = pid.contents
- next if contents.nil?
- contents.each do |entry|
- next if entry.kind_of? ContentsOtherEntry
- directories.each do |directory|
- if (root + entry.location_key.parse_value)[0,directory.length] == directory
- in_contents << root + entry.location_key.parse_value
- break;
- end
- end
- end
- end
- return in_contents
-end
-
-opts = GetoptLong.new(
- [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
- [ '--version', '-V', GetoptLong::NO_ARGUMENT ],
- [ '--log-level', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--environment', '-E', GetoptLong::REQUIRED_ARGUMENT ])
-
-env_spec = ""
-opts.each do | opt, arg |
- case opt
- when '--help'
- puts "Usage: " + $0 + " [options] directory1 [directory2 ...]"
- puts
- puts "Options:"
- puts " --help Display a help message"
- puts " --version Display program version"
- puts
- puts " --log-level level Set log level (debug, qa, warning, silent)"
- puts " --environment env Environment specification (class:suffix, both parts optional)"
- exit 0
-
- when '--version'
- puts $0.to_s.split(/\//).last + " " + Paludis::Version.to_s
- exit 0
-
- when '--log-level'
- case arg
- when 'debug'
- Paludis::Log.instance.log_level = Paludis::LogLevel::Debug
- when 'qa'
- Paludis::Log.instance.log_level = Paludis::LogLevel::Qa
- when 'warning'
- Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
- when 'silent'
- Paludis::Log.instance.log_level = Paludis::LogLevel::Silent
- else
- puts "Bad --log-level value " + arg
- exit 1
- end
-
- when '--environment'
- env_spec = arg
-
- end
-end
-
-env = Paludis::EnvironmentFactory.instance.create env_spec
-root = env.preferred_root_key.parse_value[-1] == ?/ ? env.preferred_root_key.parse_value.chop : env.preferred_root_key.parse_value
-
-directories = []
-
-if ARGV.empty?
- puts "No directory to check"
- exit 1
-else
- ARGV.each do |file|
- unless File.directory? file
- puts "#{file} is not a directory."
- exit 1
- end
- unless file == root or file[0,root.length + 1] == root + "/"
- puts "#{file} is not under ${ROOT} (#{root}/)"
- exit 1
- end
- directories << (file[-1] == ?/ ? file.chop : file)
- end
-end
-
-in_fs = []
-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))], directories, root)
-
-puts in_fs