build: Clean testsuite before sdist
ClosedPublic

Authored by austin on Jun 4 2015, 5:14 PM.

Details

Summary

When making the sdist tarball, we don't really need anything inside $(TOP)/testsuite in order to do our thing. So make sure we clean it first to avoid situations like Trac #10406.

With D917 landed, this can actually avoided entirely by fixing the official release process to instead build an sdist first from the clean git repository and then build that (to fixpoint) and test it. Then the originall clean tarball can be shipped.

But it's nice to be safe in the general case where someone might want to (in the future) sdist out of their build tree.

Signed-off-by: Austin Seipp <austin@well-typed.com>

Test Plan

Hopeful bliss.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
austin updated this revision to Diff 3142.Jun 4 2015, 5:14 PM
austin retitled this revision from to build: Clean testsuite before sdist.
austin updated this object.
austin edited the test plan for this revision. (Show Details)
austin added reviewers: thomie, hvr.
austin updated the Trac tickets for this revision.
thomie edited edge metadata.Jun 4 2015, 5:34 PM

This doesn't actually do much, since running clean in the testsuite directory doesn't remove files created by the tests. You currently need make CLEANUP=1 CLEAN_ONLY=1. This requires building testsuite/mk/ghc-config.hs first, which is possibly the reason why make clean doesn't run that command by itself. You don't want to build stuff when cleaning.

I've though about using something like git clean -X -d (Trac #9543), which removes all files ignored by git. Problem is that it requires git.

austin added a comment.Jun 4 2015, 5:46 PM

Ugh. Well, I was hoping to do something less terrible as opposed to say, rm -rf $(TOP)/testsuite/mk/*.exe etc etc. I'll think about it.

austin planned changes to this revision.Jun 4 2015, 5:46 PM
thomie requested changes to this revision.Jun 4 2015, 5:49 PM
thomie edited edge metadata.

Also, if you look at sdist-ghc-prep-tree, it leaves the ghc root directory alone:

cd $(SRC_DIST_GHC_DIR) && $(MAKE) distclean

So similarly this patch should run distclean in SRC_DIST_TESTSUITE_DIR/testsuite, not in TOP/testsuite.

thomie added a comment.Jun 4 2015, 5:51 PM

Sorry, if it's just about that executable, then yes this will work. With my requested changes above preferably.

austin updated this revision to Diff 3169.Jun 9 2015, 12:44 AM
austin edited edge metadata.

Respond to comments from @thomie

thomie requested changes to this revision.Jun 9 2015, 2:48 AM
thomie edited edge metadata.
thomie added inline comments.
ghc.mk
1177–1178
  • should be distclean not clean (currently there isn't a difference for the testsuite, but there might be in the future. distclean is specifically for creating source distributions, and also cleans up things that configure generated)
  • it should come after the directory is created, and after this lndir command
This revision now requires changes to proceed.Jun 9 2015, 2:48 AM
austin updated this revision to Diff 3173.Jun 9 2015, 2:52 AM
austin edited edge metadata.

Fix up based on comments by @thomie

thomie accepted this revision.Jun 9 2015, 3:05 AM
thomie edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 9 2015, 3:05 AM
This revision was automatically updated to reflect the committed changes.