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

Re: Writing get-orig-source targets to conform with policy



On Sat, Feb 16, 2008 at 11:10:01PM -0500, Andres Mejia wrote:

> Second question is regarding a get-orig-source target I have for the package 
> mediatomb. It goes like:

> # Haven't found a way to use this without running it twice
> COMPUTED_CHECKSUM = $(shell md5sum $(MEDIATOMB_TARBALL) | cut -d ' ' -f 1)

> get-orig-source:

> ifeq ($(CORRECT_CHECKSUM),$(COMPUTED_CHECKSUM))

> The problem here is that the get-orig-source target has to be run
> twice before the checksum passes (unless you happen to have the file
> in the current directory already). Is there any way around this?

The reason is that $(shell ...) is evaluated by make before wget creates
the file (I think it happens at the beginning of the rule).  Instead I
think you should either use a shell test:

  [ "$md50" = "$md51" ] || { echo "$0: error: ..." >&2; exit 1; }

Or use a 2nd rule which creates the upstream file (using wget), and then
get-orig-source depends on that rule and does md5sum; tar xzf;
manipulate; tar czf.

Justin


Reply to: