Re: [PATCH] debian: package ruby bindings

Subject: Re: [PATCH] debian: package ruby bindings

Date: Sun, 14 Apr 2013 20:19:03 -0500

To: David Bremner

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Sun, Apr 14, 2013 at 8:52 AM, David Bremner <bremner@debian.org> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>>
>> diff --git a/debian/control b/debian/control
>> index 854a32a..620c5ce 100644
>> --- a/debian/control
>> +++ b/debian/control
>> @@ -15,6 +15,7 @@ Build-Depends:
>>   libz-dev,
>>   python-all (>= 2.6.6-3~),
>>   python3-all (>= 3.1.2-7~),
>> + ruby-dev,
>>   emacs23-nox | emacs23 (>=23~) | emacs23-lucid (>=23~) |
>>   emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~),
>>   gdb,
>
> This doesn't build in a clean sid chroot, because ruby-dev does not
> depend on ruby, so you need to explicitly add it.

Right, I just found that too.

>>  Package: notmuch-emacs
>>  Architecture: all
>>  Section: mail
>> diff --git a/debian/notmuch-ruby.install b/debian/notmuch-ruby.install
>> new file mode 100644
>> index 0000000..f92f09c
>> --- /dev/null
>> +++ b/debian/notmuch-ruby.install
>> @@ -0,0 +1 @@
>> +usr/local/lib/site_ruby/*/*/notmuch.so
>> diff --git a/debian/rules b/debian/rules
>> index c4e3930..7c7247a 100755
>> --- a/debian/rules
>> +++ b/debian/rules
>> @@ -12,15 +12,24 @@ override_dh_auto_build:
>>       dh_auto_build
>>       dh_auto_build --sourcedirectory bindings/python
>>       cd bindings/python && $(python3_all) setup.py build
>> +     dh_auto_build --sourcedirectory bindings/ruby
>> +     cd bindings/ruby && ruby extconf.rb && make
>
> Why are both these lines needed?

The first one isn't.

> On a related note, is the ruby build
> procedure documented somewhere?

Not really, it's just standard.

>>  override_dh_auto_clean:
>>       dh_auto_clean
>>       dh_auto_clean --sourcedirectory bindings/python
>>       cd bindings/python && $(python3_all) setup.py clean -a
>> +     dh_auto_build --sourcedirectory bindings/ruby
>> +     cd bindings/ruby && test -f Makefile && make clean || true
>>       $(MAKE) -C contrib/notmuch-mutt clean
>
> This looks suspect, calling dh_auto_build from the clean target.

A mistake, probably the first line is enough.

> The
> clean target cannot assume that e.g. notmuch is already built.

It doesn't, that's what the 'test -f Makefile' was for.

>>  override_dh_auto_install:
>>       dh_auto_install
>>       dh_auto_install --sourcedirectory bindings/python
>>       cd bindings/python && $(python3_all) setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp
>> +     dh_auto_build --sourcedirectory bindings/ruby
>> +     cd bindings/ruby && make install DESTDIR=$(CURDIR)/debian/tmp
>
> This call to dh_auto_build also confuses me. The top level sequencer
> will ensure that the override_dh_auto_build is called before this one.

A mistake.

>> +
>> +# ruby's site is configured in /usr/local
>> +override_dh_usrlocal:
>
> The package is still installing files into /usr/local, which is a
> violation of debian policy 9.1.2
>
> It's a good idea to run "lintian" on the resulting debian packages;
> that's how I caught the problem with /usr/local.

Tell that to debian maintainers who configure ruby that way:

require 'rbconfig'
RbConfig::CONFIG['sitelibdir']
=> "/usr/local/lib/site_ruby/1.9.1"
RbConfig::CONFIG['configure_args']
=> " '--build=x86_64-linux-gnu' '--prefix=/usr'
'--includedir=/usr/include' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--sysconfdir=/etc' '--localstatedir=/var'
'--libexecdir=/usr/lib/ruby1.9.1' '--srcdir=.'
'--disable-maintainer-mode' '--disable-dependency-tracking'
'--disable-silent-rules' '--enable-pthread' '--enable-shared'
'--disable-rpath' '--disable-install-doc'
'--with-vendordir=/usr/lib/ruby/vendor_ruby'
'--with-sitedir=/usr/local/lib/site_ruby' '--program-suffix=1.9.1'
'--with-soname=ruby-1.9.1' '--with-baseruby=/usr/bin/ruby1.8'
'--enable-ipv6' '--with-dbm-type=gdbm_compat' '--with-tklib=tk8.5'
'--with-tcllib=tcl8.5' '--with-tcl-include=/usr/include/tcl8.5'
'--with-bundled-sha1' '--with-bundled-md5' '--with-bundled-rmd160'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall
-fno-strict-aliasing' 'LDFLAGS=-Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall
-fno-strict-aliasing'"

So, the changes I propose are:

--- b/debian/control
+++ a/debian/control
@@ -15,7 +15,7 @@ Build-Depends:
  libz-dev,
  python-all (>= 2.6.6-3~),
  python3-all (>= 3.1.2-7~),
- ruby-dev,
+ ruby, ruby-dev,
  emacs23-nox | emacs23 (>=23~) | emacs23-lucid (>=23~) |
  emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~),
  gdb,
diff --git b/debian/rules a/debian/rules
index 7c7247a..1dd59d2 100755
--- b/debian/rules
+++ a/debian/rules
@@ -12,7 +12,6 @@ override_dh_auto_build:
        dh_auto_build
        dh_auto_build --sourcedirectory bindings/python
        cd bindings/python && $(python3_all) setup.py build
-       dh_auto_build --sourcedirectory bindings/ruby
        cd bindings/ruby && ruby extconf.rb && make
        $(MAKE) -C contrib/notmuch-mutt

@@ -20,16 +19,14 @@ override_dh_auto_clean:
        dh_auto_clean
        dh_auto_clean --sourcedirectory bindings/python
        cd bindings/python && $(python3_all) setup.py clean -a
-       dh_auto_build --sourcedirectory bindings/ruby
-       cd bindings/ruby && test -f Makefile && make clean || true
+       dh_auto_clean --sourcedirectory bindings/ruby
        $(MAKE) -C contrib/notmuch-mutt clean

 override_dh_auto_install:
        dh_auto_install
        dh_auto_install --sourcedirectory bindings/python
        cd bindings/python && $(python3_all) setup.py install
--install-layout=deb --root=$(CURDIR)/debian/tmp
-       dh_auto_build --sourcedirectory bindings/ruby
-       cd bindings/ruby && make install DESTDIR=$(CURDIR)/debian/tmp
+       dh_auto_install --sourcedirectory bindings/ruby

 # ruby's site is configured in /usr/local
 override_dh_usrlocal:

Cheers.

-- 
Felipe Contreras

Thread: