Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ jobs:
id: bootstrap-cache
with:
path: "/home/runner/work/cabal/cabal/_build"
key: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc)) }}-${{ github.sha }}
restore-keys: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc)) }}-
# Hash the .cabal files of the local packages into the key too:
# the bootstrap plans only reference local packages by name, so
# without this the caches of branches with different local package
# versions (e.g. master vs a release branch) collide and a stale
# _build/packages.conf gets restored. See #12311.
key: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc), 'Cabal/Cabal.cabal', 'Cabal-syntax/Cabal-syntax.cabal', 'Cabal-hooks/Cabal-hooks.cabal', 'hooks-exe/hooks-exe.cabal', 'cabal-install-solver/cabal-install-solver.cabal', 'cabal-install/cabal-install.cabal') }}-${{ github.sha }}
restore-keys: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc), 'Cabal/Cabal.cabal', 'Cabal-syntax/Cabal-syntax.cabal', 'Cabal-hooks/Cabal-hooks.cabal', 'hooks-exe/hooks-exe.cabal', 'cabal-install-solver/cabal-install-solver.cabal', 'cabal-install/cabal-install.cabal') }}-

- uses: haskell-actions/setup@v2
with:
Expand Down
10 changes: 6 additions & 4 deletions bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ def hash_file(h, f: BinaryIO) -> SHA256Hash:
PlanUnit = NewType('PlanUnit', dict)

def bootstrap(info: BootstrapInfo, ghc: Compiler) -> None:
if not PKG_DB.exists():
print(f'Creating package database {PKG_DB}')
PKG_DB.parent.mkdir(parents=True, exist_ok=True)
subprocess_run([ghc.ghc_pkg_path, 'init', PKG_DB])
if PKG_DB.exists():
print(f'Deleting stale package database {PKG_DB}')
shutil.rmtree(PKG_DB)
print(f'Creating package database {PKG_DB}')
PKG_DB.parent.mkdir(parents=True, exist_ok=True)
subprocess_run([ghc.ghc_pkg_path, 'init', PKG_DB])

for dep in info.builtin:
check_builtin(dep, ghc)
Expand Down
Loading