Hi, Kurt Roeckx <[EMAIL PROTECTED]> wrote:
> Your package is failing to build in experimental. It > seems to be stuck in an endless loop doing this over and > over again: [...] Here is my (partial) understanding of the problem: debian/rules contains a rule that causes it to be remade (which is explicitely supported by GNU Make) from debian/rules.in with eperl: % :: %.in $(eperl_sourcefiles) eperl -P -o $@ $< However, in $(eperl_sourcefiles)'s expansion, we find debian/common.variables debian/common.functions, which are real files *but* are declared as .PHONY targets (it took me a while to spot the .PHONY declarations and the end of debian/rules, explaining why the files were being remade every time debian/rules was run...). I suppose Frank declared them as .PHONY because he wanted them to be updated[1] whenever possible. So, debian/rules depends on .PHONY targets. Therefore, it should always be remade, whenever Make runs it, explaining the endless loop. However, on my system, and presumably on Frank's, the loop breaks (at least, when I tried, it was remade "only" twice). That, I don't understand. But in my opinion, having .PHONY targets being real files *and* being depended on is not appropriate, and is causing the problem here (not to mention headaches). Does it mean that targets depending on the .PHONY targets should be remade every time, or only when the .PHONY target files are newer? This sounds ambiguous to me. I've tested the following patch to debian/rules.in, in order to fix this problem. debian/common.variables and debian/common.functions are no longer .PHONY targets. They are updated whenever Make decides to remake debian/rules. debian/rules is automatically updated when one of its sources (debian/rules.in and $(eperl_sourcefiles)) is newer. With this patch, if debian/rules is up-to-date but you have updated the master files in ../../tetex-common, they will not be copied in the package build directory to cause debian/rules to be updated. This is probably something Frank wanted to avoid, but I don't see any elegant way to that. One way would be with a wrapper script, that checks whether the master files are newer, updates them if this is the case, and then runs make; another way would be with a .PHONY target listed as a prerequesite of every legal top-level target of debian/rules (clean, build, binary, binary-arch, etc.) that does this job. None of these is elegant...
--- debian/rules.in.orig 2005-05-16 15:14:51.000000000 +0200 +++ debian/rules.in 2005-05-16 15:11:48.000000000 +0200 @@ -66,8 +66,49 @@ configure: : +# common.variables and common.functions are shared between the tetex-base and +# tetex-bin source packages. If you want to use this mechanism, check out the +# tetex-common tree and put it two directories above the package directory. +# I use ~/src/Packages/tetex-common together with ~/src/Packages/tetex-base/tetex-base-$version/. +define update-debian-common.variables + test -e $(real_common_variables) && \ + test $(real_common_variables) -nt debian/common.variables && \ + cp $(real_common_variables) debian/common.variables || true +endef + +# $(real_common_variables): +# # just do nothing if it does not exist +# true + +define update-debian-common.functions + test -e $(real_common_functions) && \ + test $(real_common_functions) -nt debian/common.functions.in && \ + cp $(real_common_functions) debian/common.functions.in && \ + eperl -P -o debian/common.functions debian/common.functions.in \ + || true +endef + +# $(real_common_functions): +# # just do nothing if it does not exist +# true + +debian/rules: debian/rules.in $(eperl_sourcefiles) + # Refresh debian/common.variables debian/common.functions every time + # the rules file is going to be regenerated + $(update-debian-common.variables) + $(update-debian-common.functions) + # Regenerate the rules file + eperl -P -o $@ $< + +# Override the general double-colon rule for generating files from their +# .in eperl sources; otherwise, Make will complain that +# debian/common.functions depends on itself, since it is in +# $(eperl_sourcefiles). +debian/common.functions: debian/common.functions.in debian/common.variables + eperl -P -o $@ $< + # Eperl is simply great: thanks, Davide! -% :: %.in $(eperl_sourcefiles) +% :: %.in $(eperl_sourcefiles) eperl -P -o $@ $< @@ -115,30 +156,6 @@ -make distclean -# common.variables and common.functions are shared between the tetex-base and -# tetex-bin source packages. If you want to use this mechanism, check out the -# tetex-common tree and put it two directories above the package directory. -# I use ~/src/Packages/tetex-common together with ~/src/Packages/tetex-base/tetex-base-$version/. -debian/common.variables: - test -e $(real_common_variables) && \ - test $(real_common_variables) -nt $@ && \ - cp $(real_common_variables) $@ || true - -# $(real_common_variables): -# # just do nothing if it does not exist -# true - -debian/common.functions: - test -e $(real_common_functions) && \ - test $(real_common_functions) -nt [EMAIL PROTECTED] && \ - cp $(real_common_functions) [EMAIL PROTECTED] || true - eperl -P -o $@ [EMAIL PROTECTED] - -# $(real_common_functions): -# # just do nothing if it does not exist -# true - - configure-stamp: $(stampdir) patch-stamp # comment out the following line if you want to check the configure target # in a CVS working copy @@ -278,7 +295,6 @@ echo "dummy content for dpkg-source" > debian/sid-stamp .PHONY: binary binary-arch binary-indep clean checkroot patchclean sarge sid -.PHONY: debian/common.functions debian/common.variables # Local variables:
[1] i.e., for common.variables, copied from ../../tetex-common/common.variables if this exists, and for common.functions, regenerated from common.functions.in, itself copied from ../../tetex-common/common.functions.in it this exists. -- Florent