ghc/ghc-Debian-reproducible-tmp-names.patch
Jens Petersen f50ec379b6 update to 7.10.3 from petersen/ghc-7.10.3 copr
- quick build
- use 7.10.3b respin tarballs
- no longer need:
  - ghc-glibc-2.20_BSD_SOURCE.patch
  - ghc-7.8-arm-use-ld-gold.patch
  - ghc-7.8-arm7_saner-linker-opt-handling-9873.patch
  - ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch
  - build_minimum_smp
- add Debian packages:
  - buildpath-abi-stability
  - no-missing-haddock-file-warning
  - reproducible-tmp-names
- use llvm35
- add libraries-versions.sh script
- all library versions updates except xhtml
- BR ghc-rpm-macros-extra for all OS versions
- support building on EL6
- deprecated libraries: haskell2010, haskell98, old-locale, old-time
- symlink for integer-gmp2
- add llvm_major
2016-06-03 14:29:26 +09:00

44 lines
1.5 KiB
Diff

This is an attempt to make GHC build reproducible. The name of .c files may end
up in the resulting binary (in the debug section), but not the directory.
Instead of using the process id, create a hash from the command line arguments,
and assume that is going to be unique.
Index: ghc/compiler/main/SysTools.hs
===================================================================
--- ghc.orig/compiler/main/SysTools.hs 2015-11-02 17:23:05.410365013 +0100
+++ ghc/compiler/main/SysTools.hs 2015-11-02 17:23:05.410365013 +0100
@@ -66,6 +66,7 @@
import Util
import DynFlags
import Exception
+import Fingerprint
import Data.IORef
import Control.Monad
@@ -1152,8 +1153,8 @@
mapping <- readIORef dir_ref
case Map.lookup tmp_dir mapping of
Nothing -> do
- pid <- getProcessID
- let prefix = tmp_dir </> "ghc" ++ show pid ++ "_"
+ pid <- getStableProcessID
+ let prefix = tmp_dir </> "ghc" ++ pid ++ "_"
mask_ $ mkTempDir prefix
Just dir -> return dir
where
@@ -1531,6 +1532,13 @@
getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral
#endif
+-- Debian-specific hack to get reproducible output, by not using the "random"
+-- pid, but rather something determinisic
+getStableProcessID :: IO String
+getStableProcessID = do
+ args <- getArgs
+ return $ take 4 $ show $ fingerprintString $ unwords args
+
-- Divvy up text stream into lines, taking platform dependent
-- line termination into account.
linesPlatform :: String -> [String]