[DRE-commits] r3346 - tools/ruby-support/trunk/bin
michi-guest at alioth.debian.org
michi-guest at alioth.debian.org
Thu Mar 26 14:10:18 UTC 2009
Author: michi-guest
Date: 2009-03-26 14:10:18 +0000 (Thu, 26 Mar 2009)
New Revision: 3346
Modified:
tools/ruby-support/trunk/bin/dh_ruby
tools/ruby-support/trunk/bin/ruby-support
Log:
A basic ?\226?\128?\156ruby-support --move-libs TMPDIR?\226?\128?\157
Modified: tools/ruby-support/trunk/bin/dh_ruby
===================================================================
--- tools/ruby-support/trunk/bin/dh_ruby 2009-03-26 07:18:25 UTC (rev 3345)
+++ tools/ruby-support/trunk/bin/dh_ruby 2009-03-26 14:10:18 UTC (rev 3346)
@@ -8,6 +8,7 @@
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp=tmpdir($package);
+ doit("ruby-support", "--move-libs", $tmp);
next if(!-d "$tmp/usr/lib/ruby-support/");
my $rbversions = pkgfile($package, "rbversions");
if($rbversions) {
Modified: tools/ruby-support/trunk/bin/ruby-support
===================================================================
--- tools/ruby-support/trunk/bin/ruby-support 2009-03-26 07:18:25 UTC (rev 3345)
+++ tools/ruby-support/trunk/bin/ruby-support 2009-03-26 14:10:18 UTC (rev 3346)
@@ -9,6 +9,7 @@
require 'optparse'
require 'pp'
+require 'ftools'
$verbose = (ENV['RS_VERBOSE'] != nil)
@@ -224,6 +225,42 @@
end
end
+# Move libraries to RS_PATH during package builds
+def move_libs(builddir)
+ libs_found = false
+ target = File::join(builddir, RS_PATH, File::basename(builddir))
+
+ cleaned = true
+ handled = false
+ Dir["#{builddir}/usr/lib/ruby/*"].each do |source|
+ handled = true
+ cleaned &&= rename_files(source, "", target)
+ end
+
+ Dir::rmdir("#{builddir}/usr/lib/ruby") if handled and cleaned
+end
+
+def rename_files(source, dir, target)
+ cleaned = true
+
+ sourcedir = "#{source}/#{dir}"
+ (Dir::entries(sourcedir) - ['.', '..']).each do |file|
+ path = "#{sourcedir}/#{file}"
+ if File::directory?(path)
+ cleaned &&= rename_files(source, "#{dir}/#{file}", target)
+ elsif file =~ /\.so(\..*)?$|\.h$/
+ cleaned = false
+ else
+ targetdir = "#{target}/#{dir}"
+ File::makedirs(targetdir)
+ File::rename(path, "#{targetdir}/#{file}")
+ end
+ end
+
+ Dir::rmdir(sourcedir) if cleaned
+ return cleaned
+end
+
# run tests
def run_tests
test_supported_versions
@@ -292,6 +329,10 @@
sanity_check
exit(0)
end
+
+ opts.on("", "--move-libs TMPDIR", "Move library files in a package build directory") do |dir|
+ move_libs(dir)
+ end
end
begin
opts.parse!(ARGV)
More information about the Pkg-ruby-extras-commits
mailing list