Lucas Nussbaum escreveu isso aí: > On 23/08/11 at 00:35 +0200, Hilko Bengen wrote: > > Hi, > > > > I'd love to provide ruby-hivex and ruby-guestfs packages, but I need > > some help with figuring out what needs to be adjusted so that the Ruby > > bindings can be built in separate builddirs. Working patches would be > > even better. :-) > > > > Both packages use autoconf to generate the Rakefile at build-time. So > > far, I haven't been able to figure out how to adjust the paths so that > > "rake build" will put all newly generated files below @builddir@ and > > "rake install" will take the files from appropriate locations. > > Hi, > > I've looked at the hivex source package, but couldn't find ruby bindings > there. > For guestfs, I'd suggest ignoring the Rakefile completely, and using > gem2deb to build the extension. I don't think that gem2deb can use a > different root directly at the moment. Antonio, what do you think? The problem with the generated Rakefile is that it it hardcodes using `ruby`. Depending on what your /usr/bin/ruby points to (currently it can be ruby1.8 or ruby1.9.1), it will only build bindings for that specific version. gem2deb can't use a different root, but the extension builder will look for every extconf.rb under the root and build/install it with all supported Ruby versions. I would do as Lucas suggested: ignore the upstream Ruby support and build directly with gem2deb. The attached patches should do the trick. I couldn't actually test these patches here because the build failed before that point as follows: c -I.. -Wall -Wno-unused -fno-strict-aliasing -g -O2 -c -o libprotocol_la-guestfs_protocol.lo `test -f 'guestfs_protocol.c' || echo '../../../src/'`guestfs_protocol.c guestfs_protocol.c:6:33: fatal error: ../guestfs_protocol.h: No such file or directory compilation terminated. make[5]: *** [libprotocol_la-guestfs_protocol.lo] Error 1 make[5]: Leaving directory `/tmp/libguestfs/debian/build-python2.6/src' make[4]: *** [all] Error 2 make[4]: Leaving directory `/tmp/libguestfs/debian/build-python2.6/src' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/tmp/libguestfs/debian/build-python2.6' make[2]: ** [all] Erro 2 make[2]: Saindo do diretório `/tmp/libguestfs/debian/build-python2.6' dh_auto_build: make -j1 INSTALLDIRS=vendor LD_RUN_PATH= returned exit code 2 make[1]: ** [override_dh_auto_build] Erro 2 make[1]: Saindo do diretório `/tmp/libguestfs' make: ** [build] Erro 2 dpkg-buildpackage: error: debian/rules build gave error exit status 2 debuild: fatal error at line 1348: dpkg-buildpackage -rfakeroot -D -us -uc -i -I failed gbp:error: debuild -i -I returned 29 gbp:error: Couldn't run 'debuild -i -I -us -uc' HTH, -- Antonio Terceiro <terceiro@debian.org>
From 6e22d7a58e71ffc54a12ed0c42ae9e513e7c0fab Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@softwarelivre.org>
Date: Sat, 27 Aug 2011 16:51:01 -0700
Subject: [PATCH 1/2] Custom CFLAGS and LDFLAGS for Ruby build
---
ruby/ext/guestfs/extconf.rb | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/ruby/ext/guestfs/extconf.rb b/ruby/ext/guestfs/extconf.rb
index cc053aa..8883722 100644
--- a/ruby/ext/guestfs/extconf.rb
+++ b/ruby/ext/guestfs/extconf.rb
@@ -22,6 +22,11 @@ extension_name = '_guestfs'
dir_config(extension_name)
+topdir = File.expand_path(File.dirname(__FILE__), '../../..')
+
+$CFLAGS = "#{$CFLAGS} -I#{topdir}/src"
+$LDFLAGS = "#{$LDFLAGS} -L#{topdir}/src"
+
unless have_header("guestfs.h")
raise "<guestfs.h> not found"
end
--
1.7.5.4
From da1439557aa840474e22c36c852f661c92620f21 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@softwarelivre.org>
Date: Sat, 27 Aug 2011 16:53:27 -0700
Subject: [PATCH 2/2] Build Ruby bindings
---
debian/control | 25 +++++++++++++++++++++++++
debian/rules | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/debian/control b/debian/control
index 5686fee..e22e06f 100644
--- a/debian/control
+++ b/debian/control
@@ -15,12 +15,14 @@ Build-Depends: debhelper (>= 7.0.50~), autotools-dev, aptitude,
genisoimage, pkg-config,
dh-ocaml, ocaml, ocaml-findlib, libpcre-ocaml-dev,
python (>= 2.6.7-2), python-all-dev (>= 2.6.6-3~), python3-all-dev,
+ gem2deb (>= 0.2.7~),
libtest-pod-coverage-perl, libextutils-command-perl, libintl-perl, libtest-pod-perl,
libstring-shellquote-perl,
libsys-virt-perl, libwin-hivex-perl,
libfuse-dev, fuse-utils
Homepage: http://libguestfs.org
Standards-Version: 3.9.2
+XS-Ruby-Versions: all
Package: guestfish
Section: admin
@@ -310,3 +312,26 @@ Description: library for accessing and modifying guest disk images
.
This package contains all the files needed to develop OCaml programs
wich use OCaml bindings to libguestfs.
+
+Package: ruby-guestfs
+Section: python
+Architecture: i386 amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, libguestfs0 (= ${binary:Version})
+Description: library for accessing and modifying guest disk images
+ libguestfs is a library for accessing and modifying guest disk images. Amongst
+ the things this is good for: making batch configuration changes to guests,
+ viewing and editing files inside guests, getting disk used/free statistics,
+ migrating between virtualization systems, performing partial backups,
+ performing partial guest clones, cloning guests and changing
+ registry/UUID/hostname info, and much else besides.
+ .
+ It uses Linux kernel and qemu code, and can access any type of guest
+ filesystem that Linux and qemu can, including but not limited to: ext2/3/4,
+ btrfs, FAT and NTFS, LVM, many different disk partition schemes, qcow, qcow2,
+ vmdk.
+ .
+ libguestfs provides ways to enumerate guest storage (eg. partitions, LVs, what
+ filesystem is in each LV, etc.). It can also run commands in the context of
+ the guest. Also you can upload and download files and directories.
+ .
+ This package contains the Ruby bindings.
diff --git a/debian/rules b/debian/rules
index 9ae5321..baa395d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -66,6 +66,8 @@ override_dh_auto_install:
DESTDIR=$(CURDIR)/debian/tmp ; \
fi ; \
done
+ dh_install -p ruby-guestfs ruby/lib/guestfs.rb /usr/lib/ruby/vendor_lib
+ DH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR=yes dh_ruby --install $(CURDIR)/debian/ruby-guestfs
override_dh_install:
rm -f debian/tmp/usr/lib/python*/dist-packages/libguestfsmod.la
--
1.7.5.4
Attachment:
signature.asc
Description: Digital signature