Ondřej Surý escreveu isso aí: > Hi, > > Lucas has asked me if I could gem2debize libdb-ruby, so here are the findings. > > [Disclaimer: I am not a ruby user, my only interest is helping my > db5.1 transition, so my experience is limited by readability of ruby > programs and ruby docs + google] > > bdb package: > - doesn't have gemspec > - does have 4 extconf.rb ['extconf.rb', 'src/extconf.rb', > 'bdbxml1/extconf.rb', 'bdbxml2/extconf.rb'] > - does build only by calling <sourcedir>/extconf.rb, it does all the > subdirectory work itself > > The build failed on several places due the fact, that > gem2deb/metadata.rb searches for subdirs for extconf.rb > (Dir.glob(**/...)) which is not correct for bdb. The dbxml is not in > Debian, so it cannot be built. > > I was able to circumvent this either by removing bdbxml*/extconf.rb or > the next solution was to write own gemspec. > > The second FTBFS after creating gemspec with: > > spec.extensions << 'extconf.rb' > > came from extconf.rb. It includes this code: > > subdirs.each do |subdir| > STDERR.puts("#{$0}: Entering directory `#{subdir}'") > Dir.chdir(subdir) > system("#{CONFIG['RUBY_INSTALL_NAME']} extconf.rb " + ARGV.join(" ")) > Dir.chdir("..") > STDERR.puts("#{$0}: Leaving directory `#{subdir}'") > end > > Which doesn't pass the target variable from > gem2deb/extension_builder.rb, therefore build fails when it tries to > install shared library to /usr/local/lib. > > The workaround which I have used was to create gemspec file with just > the extension directory supplied thus it doesn't run the > <sourcedir>/extconf.rb at all. > > spec = Gem::Specification.new do |s| > s.extensions << 'src/extconf.rb' > end > > I also had to write some code (mostly copied from > <sourcedir/extconf.rb) to run the tests, but somebody should check it > if it's correct. > > I am little bit convinced that it's the upstream at fault who uses > little bit non-standard system (they should use gemspec instead of > custom extconf.rb), but as I said I don't use ruby, so maybe I am just > confused. Yes, it is upstream fault. There is a lot of stuff there that is a lot more complicated then needed. Actually, the package seems upstream dead: the version in sid today is the same version in lenny ... and even the homepage in debian/control (http://moulon.inra.fr/ruby/bdb.html) gives 404 now. I found out that there's someone else keeping an updated version of this package on github: https://github.com/knu/ruby-bdb This repository even builds against Ruby 1.9 ... Maybe we should switch upstreams and use this code instead, if you (the DB specialist ;-)) think it's better. I tried it here: cloned knu/ruby-bdb, then `dh-make-ruby .`, then created a simple gemspec, removed the extconr.rb at the root and copied your debian/ruby-tests.yml over (see attached diff). The extensions build ok for both 1.8 and 1.9.1, but the tests fail and the package build fails because of that. On 1.9.1 it even segfaults ... I noticed that there is a different Berkeley DB interface for Ruby, also called 'bdb', that is available at rubygems.org: http://rubygems.org/gems/bdb https://github.com/ninjudd/bdb > The git repository was pushed to > git.debian.org/git/users/ondrej/ruby-bdb since I am not a member of > pkg-ruby-extras (and I don't want to be). Please copy this repository > and drop me an email when it's done, so I can delete it. There are some FIXME's in debian/copyright Are you going forward with this package? -- Antonio Terceiro <terceiro@softwarelivre.org> http://softwarelivre.org/terceiro
diff --git a/bdb.gemspec b/bdb.gemspec new file mode 100644 index 0000000..a7e2d54 --- /dev/null +++ b/bdb.gemspec @@ -0,0 +1,19 @@ +Gem::Specification.new do |s| + s.name = %q{bdb} + s.version = "0.6.6" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["FIXME"] + s.date = %q{2011-02-13} + s.description = %q{Ruby interface for Berkeley DB} + s.email = %q{FIXME@example.com} + s.extra_rdoc_files = ["README.en"] + s.files = Dir.glob('*/*.{c,h,rb}') + s.extensions = [ 'src/extconf.rb' ] + + s.homepage = %q{http://FIXME} + s.require_paths = ["src"] + s.summary = %q{Ruby interface for Berkeley DB} + + s.add_development_dependency(%q<rake>, [">= 0"]) +end diff --git a/debian/ruby-tests.rb b/debian/ruby-tests.rb new file mode 100644 index 0000000..f8a6393 --- /dev/null +++ b/debian/ruby-tests.rb @@ -0,0 +1,14 @@ +#!/usr/bin/ruby + +require 'fileutils' +tmpdir = File.join(File.dirname(__FILE__), '..', 'tmp') + +FileUtils.mkdir_p(tmpdir) + +Dir.foreach('tests') do |test_file| + next if /^\./ =~ test_file || /(_\.rb|~)$/ =~ test_file + next if FileTest.directory?(test_file) + system("#{ENV['RUBY_TEST_BIN']} tests/#{test_file}") || exit($?) +end + +FileUtils.rm_rf(tmpdir) diff --git a/extconf.rb b/extconf.rb deleted file mode 100644 index 0893637..0000000 --- a/extconf.rb +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/ruby -require 'mkmf' - -def rule(target, clean = nil) - wr = "#{target}: -\t@for subdir in $(SUBDIRS); do \\ -\t\t(cd $${subdir} && $(MAKE) #{target}); \\ -\tdone; -" - if clean != nil - wr << "\t@-rm tmp/* tests/tmp/* 2> /dev/null\n" - wr << "\t@rm Makefile\n" if clean - end - wr -end - -subdirs = if $configure_args.has_key?("--make") - [] - else - Dir["*"].select do |subdir| - /\Abdbxml/ !~ subdir && File.file?(subdir + "/extconf.rb") - end - end - -begin - make = open("Makefile", "w") - make.print <<-EOF -SUBDIRS = #{subdirs.join(' ')} - -#{rule('all')} -#{rule('static')} -#{rule('clean', false)} -#{rule('distclean', true)} -#{rule('realclean', true)} -#{rule('install')} -#{rule('site-install')} -#{rule('unknown')} -%.html: %.rd -\trd2 $< > ${<:%.rd=%.html} - - EOF - make.print "HTML = bdb.html" - docs = Dir['docs/*.rd'] - docs.each {|x| make.print " \\\n\t#{x.sub(/\.rd$/, '.html')}" } - make.print "\n\nRDOC = bdb.rd" - docs.each {|x| make.print " \\\n\t#{x}" } - make.puts - make.print <<-EOF - -rdoc: docs/doc/index.html - -docs/doc/index.html: $(RDOC) -\t@-(cd docs; rdoc .) - -ri: -\t@-(rdoc -r docs/*rb) - -ri-site: -\t@-(rdoc -R docs/*rb) - -rd2: html - -html: $(HTML) - -test: $(DLLIB) - EOF - Dir.foreach('tests') do |x| - next if /^\./ =~ x || /(_\.rb|~)$/ =~ x - next if FileTest.directory?(x) - make.print "\t-#{CONFIG['RUBY_INSTALL_NAME']} tests/#{x}\n" - end -ensure - make.close -end - -subdirs.each do |subdir| - STDERR.puts("#{$0}: Entering directory `#{subdir}'") - Dir.chdir(subdir) - system("#{CONFIG['RUBY_INSTALL_NAME']} extconf.rb " + ARGV.join(" ")) - Dir.chdir("..") - STDERR.puts("#{$0}: Leaving directory `#{subdir}'") -end -$makefile_created = true
Attachment:
signature.asc
Description: Digital signature