cabal-file: Cabal file access

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

cabal-file is a small library on top of the 'hackage-security' library for accessing the local Hackage repo index cache, and a command-line tool cblfile which can diff .cabal versions, list package versions, save a cabal file, and show metadata from the index. It uses simple-cabal to display package dependency lists.

[Skip to Readme]


Versions 0.1.0, 0.1.1, 0.1.1
Change log
Dependencies base (<5), bytestring, Cabal (>=2.2), cabal-file, directory, extra, filepath, hackage-security, optparse-applicative, simple-cabal (>0.1), simple-cmd, simple-cmd-args (>=0.1.2), time [details]
License BSD-3-Clause
Copyright 2019-2020 Jens Petersen
Author Jens Petersen
Category Distribution
Source repo head: git clone
Uploaded by JensPetersen at 2020-11-13T16:39:16Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for cabal-file-0.1.1

[back to package description]


cabal-file is a library on top of the hackage-security library for accessing cabal files and versions, and also a small tool for getting and comparing .cabal files.

Since it accesses package and .cabal file data directly from the local Hackage repo cache index tar archive under ~/.cabal/ it is quite fast.


List all Hackage packages:

$ cblfile list | grep ghcide

List versions of a package:

$ cblfile list pandoc

Diff .cabal files of package versions

$ cblfile diff pandoc 2.8
--- pandoc-2.8.cabal    2020-05-24 19:47:58.487921450 +0800
+++ pandoc-        2020-05-24 19:47:58.487921450 +0800
@@ -1,10 +1,10 @@
 name:            pandoc
-version:         2.8
 cabal-version:   2.0

Latest version of a package:

$ cblfile latest extra

Timestamp for the latest .cabal file (or for a specific version):

$ cblfile date dhall
2020-05-19 02:18:01 UTC

Save a .cabal file (latest or specific version)

$ cblfile get purescript
$ ls purescript.cabal

Check package source metadata:

$ cblfile metadata tls-1.5.4
Size: 150171
SHA256 Hash "ce42bfa581a50f62776581da4b86408ebb1a51bc6cb2f95ad0a2ac7caa19a437"

Depends output

cblfile depends outputs quite verbose package dependency lists.


For library documentation see the Hackage.Index documentation.

For example usage see app/Cmds.hs.


I originally wrote the depends command for displaying dependency information about packages in a more friendly way.

Later, since hdiff is out of sync for some packages, and I use it particularly for comparing versions of .cabal files, I decided to create the diff command. Realising I could pull .cabal files direct from the cabal index cache, the rest of cabal-file flowed on from there.

If you want full diffs of Hackage sources you can try out cabal-diff from cabal-extras.