tag 567241 patch thanks On Fri, Mar 05, 2010 at 09:37:24PM +0000, Enrico Zini wrote: > On Fri, Jan 29, 2010 at 09:27:40AM +1300, martin f krafft wrote:
> It happened to me once today: the resulting Buffy.pm contains C header > code instead of perl code. But I trying building the perl binding > manually and it worked. I tried rebuilding and it worked. I built > several times on a clean chroot and it worked. In short, I could not > reproduce it anymore. > > I could see NO reason whatsoever why that would happen. The perl > Makefile.PL is *trivial* and so is the Debian part. There seem to be two bugs here that usually cancel each other out. Both of the trivial parts have one :) The build system first incorrectly runs swig -perl -c++ -I/usr/include -o Buffy.pm ../buffy.i which puts C++ code in Buffy.pm. (It's only supposed to modify Buffy.pm as a side effect.) It then copies the broken Buffy.pm to the installation location (blib/lib). Next, the correct swig -perl -c++ -I/usr/include -o buffy_wrap.cc ../buffy.i is run, replacing Buffy.pm with the correct Perl code but leaving blib/lib/Buffy.pm broken. After many other things the 'binary-arch' debian/rules target is invoked. This depends on 'build' -> 'build-stamp' -> 'configure', but as 'configure' doesn't exist, 'build-stamp' is always out of date and will be rerun. The only thing this 'build' rerun does in the perl directory is replacing the broken blib/lib/Buffy.pm with the right one. A side effect is that the test suite gets run two times. The unpredictable thing here is sub-second timestamps. Two tests of the first run of the 'build' target here gave: % ls --full-time perl/Buffy.pm perl/blib/lib/Buffy.pm -r--r--r-- 1 niko niko 215702 2010-08-27 00:00:38.000000000 +0300 perl/blib/lib/Buffy.pm -rw-r--r-- 1 niko niko 10395 2010-08-27 00:00:38.000000000 +0300 perl/Buffy.pm -r--r--r-- 1 niko niko 215702 2010-08-27 00:04:13.000000000 +0300 perl/blib/lib/Buffy.pm -rw-r--r-- 1 niko niko 10395 2010-08-27 00:04:14.000000000 +0300 perl/Buffy.pm and the broken file got replaced only in the second case. Proposed patches attached. -- Niko Tyni nt...@debian.org
>From 2cc918d2e45a3b1751f0245774616cea1d8cb983 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Fri, 27 Aug 2010 00:20:42 +0300 Subject: [PATCH 1/2] Stop writing C++ code into Buffy.pm The generation of Buffy.pm is a side effect of the swig run, and the right target for swig is always buffy_wrap.cc. Make Buffy.pm depend on buffy_wrap.cc instead so make will never try to use the former as a target. --- perl/Makefile.PL | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/perl/Makefile.PL b/perl/Makefile.PL index 26b7074..2d14d6e 100644 --- a/perl/Makefile.PL +++ b/perl/Makefile.PL @@ -11,7 +11,9 @@ WriteMakefile( sub MY::postamble { return <<'MAKE_FRAG'; -buffy_wrap.cc Buffy.pm: ../buffy.i +Buffy.pm: buffy_wrap.cc + +buffy_wrap.cc: ../buffy.i swig -perl -c++ -I/usr/include -o $@ $< MAKE_FRAG } -- 1.7.1
>From bf4f94248708f8574be8a129ed7a94899edac9be Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Fri, 27 Aug 2010 00:16:39 +0300 Subject: [PATCH 2/2] Fix inter-target dependencies not to run the 'build' target twice As 'configure' never exists, the 'build-stamp' was always out of date and needed rebuilding. Moving the dependency onto 'config-stamp' instead fixes this and should work for parallel builds too. While at it, also declare the 'configure' target properly phony. --- debian/rules | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index cff32e9..f056610 100755 --- a/debian/rules +++ b/debian/rules @@ -40,7 +40,7 @@ config-stamp: #Architecture build: build-stamp -build-stamp: configure +build-stamp: config-stamp # Build cd perl && make all OPTIMIZE="$(CXXFLAGS)" cd ruby && make all @@ -125,7 +125,7 @@ binary-arch: build install binary-indep: binary: binary-arch binary-indep -.PHONY: build clean binary-arch binary-indep binary install +.PHONY: build clean binary-arch binary-indep binary install configure # Personal convenience rules -- 1.7.1