Skip to content

Write pantry hashes into a .lock file instead of emitting warnings #4288

@sol

Description

@sol

Currently stack build will emit warnings if I do not specify size and sha256 for github dependencies in stack.yaml.

Running stack freeze will output the relevant information that I then can add to stack.yaml manually.

I propose to write the information that is currently produced by stack freeze to a .lock file after every successful build (e.g. pantry.lock):

  • when the .lock file exists then for each listed dependency:
    • stack uses the information as if it were directly listed in stack.yaml; specifically it errors out on any hash mismatches
    • when stack detects that a dependency was updated in stack.yaml it silently ignores the information from the .lock file
  • after a successful build stack creates the .lock file, overwriting any existing versions (which in effect means that we remove unused entries and add missing entries)

Regarding revision control, we can follow conventions that have been developed elsewhere:
When developing an application, the .lock file should be checked into revision control. When developing a library, the .lock file should be added to .gitignore.

A word on naming: If we expect the .lock file to be specific to stack we may want to name it stack.lock (or possibly .stack.lock to not interfere with file name completion); if on the other hand we think that it will be relevant for other build tools that implement support for pantry then we could name it pantry.lock.

Assuming we adopt this approach we can:

  • remove any warnings related to pantry hashes
  • remove the stack freeze command

CC @snoyberg

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions