Multiple concurrent builds would sometimes give an error similar to 'ghc-pkg: cannot create: /home/edsko/path/to/main-package/dist-newstyle/packagedb/ghc-7.10.3 already exists' because packagedbs would be made at the same time. The solution is to initialise packagedbs at the start of the build process rather than when needed.
[ { "endline": 578, "file": "cabal-install/Distribution/Client/ProjectBuilding.hs", "function": "rebuildTargets", "module": "Distribution.Client.ProjectBuilding", "startline": 578 }, { "endline": 626, "file": "cabal-install/Distribution/Client/ProjectPlanning.hs", "function": "getPackageDBContents", "module": "Distribution.Client.ProjectPlanning", "startline": 625 }, { "endline": 653, "file": "cabal-install/Distribution/Client/ProjectPlanning.hs", "function": "getPackageDBContents", "module": "Distribution.Client.ProjectPlanning", "startline": 645 } ]
[ { "endline": 581, "file": "cabal-install/Distribution/Client/ProjectBuilding.hs", "function": "rebuildTargets", "module": "Distribution.Client.ProjectBuilding", "startline": 578 }, { "endline": 599, "file": "cabal-install/Distribution/Client/ProjectBuilding.hs", "function": "rebuildTargets", "module": "Distribution.Client.ProjectBuilding", "startline": 599 }, { "endline": 633, "file": "cabal-install/Distribution/Client/ProjectBuilding.hs", "function": "rebuildTargets", "module": "Distribution.Client.ProjectBuilding", "startline": 626 }, { "endline": 625, "file": "cabal-install/Distribution/Client/ProjectPlanning.hs", "function": "getPackageDBContents", "module": "Distribution.Client.ProjectPlanning", "startline": 625 }, { "endline": 655, "file": "cabal-install/Distribution/Client/ProjectPlanning.hs", "function": "getPackageDBContents", "module": "Distribution.Client.ProjectPlanning", "startline": 648 } ]