[Top][All Lists]

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

Re: patch and dist rules

From: Stepan Kasal
Subject: Re: patch and dist rules
Date: Mon, 5 May 2008 14:14:13 +0200
User-agent: Mutt/1.5.17 (2007-11-01)

Hello Jack,
  a few humble ideas:

On Sat, May 03, 2008 at 05:59:44PM -0700, Jack Bates wrote:
> patch: patch-stamp
> patch-stamp: patches/*
>       cat patches/* | patch -p0
>       touch $@

Please note that this rule is not perfect; when one of the
patches is deleted, the rule does not notice it.  You should rather
use a stamp on the server side, too.  That file might also contain a
version number, or perhaps it could be a shell script which would
apply the patches...

> This rule works OK: The first time `make patch` is called, it applies
> all our local patches. As long as the patches have not changed,
> subsequent calls to `make patch` result in "Nothing to be done". When
> patches are changed, user intervention is required to revert changes to
> the working copy of the framework before applying our updated patches.

if your only goal is to work for the first time and require user
intervention when the set of patches is updated, you could as well do

1) incorporate the command
        cat patches/*|patch -p0 && touch patches-stamp
to your "bootstrap script" which each user runs after the checkout of
the svn repository.

2) implement a check in makefiles, which would warn the user if new
patches arrived:
dist-hook: patches-stamp
patches-stamp: patches/*
        echo "please re-apply the patchset" >&2 && exit 1

Since manual intervention is required, it should not matter much that
we hook near the end of "dist".  The manual work will take more time
that that failing "dist".

> Any suggestions how to ensure automake's "dist" rule generates a tarball
> with our patches applied?

I would use a wrapper GNUmakefile which would first apply patches and
then call the same target; something like that:

        ... do what necessary
%: apply-patches
        @$(MAKE) $(MAKEFLAGS) -f Makefile $@
.PHONY: apply-patches

That GNUmakefile would not be distributed, so the created tarball
would not contain it; it's OK, since it would contain the current
patched buildsystem.

You need to implement apply-patches somehow so that it ensures the
build-system is up-to-date, see the comment above.

I hope this helps,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]