Add HomeUnit type

Since Backpack the "home unit" is much more involved than what it was
before (just an identifier obtained with `-this-unit-id`). Now it is
used in conjunction with `-component-id` and `-instantiated-with` to
configure module instantiations and to detect if we are type-checking an
indefinite unit or compiling a definite one.

This patch introduces a new HomeUnit datatype which is much easier to
understand. Moreover to make GHC support several packages in the same
instances, we will need to handle several HomeUnits so having a
dedicated (documented) type is helpful.

Finally in #14335 we will also need to handle the case where we have no
HomeUnit at all because we are only loading existing interfaces for
plugins which live in a different space compared to units used to
produce target code. Several functions will have to be refactored to
accept "Maybe HomeUnit" parameters instead of implicitly querying the
HomeUnit fields in DynFlags. Having a dedicated type will make this
easier.
22 jobs for !3834 with hsyl20/plugins/homeunit in 340 minutes and 15 seconds (queued for 2 seconds)
detached
Status Job ID Name Coverage
  Lint
passed #416090
lint
ghc-linters

00:00:15

passed #416091
lint
lint-linters

00:00:14

failed #416094
lint allowed to fail
lint-submods

00:00:20

passed #416092
lint
lint-testsuite

00:00:16

passed #416093
lint
typecheck-testsuite

00:00:15

 
  Quick Build
passed #416095
x86_64-linux
hadrian-ghc-in-ghci

00:09:51

 
  Build
passed #416096
x86_64-linux
validate-x86_64-linux-deb9-hadrian

00:53:02

 
  Full Build
failed #416099
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

04:08:30

failed #416100
armv7-linux allowed to fail
validate-armv7-linux-deb9

03:58:26

passed #416101
x86_64-linux
validate-i386-linux-deb9

01:28:58

passed #416098
x86_64-darwin
validate-x86_64-darwin

01:08:58

passed #416102
x86_64-linux
validate-x86_64-linux-deb9-debug

01:46:44

passed #416104
x86_64-linux
validate-x86_64-linux-deb9-dwarf

01:26:32

passed #416103
x86_64-linux
validate-x86_64-linux-deb9-integer-simple

01:20:35

passed #416097
x86_64-linux
validate-x86_64-linux-deb9-unreg-hadrian

02:44:29

passed #416105
x86_64-linux
validate-x86_64-linux-fedora27

01:14:38

failed #416107
new-x86_64-windows test allowed to fail
validate-x86_64-windows

00:30:19

failed #416106
new-x86_64-windows test allowed to fail
validate-x86_64-windows-hadrian

00:48:35

 
  Cleanup
passed #416108
x86_64-darwin
cleanup-darwin

00:00:15

 
  Packaging
failed #416109
x86_64-linux allowed to fail
doc-tarball

00:00:49

 
  Testing
manual #416110
x86_64-linux allowed to fail manual
hackage
passed #416111
x86_64-linux
perf-nofib

00:26:51

 
Name Stage Failure
failed
doc-tarball Packaging
Entering 'utils/haddock'
Entering 'utils/hsc2hs'
Downloading artifacts
Downloading artifacts for validate-x86_64-linux-deb9-debug (416102)...
Downloading artifacts from coordinator... ok
id=416102 responseStatus=200 OK token=mQ1ZPQQL
Executing "step_script" stage of the job script
$ if [ ! -f "$LINUX_BINDIST" ]; then # collapsed multi-line command
Error: ghc-x86_64-mingw32.tar.xz does not exist. Did the 64-bit Windows job fail?
ERROR: Job failed: exit code 1
failed
lint-submods Lint
Fetching origin
Entering 'utils/haddock'
Fetching origin
Entering 'utils/hsc2hs'
Fetching origin
$ submodchecker . $(git rev-list $base..$CI_COMMIT_SHA)
Submodule update(s) detected in 55c184086ebd83124f253c87cde3515b051f1776:
*FAIL* commit message does not contain magic 'submodule' word
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows Full Build
Git branch:   13-1-stable
GO version: go1.13.8
Built: 2020-06-19T21:12:23+0000
OS/Arch: windows/amd64
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=11924 revision=6214287e version=13.1.0
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 1
failed
validate-x86_64-windows-hadrian Full Build
Git branch:   13-1-stable
GO version: go1.13.8
Built: 2020-06-19T21:12:23+0000
OS/Arch: windows/amd64
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=9088 revision=6214287e version=13.1.0
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 1
failed
validate-armv7-linux-deb9 Full Build
Uploading artifacts...
ghc-armv7-linux-deb9.tar.xz: found 1 matching files

junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

Uploading artifacts to coordinator... ok
id=416100 responseStatus=201 Created token=xEWX6C73
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=416100 responseStatus=201 Created token=xEWX6C73
ERROR: Job failed: exit code 1
failed
validate-aarch64-linux-deb9 Full Build
cd "libraries/unix/tests/fileStatus.run" && ./fileStatus   < 
cd "libraries/unix/tests/T1185.run" && ./T1185 <
=====> processGroup001(normal) 7665 of 7684 [0, 101, 0]
cd "libraries/unix/tests/processGroup001.run" && "/builds/hsyl20/ghc/inplace/bin/ghc-stage2" -o processGroup001 processGroup001.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -package unix<
=====> processGroup002(normal) 7666 of 7684 [0, 101, 0]
cd "libraries/unix/tests/processGroup002.run" && "/builds/hsyl20/ghc/inplace/bin/ghc-stage2" -o processGroup002 processGroup002.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -package unix<
cd "libraries/unix/tests/T3816.run" && ./T3816 <
=====> executeFile001(normal) 7667 of 7684 [0, 101, 0]
cd "libraries/unix/tests/executeFile001.run" && "/builds/hsyl20/ghc/inplace/bin/ghc-stage2" -o executeFile001 executeFile001.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=
Job's log exceeded limit of 16384000 bytes.