[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nodist_noinst_SCRIPTS and `make distcheck`
From: |
Nick Bowler |
Subject: |
Re: nodist_noinst_SCRIPTS and `make distcheck` |
Date: |
Mon, 20 Oct 2014 13:52:39 -0400 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
On 2014-10-20 20:25 +0300, fr33domlover wrote:
> > There are two related things that distcheck is testing here, and either
> > one of them may be tripping you up.
> >
> > First, distcheck is checking that users can run "make dist" from your
> > tarball.
>
> Indeed `make dist` succeeds.
>
> > Second, distcheck is checking that all this works properly in VPATH
> > builds (i.e., with srcdir != builddir).
>
> I didn't try, but I assume it will work because the only problem is that
> script, which IS present in the right place. The Makefile.am makes sure it
> will
> be taken from $srcdir. The problem happens because `make distcheck` copies
> files from the source repo into a new temporary srcdir.
Not exactly. Distcheck first creates a distribution tarball (i.e.,
make dist), THEN it unpacks the tarball into a temporary srcdir and
tests that. In other words, distcheck is directly testing the 'user
experience' when they unpack a tarball you publish.
Part of that user experience is that the following sequence should work:
- download your package tarball from a website.
- unpack it
- ./configure && make dist
Since your script is not distributed, that sequence must not require the
script to work.
[...]
> It's going to be the first release, so I didn't try distcheck until now.
>
> The line which generates the ChangeLog in the snippet above requires that
> script
> to be present in $srcdir - but distcheck doesn't copy it to its temporary
> srcdir, so it's not present.
You should not need to copy the script at all, as it should be run at
'make dist' time or earlier. This will happen directly in your VCS-
controlled srcdir, before distcheck unpacks the tarball to test.
> The solution to the problem of .git not being present during distcheck may be:
> In distcheck-hook, take it from the right place (i.e. $(srcdir)/../.git) and
> then try to make the ChangeLog again. The thing about the script is, that
> while
> I can do the same (pick the script from the original $srcdir), it would be
> somewhat wrong design-wise - if a script is used for `make dist`, then `make
> distcheck` should copy it into the temporary srcdir just like the source code.
> While not installed nor distributed, the script is *used* during the process
> and is therefore required.
I'm not sure I understand.
When "make distcheck" tests the distribution, it tries to run "make
dist" from the tarball. This must succeed *without* running your
script at all, as the git history will not be available in this
scenario. So when building from the tarball, your distribution should
copy the already-included ChangeLog instead of generating a new one.
As I mentioned, one solution is to use a dist-hook to generate the
ChangeLog only when certain conditions (i.e., building from source
control) are met.
There are other possibile solutions: for example, Automake generates
ChangeLog in builddir using a phony target. Personally, I think a
dist-hook is simpler.
> How do I tell `make distcheck` to do that? I did try to have the
> ChangeLog target depend on the script file, but then instead of being
> satisfied by it (since the script file exists), it complains there's
> no target for it (but none needed since it's a file and it already
> exists).
You can't have ChangeLog depend on your script because the script is
not distributed, so this dependency can never be satisfied in the
tarball.
> Is there a solution for this in automake?
Yes, use a dist-hook.
Cheers,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)