[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#793404: massive waste of CPU time in debian/rules by inline commands



On Thu, Jul 23, 2015 at 09:08:15PM +0200, Jakub Wilk wrote:
> * Eduard Bloch <edi@gmx.de>, 2015-07-23, 19:43:
> >The problem: I see lots of $(shell ...) stuff. In boost, there are about
> >12 such calls. And they run dpkg-architecture or dpkg-parsechangelogs or
> >similar commands. When this was done a just couple of times (i.e. before
> >dh(7)), that's acceptable. But now, it looks like debian/rules is called
> >many, many times through dh.
> 
> One mistake boost makes is using ":=" instead of plain "=". Contrary to
> popular belief, the former almost always causes more evaluation of $(shell)
> stuff, specially when dh is involved.

Or you can use:

lazy = $(eval $(1) = $$(if $$(___$(1)),,$$(eval ___$(1) := $(2)))$$(___$(1)))
$(call lazy,VARIABLE_NAME,$$(shell command))

And then the command will only execute when you actually use
VARIABLE_NAME for the first time.

Mike


Reply to: