[DRE-commits] r3361 - tools/ruby-support/trunk/bin
lucas at alioth.debian.org
lucas at alioth.debian.org
Sat Apr 4 14:34:22 UTC 2009
Author: lucas
Date: 2009-04-04 14:34:21 +0000 (Sat, 04 Apr 2009)
New Revision: 3361
Modified:
tools/ruby-support/trunk/bin/ruby-support
Log:
improved --move-files
Modified: tools/ruby-support/trunk/bin/ruby-support
===================================================================
--- tools/ruby-support/trunk/bin/ruby-support 2009-04-04 11:10:16 UTC (rev 3360)
+++ tools/ruby-support/trunk/bin/ruby-support 2009-04-04 14:34:21 UTC (rev 3361)
@@ -227,38 +227,39 @@
# Move libraries to RS_PATH during package builds
def move_libs(builddir)
- libs_found = false
- target = File::join(builddir, RS_PATH, File::basename(builddir))
+ # 1) Find possible source dirs for the copy
+ sources = []
+ RS_RUBY_LIBDIR.each_pair do |rbv, rbp|
+ s = builddir + '/' + rbp
+ next if not Directory::exists?(s)
+ next if (Dir::entries(s) - [ '.', '..' ]).length == 0
+ puts "Found possible source: #{s}"
+ sources << s
+ end
- cleaned = true
- handled = false
- Dir["#{builddir}/usr/lib/ruby/*"].each do |source|
- handled = true
- cleaned &&= rename_files(source, "", target)
+ if sources.length == 0
+ puts "No source dir found. You need to install your library's file"
+ print "into one of the standard Ruby library path:\n "
+ puts RS_RUBY_LIBDIR.to_a.map { |e| e[1] }.join("\n ")
+ exit(1)
end
- Dir::rmdir("#{builddir}/usr/lib/ruby") if handled and cleaned
-end
+ if sources.length > 1
+ print "More than one source directory found:\n "
+ puts sources.join("\n ")
+ puts "You need to manually install the library files into #{RS_PATH},"
+ puts "and call dh_ruby with the --no-move parameter."
+ # FIXME --no-move needs to be implemented!!
+ puts "In the future, dh_ruby might get support for dealing with that."
+ exit(1)
+ 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
+ source = sources[0]
+ target = File::join(builddir, RS_PATH, File::basename(builddir))
+ (Dir::entries(source) - ['.', '..']).each do |e|
+ File::move(File::join(source, e), target, true)
end
-
- Dir::rmdir(sourcedir) if cleaned
- return cleaned
+ Dir::rmdir(source)
end
# run tests
More information about the Pkg-ruby-extras-commits
mailing list