[DRE-commits] r3339 - in tools/ruby-support/trunk: . bin debian

ryan52-guest at alioth.debian.org ryan52-guest at alioth.debian.org
Thu Mar 26 06:44:37 UTC 2009


Author: ryan52-guest
Date: 2009-03-26 06:44:37 +0000 (Thu, 26 Mar 2009)
New Revision: 3339

Added:
   tools/ruby-support/trunk/bin/
   tools/ruby-support/trunk/bin/ruby-support
Removed:
   tools/ruby-support/trunk/ruby-support
Modified:
   tools/ruby-support/trunk/debian/ruby-support.install
Log:
mv

Copied: tools/ruby-support/trunk/bin/ruby-support (from rev 3337, tools/ruby-support/trunk/ruby-support)
===================================================================
--- tools/ruby-support/trunk/bin/ruby-support	                        (rev 0)
+++ tools/ruby-support/trunk/bin/ruby-support	2009-03-26 06:44:37 UTC (rev 3339)
@@ -0,0 +1,302 @@
+#!/usr/bin/env ruby
+#
+# ruby-support - symlink-farm to manage Ruby libraries on Debian
+#
+# Ruby-support is copyrighted free software by Lucas nussbaum <lucas at debian.org>.
+# You can redistribute it and/or modify it under the same terms as Ruby, that is:
+# - either under the terms of the GPL (see the file GPL)
+# - or under the conditions found in the file COPYING.
+
+require 'optparse'
+require 'pp'
+
+$verbose = (ENV['RS_VERBOSE'] != nil)
+
+RS_VERSION = 'RUBY_SUPPORT_VERSION'
+
+# "Real" ruby versions
+RS_RUBY_VERSIONS = [ 'ruby1.8',
+                  'ruby1.9.0', 'ruby1.9.1',
+                  'jruby1.0', 'jruby1.1' ]
+
+# Classes of ruby versions. To be used in .rbversions files.
+RS_RUBY_VERSION_CLASSES = {
+ 'ruby1.9' => [ 'ruby1.9.0', 'ruby1.9.1'],
+ 'jruby' => ['jruby1.0', 'jruby1.1' ]
+}
+
+# Path where to install libs
+RS_RUBY_LIBDIR = {
+  'ruby1.8' => '/usr/lib/ruby/vendor_ruby/1.8',
+  'ruby1.9.0' => '/usr/lib/ruby/vendor_ruby/1.9.0',
+  'ruby1.9.1' => '/usr/lib/ruby/vendor_ruby/1.9.1',
+  'jruby1.0' => '/usr/lib/jruby1.0/lib/ruby/site_ruby/1.8',
+  'jruby1.1' => '/usr/lib/jruby1.1/lib/ruby/site_ruby/1.8'
+}
+
+# Path where the real files live
+RS_PATH = '/usr/lib/ruby-support'
+
+### Supported versions management
+def supported_versions_from_string(vlist, rbversions_set = RS_RUBY_VERSIONS)
+  my_versions = RS_RUBY_VERSIONS
+  vlist.split(/\n/).each do |l|
+    l.chomp!
+    next if l == '' or l =~ /^# /
+    if l[0..0] == '-'
+      ver = l[1..-1]
+      if RS_RUBY_VERSION_CLASSES.include?(ver)
+        my_versions -= RS_RUBY_VERSION_CLASSES[ver]
+      elsif RS_RUBY_VERSIONS.include?(ver)
+        my_versions -= [ ver ]
+      else
+        puts "INFO: unknown ruby version in .rbversions: #{ver}"
+      end
+    else
+      ver = l
+      if RS_RUBY_VERSION_CLASSES.include?(ver)
+        my_versions += RS_RUBY_VERSION_CLASSES[ver]
+      elsif RS_RUBY_VERSIONS.include?(ver)
+        my_versions += [ ver ]
+      else
+        puts "INFO: unknown ruby version in .rbversions: #{ver}"
+      end
+    end
+  end
+  return my_versions.uniq
+end
+
+def supported_versions(lib, rbversions_set = RS_RUBY_VERSIONS)
+  rbversions = "#{RS_PATH}/#{lib}.rbversions"
+  if File::exists?(rbversions)
+    return supported_versions_from_string(IO::read(rbversions), rbversions_set)
+  else
+    return rbversions_set 
+  end
+end
+
+def test_supported_versions
+  print  "Without rbversions file... "
+  res = supported_versions('nonexistentlib')
+  if res == RS_RUBY_VERSIONS
+    puts "OK"
+  else
+    puts "Expected: #{RS_RUBY_VERSIONS.inspect}"
+    puts "Got: #{res.inspect}"
+    return 1
+  end
+
+  print "rbversions without class... "
+  res = supported_versions_from_string("
+# no jruby support
+-jruby1.0
+-jruby1.1
+")
+  wres = RS_RUBY_VERSIONS - ['jruby1.0','jruby1.1']
+  if res == wres
+    puts "OK"
+  else
+    puts "Expected: #{wres.inspect}"
+    puts "Got: #{res.inspect}"
+    return 1
+  end 
+
+  print "rbversions with class... "
+  res = supported_versions_from_string("
+# no jruby support
+-jruby
+")
+  wres = RS_RUBY_VERSIONS - ['jruby1.0','jruby1.1']
+  if res == wres
+    puts "OK"
+  else
+    puts "Expected: #{wres.inspect}"
+    puts "Got: #{res.inspect}"
+    return 1
+  end 
+end
+
+# Generate list of:
+#   [ :name, :source ]
+def needed_links(lib, rbver)
+  raise "Unknown Ruby version: #{rbver}" if not RS_RUBY_VERSIONS.include?(rbver)
+  raise "Unsupported Ruby version for #{lib}: #{rbver}" if not supported_versions(lib).include?(rbver)
+  if not File::directory?(RS_RUBY_LIBDIR[rbver])
+    # target dir doesn't exist: that version of ruby isn't installed
+    return []
+  end
+  # find directory to use
+  dir = nil
+  if File::directory?("#{RS_PATH}/#{lib}.#{rbver}")
+    dir = "#{RS_PATH}/#{lib}.#{rbver}"
+  else
+    RS_RUBY_VERSION_CLASSES.each_pair do |k,v|
+      if v.include?(rbver) and File::directory?("#{RS_PATH}/#{lib}.#{k}")
+        dir = "#{RS_PATH}/#{lib}.#{k}"
+        break
+      end
+    end
+    if dir.nil?
+      if not File::directory?("#{RS_PATH}/#{lib}")
+        raise "Library source dir #{RS_PATH}/#{lib} doesn't exist!"
+      else
+        dir = "#{RS_PATH}/#{lib}"
+      end
+    end
+  end
+  puts "INFO: source directory: #{dir}" if $verbose
+  links = (Dir::entries(dir) - ['.', '..']).map do |e|
+    ["#{RS_RUBY_LIBDIR[rbver]}/#{e}", "#{dir}/#{e}"]
+  end
+  return links
+end
+
+# Apply list of links
+def apply_links(list)
+  list.each do |e|
+    if File::exists?(e[0])
+      if File::symlink?(e[0])
+        if File::readlink(e[0]) == e[1]
+          puts "INFO: #{e[0]} already exists and already points to #{e[1]}." if $verbose
+        else
+          puts "WARNING: #{e[0]} exists, is a symlink, but points to #{File::readlink(e[0])}. Overwriting."
+          File::delete(e[0])
+          File::symlink(e[1], e[0])
+        end
+      else
+        raise "ERROR: #{e[0]} already exists! (need to create symlink to #{e[1]})."
+      end
+    else
+      File::symlink(e[1], e[0])
+    end
+  end
+end
+
+# Remove links in list
+def remove_links(list)
+  list.each do |e|
+    if File::exists?(e[0])
+      if File::symlink?(e[0])
+        if File::readlink(e[0]) == e[1]
+          File::delete(e[0])
+        else
+          puts "WARNING: #{e[0]} exists, is a symlink, but points to #{File::readlink(e[0])}. Skipping."
+        end
+      else
+        puts "WARNING: #{e[0]} exists, but is not a symlink. Skipping."
+      end
+    else
+      puts "WARNING: #{e[0]} doesn't exist (needed to remove it."
+    end
+  end
+end
+
+# get list of libs
+def get_all_libs
+  return (Dir::entries(RS_PATH) - ['.', '..']).select { |e| File::directory?("#{RS_PATH}/#{e}") }
+end
+
+def sanity_check
+  links = []
+  get_all_libs.each do |l|
+    supported_versions(l).each do |v|
+      links += needed_links(l, v)
+    end
+  end
+  links.each do |l|
+    if not (File::exists?(l[0]) and File::symlink?(l[0]) and File::readlink(l[0]) == l[1])
+      puts "Missing or incorrect symlink: #{l[0]} -> #{l[1]}"
+    end
+  end
+  okfiles = links.map { |e| e[0] }
+  RS_RUBY_LIBDIR.each_pair do |rubyver, dir|
+    if File::directory?(dir)
+      (Dir::entries(dir) - ['.', '..']).each do |e|
+        f= "#{dir}/#{e}"
+        next if okfiles.include?(f)
+        if File::symlink?(f)
+          puts "WARNING: [#{rubyver}] Additional symlink (obsolete?): #{f} -> #{File::readlink(f)}"
+        else
+          puts "INFO: [#{rubyver}] Not managed by ruby-support: #{f}"
+        end
+      end
+    end
+  end
+end
+
+# run tests
+def run_tests
+  test_supported_versions
+  return 0
+end
+
+progname = File::basename($PROGRAM_NAME)
+opts = OptionParser::new do |opts|
+  opts.program_name = progname
+  opts.banner = "Usage: #{progname} [commands]"
+  opts.separator ""
+  opts.separator "Options:"
+
+  opts.on("", "--version", "Show version") do
+    puts "ruby-support #{RS_VERSION}"
+    puts ""
+    puts "Known ruby versions:"
+    p  RS_RUBY_VERSIONS
+    puts "Known ruby version classes:"
+    pp RS_RUBY_VERSION_CLASSES
+    exit(0)
+  end
+
+  opts.on("-i", "--install-lib LIB", "Install symlinks for library LIB") do |l|
+    supported_versions(l).each do |rbver|
+      apply_links(needed_links(l, rbver))
+    end
+    exit(0)
+  end
+    
+  opts.on("-r", "--remove-lib LIB", "Remove symlinks for library LIB") do |l|
+    supported_versions(l).each do |rbver|
+      remove_links(needed_links(l, rbver))
+    end
+    exit(0)
+  end
+
+  opts.on("-I", "--install-interpreter INTERPRETER", "Install symlinks for new version of interpreter") do |interp|
+    get_all_libs.each do |lib|
+      if supported_versions(lib).include?(interp)
+        apply_links(needed_links(lib, interp))
+      end
+    end
+    exit(0)
+  end
+
+  opts.on("-R", "--remove-interpreter INTERPRETER", "Remove symlinks for new version of interpreter") do |interp|
+    get_all_libs.each do |lib|
+      if supported_versions(lib).include?(interp)
+        remove_links(needed_links(lib, rbver))
+      end
+    end
+    exit(0)
+  end
+
+  opts.on("", "--rebuild", "Re-install symlinks for all interpreters and all libraries") do
+    get_all_libs.each do |lib|
+      supported_versions(lib).each do |rbver|
+        apply_links(needed_links(lib, rbver))
+      end
+    end
+    exit(0)
+  end
+
+  opts.on("", "--check", "Check everything, but do not change anything") do
+    sanity_check
+    exit(0)
+  end
+end
+begin
+  opts.parse!(ARGV)
+rescue OptionParser::ParseError => pe
+  opts.warn pe
+  puts opts
+  exit 1
+end

Modified: tools/ruby-support/trunk/debian/ruby-support.install
===================================================================
--- tools/ruby-support/trunk/debian/ruby-support.install	2009-03-26 06:42:38 UTC (rev 3338)
+++ tools/ruby-support/trunk/debian/ruby-support.install	2009-03-26 06:44:37 UTC (rev 3339)
@@ -1 +1,2 @@
-ruby-support /usr/bin/
+autoscripts/ /usr/share/debhelper/
+bin/ /usr/

Deleted: tools/ruby-support/trunk/ruby-support
===================================================================
--- tools/ruby-support/trunk/ruby-support	2009-03-26 06:42:38 UTC (rev 3338)
+++ tools/ruby-support/trunk/ruby-support	2009-03-26 06:44:37 UTC (rev 3339)
@@ -1,302 +0,0 @@
-#!/usr/bin/env ruby
-#
-# ruby-support - symlink-farm to manage Ruby libraries on Debian
-#
-# Ruby-support is copyrighted free software by Lucas nussbaum <lucas at debian.org>.
-# You can redistribute it and/or modify it under the same terms as Ruby, that is:
-# - either under the terms of the GPL (see the file GPL)
-# - or under the conditions found in the file COPYING.
-
-require 'optparse'
-require 'pp'
-
-$verbose = (ENV['RS_VERBOSE'] != nil)
-
-RS_VERSION = 'RUBY_SUPPORT_VERSION'
-
-# "Real" ruby versions
-RS_RUBY_VERSIONS = [ 'ruby1.8',
-                  'ruby1.9.0', 'ruby1.9.1',
-                  'jruby1.0', 'jruby1.1' ]
-
-# Classes of ruby versions. To be used in .rbversions files.
-RS_RUBY_VERSION_CLASSES = {
- 'ruby1.9' => [ 'ruby1.9.0', 'ruby1.9.1'],
- 'jruby' => ['jruby1.0', 'jruby1.1' ]
-}
-
-# Path where to install libs
-RS_RUBY_LIBDIR = {
-  'ruby1.8' => '/usr/lib/ruby/vendor_ruby/1.8',
-  'ruby1.9.0' => '/usr/lib/ruby/vendor_ruby/1.9.0',
-  'ruby1.9.1' => '/usr/lib/ruby/vendor_ruby/1.9.1',
-  'jruby1.0' => '/usr/lib/jruby1.0/lib/ruby/site_ruby/1.8',
-  'jruby1.1' => '/usr/lib/jruby1.1/lib/ruby/site_ruby/1.8'
-}
-
-# Path where the real files live
-RS_PATH = '/usr/lib/ruby-support'
-
-### Supported versions management
-def supported_versions_from_string(vlist, rbversions_set = RS_RUBY_VERSIONS)
-  my_versions = RS_RUBY_VERSIONS
-  vlist.split(/\n/).each do |l|
-    l.chomp!
-    next if l == '' or l =~ /^# /
-    if l[0..0] == '-'
-      ver = l[1..-1]
-      if RS_RUBY_VERSION_CLASSES.include?(ver)
-        my_versions -= RS_RUBY_VERSION_CLASSES[ver]
-      elsif RS_RUBY_VERSIONS.include?(ver)
-        my_versions -= [ ver ]
-      else
-        puts "INFO: unknown ruby version in .rbversions: #{ver}"
-      end
-    else
-      ver = l
-      if RS_RUBY_VERSION_CLASSES.include?(ver)
-        my_versions += RS_RUBY_VERSION_CLASSES[ver]
-      elsif RS_RUBY_VERSIONS.include?(ver)
-        my_versions += [ ver ]
-      else
-        puts "INFO: unknown ruby version in .rbversions: #{ver}"
-      end
-    end
-  end
-  return my_versions.uniq
-end
-
-def supported_versions(lib, rbversions_set = RS_RUBY_VERSIONS)
-  rbversions = "#{RS_PATH}/#{lib}.rbversions"
-  if File::exists?(rbversions)
-    return supported_versions_from_string(IO::read(rbversions), rbversions_set)
-  else
-    return rbversions_set 
-  end
-end
-
-def test_supported_versions
-  print  "Without rbversions file... "
-  res = supported_versions('nonexistentlib')
-  if res == RS_RUBY_VERSIONS
-    puts "OK"
-  else
-    puts "Expected: #{RS_RUBY_VERSIONS.inspect}"
-    puts "Got: #{res.inspect}"
-    return 1
-  end
-
-  print "rbversions without class... "
-  res = supported_versions_from_string("
-# no jruby support
--jruby1.0
--jruby1.1
-")
-  wres = RS_RUBY_VERSIONS - ['jruby1.0','jruby1.1']
-  if res == wres
-    puts "OK"
-  else
-    puts "Expected: #{wres.inspect}"
-    puts "Got: #{res.inspect}"
-    return 1
-  end 
-
-  print "rbversions with class... "
-  res = supported_versions_from_string("
-# no jruby support
--jruby
-")
-  wres = RS_RUBY_VERSIONS - ['jruby1.0','jruby1.1']
-  if res == wres
-    puts "OK"
-  else
-    puts "Expected: #{wres.inspect}"
-    puts "Got: #{res.inspect}"
-    return 1
-  end 
-end
-
-# Generate list of:
-#   [ :name, :source ]
-def needed_links(lib, rbver)
-  raise "Unknown Ruby version: #{rbver}" if not RS_RUBY_VERSIONS.include?(rbver)
-  raise "Unsupported Ruby version for #{lib}: #{rbver}" if not supported_versions(lib).include?(rbver)
-  if not File::directory?(RS_RUBY_LIBDIR[rbver])
-    # target dir doesn't exist: that version of ruby isn't installed
-    return []
-  end
-  # find directory to use
-  dir = nil
-  if File::directory?("#{RS_PATH}/#{lib}.#{rbver}")
-    dir = "#{RS_PATH}/#{lib}.#{rbver}"
-  else
-    RS_RUBY_VERSION_CLASSES.each_pair do |k,v|
-      if v.include?(rbver) and File::directory?("#{RS_PATH}/#{lib}.#{k}")
-        dir = "#{RS_PATH}/#{lib}.#{k}"
-        break
-      end
-    end
-    if dir.nil?
-      if not File::directory?("#{RS_PATH}/#{lib}")
-        raise "Library source dir #{RS_PATH}/#{lib} doesn't exist!"
-      else
-        dir = "#{RS_PATH}/#{lib}"
-      end
-    end
-  end
-  puts "INFO: source directory: #{dir}" if $verbose
-  links = (Dir::entries(dir) - ['.', '..']).map do |e|
-    ["#{RS_RUBY_LIBDIR[rbver]}/#{e}", "#{dir}/#{e}"]
-  end
-  return links
-end
-
-# Apply list of links
-def apply_links(list)
-  list.each do |e|
-    if File::exists?(e[0])
-      if File::symlink?(e[0])
-        if File::readlink(e[0]) == e[1]
-          puts "INFO: #{e[0]} already exists and already points to #{e[1]}." if $verbose
-        else
-          puts "WARNING: #{e[0]} exists, is a symlink, but points to #{File::readlink(e[0])}. Overwriting."
-          File::delete(e[0])
-          File::symlink(e[1], e[0])
-        end
-      else
-        raise "ERROR: #{e[0]} already exists! (need to create symlink to #{e[1]})."
-      end
-    else
-      File::symlink(e[1], e[0])
-    end
-  end
-end
-
-# Remove links in list
-def remove_links(list)
-  list.each do |e|
-    if File::exists?(e[0])
-      if File::symlink?(e[0])
-        if File::readlink(e[0]) == e[1]
-          File::delete(e[0])
-        else
-          puts "WARNING: #{e[0]} exists, is a symlink, but points to #{File::readlink(e[0])}. Skipping."
-        end
-      else
-        puts "WARNING: #{e[0]} exists, but is not a symlink. Skipping."
-      end
-    else
-      puts "WARNING: #{e[0]} doesn't exist (needed to remove it."
-    end
-  end
-end
-
-# get list of libs
-def get_all_libs
-  return (Dir::entries(RS_PATH) - ['.', '..']).select { |e| File::directory?("#{RS_PATH}/#{e}") }
-end
-
-def sanity_check
-  links = []
-  get_all_libs.each do |l|
-    supported_versions(l).each do |v|
-      links += needed_links(l, v)
-    end
-  end
-  links.each do |l|
-    if not (File::exists?(l[0]) and File::symlink?(l[0]) and File::readlink(l[0]) == l[1])
-      puts "Missing or incorrect symlink: #{l[0]} -> #{l[1]}"
-    end
-  end
-  okfiles = links.map { |e| e[0] }
-  RS_RUBY_LIBDIR.each_pair do |rubyver, dir|
-    if File::directory?(dir)
-      (Dir::entries(dir) - ['.', '..']).each do |e|
-        f= "#{dir}/#{e}"
-        next if okfiles.include?(f)
-        if File::symlink?(f)
-          puts "WARNING: [#{rubyver}] Additional symlink (obsolete?): #{f} -> #{File::readlink(f)}"
-        else
-          puts "INFO: [#{rubyver}] Not managed by ruby-support: #{f}"
-        end
-      end
-    end
-  end
-end
-
-# run tests
-def run_tests
-  test_supported_versions
-  return 0
-end
-
-progname = File::basename($PROGRAM_NAME)
-opts = OptionParser::new do |opts|
-  opts.program_name = progname
-  opts.banner = "Usage: #{progname} [commands]"
-  opts.separator ""
-  opts.separator "Options:"
-
-  opts.on("", "--version", "Show version") do
-    puts "ruby-support #{RS_VERSION}"
-    puts ""
-    puts "Known ruby versions:"
-    p  RS_RUBY_VERSIONS
-    puts "Known ruby version classes:"
-    pp RS_RUBY_VERSION_CLASSES
-    exit(0)
-  end
-
-  opts.on("-i", "--install-lib LIB", "Install symlinks for library LIB") do |l|
-    supported_versions(l).each do |rbver|
-      apply_links(needed_links(l, rbver))
-    end
-    exit(0)
-  end
-    
-  opts.on("-r", "--remove-lib LIB", "Remove symlinks for library LIB") do |l|
-    supported_versions(l).each do |rbver|
-      remove_links(needed_links(l, rbver))
-    end
-    exit(0)
-  end
-
-  opts.on("-I", "--install-interpreter INTERPRETER", "Install symlinks for new version of interpreter") do |interp|
-    get_all_libs.each do |lib|
-      if supported_versions(lib).include?(interp)
-        apply_links(needed_links(lib, interp))
-      end
-    end
-    exit(0)
-  end
-
-  opts.on("-R", "--remove-interpreter INTERPRETER", "Remove symlinks for new version of interpreter") do |interp|
-    get_all_libs.each do |lib|
-      if supported_versions(lib).include?(interp)
-        remove_links(needed_links(lib, rbver))
-      end
-    end
-    exit(0)
-  end
-
-  opts.on("", "--rebuild", "Re-install symlinks for all interpreters and all libraries") do
-    get_all_libs.each do |lib|
-      supported_versions(lib).each do |rbver|
-        apply_links(needed_links(lib, rbver))
-      end
-    end
-    exit(0)
-  end
-
-  opts.on("", "--check", "Check everything, but do not change anything") do
-    sanity_check
-    exit(0)
-  end
-end
-begin
-  opts.parse!(ARGV)
-rescue OptionParser::ParseError => pe
-  opts.warn pe
-  puts opts
-  exit 1
-end




More information about the Pkg-ruby-extras-commits mailing list