Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 2.09 KB

README.md

File metadata and controls

61 lines (39 loc) · 2.09 KB

Cabal Project File Parser Test

This repository can be used to

  • Download all repositories of a Stackage snapshot
  • Parse all cabal.project files in the repositories of the snapshot and see whether it succeeds

Prerequisites

  • Python3
  • A local development version of Cabal, you need to clone the repository and reference it via cabal.project.local. You need to reference its packagescabal-install, cabal-install-solver, Cabal-syntax and Cabal

Here is the cabal.project.local I've used:

packages: ./ ../cabal/cabal-install ../cabal/cabal-install-solver ../cabal/Cabal-syntax ../cabal/Cabal

Clone Stackage Snapshot

Usage: clone-stackage-snapshot.py <target_dir>

Where target_dir is the directory to clone the repositories into.

Example: ./clone-stackage-snapshot.py ~/snapshot-stackage

The script will clone all repositories listed in a Stackage snapshot into directory ./snapshot-stackage and log the results into file ./clone.log It is currently hardcoded to download snapshot LTS Haskell 22.33 published on 2024-08-12. Overwrite variable snapshot_url in the script if you want to clone another snapshot.

Note: The script may require git config --global url."https://".insteadOf git:// to work as lots of packages have set git://github.com instead of http://github.com as their source repo urls.

Parse files of projects in a directory

You can parse the project files of all projects in a directory via

cabal run parse-project-files -- <target_dir>

As printing the results to the console takes much time, pipe the outputs into a file. Here is an example to parse all project files in directory ~/snapshot-stackage, piping the output to parse-files.txt:

cabal run parse-project-files -- ~/snapshot-stackage/ >> parse-files.txt

Parse a project file

You can also parse just one project file via

cabal run parse-project-file -- <path-to-dir-containing-the-file>

Example:

cabal run parse-project-file -- ~/snapshot-stackage/aeson