build system: Ensure there are no duplicate files in bindist list
authorBen Gamari <bgamari.foss@gmail.com>
Fri, 21 Jul 2017 01:39:27 +0000 (21:39 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 21 Jul 2017 01:39:28 +0000 (21:39 -0400)
Several executables inexplicably appear twice in bindist.list, which
ends up producing multiple tar file entries, consequently breaking BSD
tar during extraction. I spent a fair amount of time trying to work out
where these duplicates were coming from to no avail. Since Hadrian is
right around the corner I'm satisfied with a terrible hack: just uniq
bindist.list before producing the bindist tarball.

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13979, #13974

Differential Revision: https://phabricator.haskell.org/D3767

ghc.mk

diff --git a/ghc.mk b/ghc.mk
index cdab331..4eb1658 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -1125,7 +1125,8 @@ unix-binary-dist-prep:
        $(call removeFiles,$(BIN_DIST_PREP_TAR))
 # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
 # tree then we want to include the real file, not a symlink to it
-       cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
+       sort bindist-list | uniq > bindist-list.uniq
+       cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list.uniq | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
 
 windows-binary-dist-prep:
        $(call removeTrees,bindistprep/)
@@ -1436,6 +1437,7 @@ distclean : clean
 
 # We make these when making or testing bindists
        $(call removeFiles,bindist-list)
+       $(call removeFiles,bindist-list.uniq)
        $(call removeTrees,bindisttest/a)
 
 # Not sure why this is being cleaned here.