hackage-cli
CLI tool for Hackage
https://github.com/hackage-trustees/hackage-cli
| LTS Haskell 24.16: | 0.1.0.4 |
| Stackage Nightly 2025-10-24: | 0.1.0.4 |
| Latest on Hackage: | 0.1.0.4 |
hackage-cli-0.1.0.4@sha256:8d35ceac4914dca602c49acf0bc69e63f59942e5d76630e972bb3670566b1012,3723Module documentation for 0.1.0.4
There are no documented modules for this package.
hackage-cli
A command-line tool to manage package metadata revisions on Hackage.
Caveat: this is a developer tool and work-in-progress. Check known bugs at the issue tracker.
Command-line reference
hackage-cli - CLI tool for Hackage
Usage: hackage-cli [--version] [--verbose] [--hostname HOSTNAME] COMMAND
Available options:
-h,--help Show this help text
--version output version information and exit
--verbose enable verbose output
--hostname HOSTNAME Hackage hostname (default: "hackage.haskell.org")
Available commands:
pull-cabal download .cabal files for a package
push-cabal upload revised .cabal files
sync-cabal upadate/sync local .cabal file with latest revision
on Hackage
push-candidate upload package candidate(s)
list-versions list versions for a package
check-revision validate revision
index-sha256sum generate sha256sum-format file
add-bound add bound to the library section of a package. .cabal
file is edited in place
Each command has a sub-`--help` text. Hackage credentials are expected to be
stored in an `${HOME}/.netrc`-entry for the respective Hackage hostname. E.g.
"machine hackage.haskell.org login MyUserName password TrustNo1". All
interactions with Hackage occur TLS-encrypted via the HTTPS protocol.
(Section created 2015-04-26, last updated 2018-03-21.)
How to: bulk revision
Suppose that all versions starting with 1.2.3 of the package pkg-x
on hackage need the additional bound < 4.5.6 on their dependency
pkg-y, typically to prevent compilation attempts with pkg-y-4.5.6
and up that will fail.
With hackage-cli this can be done in a typical workflow that consists of
- downloading the
.cabalfiles, - adding bounds (with
hackage-cli), or making other revisions (manually), - re-uploading the modified
.cabalfiles.
We walk through a typical workflow:
-
Download the relevant
pkg-x.cabalfiles to a new temporary directory:$ cd $(mktemp) $ hackage-cli pull-cabal pkg-x '>= 1.2.3' -
Adding bound
pkg-y < 4.5.6to all of them:$ hackage-cli add-bound pkg-y '< 4.5.6' *.cabalThis will write a new line
build-depends: pkg-y < 4.5.6to the
librarysection of each of the.cabalfiles. If files without alibrarysection are encountered (as in ancient.cabalformats), they will be skipped, but the final exitcode ofhackage-cliwill be 1 (error). If a file contains more than onelibrarysection,hackage-cliwill take the first such section. (This might not produce the intended result, so double-checking is advised.)If this bound does not further constrain the existing version range for
pkg-y, it will not be added unless--forceis used. (E.g., one of the cabal files could already have a boundpkg-y < 3.0.0or so—this file will remain unchanged.)You can of course add more bounds using
add-boundor make further manual changes to.cabalfiles. -
Review the changes via a trial upload:
$ hackage-cli push-cabal --incr-rev *.cabal(The flag
--incr-revwill increment thex-revisionfield by1during the upload. Existing revisions cannot be overwritten.)During (trial) upload you will see for each
.cabalfile a summary of what will be changed. Hackage might reject your revision, if it does not match the criteria of what it thinks is legal. Note that the legality check of the Hackage server is neither complete nor sound, so some legal revisions might be rejected, and some illegal ones accepted. You bear the responsibility for correct revisions yourself. -
Upload!
$ hackage-cli push-cabal --incr-rev --publish *.cabalAdding the flag
--publishwill actually commit the revisions to Hackage.
(Section created 2022-02-21.)
License
-
Licensed under GPL-3.
-
(C) 2015 Herbert Valerio Riedel.
-
(C) 2016-2019 Herbert Valerio Riedel and Oleg Grenrus.
-
(C) 2021-2022 Andreas Abel.
-
Further contributors: Simon Jakobi, Kevin Buhr.
(Section created 2022-02-21.)
Changes
Changelog for hackage-cli
0.1.0.4
Andreas Abel, 2025-08-30
- Remove unused dependencies of test-suite
Builds with Cabal 3.4 - 3.16 and GHC 8.2 - 9.14 alpha1.
0.1.0.3
Andreas Abel, 2025-06-04
- Fix for
Cabal-3.14.*.
Builds with Cabal 3.4 - 3.14 and GHC 8.2 - 9.12.
0.1.0.2
Andreas Abel, 2024-07-02
- Allow revision of
stabilityfield (hackage-serverissue #1182). - Print correct revision in
push-cabal --incr-rev(issue #66). - Fix for
Cabal-3.12.0.0.
Builds with Cabal 3.4 - 3.12 and GHC 8.2 - 9.10.
0.1.0.1
Andreas Abel, 2023-02-20
- Fix for
Cabal-3.9.0.0.
Builds with Cabal 3.4 - 3.9 and GHC 8.2 - 9.6.
0.1.0.0
Andreas Abel, 2023-01-15
-
Skip errors when running
add-boundon several files (PR #42). -
If no version range is given for a dependency, interpret it as
-anyrather than none (<0) (PR #48).
Builds with Cabal 3.4 - 3.8 and GHC 8.2 - 9.4.
0.0.3.6
Andreas Abel, 2022-04-30
First release to hackage.
Builds with Cabal 3.4 - 3.6 and GHC 8.2 - 9.2.
Pre-release versions (February 2022)
0.0.3.4
Builds with Cabal-3.4 and GHC 9.0.
0.0.3.2
Builds with Cabal-3.2 and GHC 8.10.
0.0.3.0
Builds with Cabal-3.0 and GHC 8.8.
0.0.2.4
Builds with Cabal-2.4 and GHC 8.6.