Skip to content
Open
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
16 changes: 3 additions & 13 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ jobs:
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt-get install
Expand Down Expand Up @@ -194,13 +184,13 @@ jobs:
echo "packages: ${PKGDIR_hackage_cli}" >> cabal.project
echo "package hackage-cli" >> cabal.project
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package hackage-cli" >> cabal.project ; fi
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
echo "package hackage-cli" >> cabal.project
echo " ghc-options: -Werror=unused-packages" >> cabal.project
echo "package hackage-cli" >> cabal.project
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(hackage-cli)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(directory|hackage-cli|process|time)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest,macos-latest,windows-latest]
ghc-ver: ['9.12', '9.10', '9.8', '9.6']
ghc-ver: ['9.12', '9.10']
# Shapshots for '9.8' and '9.6' do not have cabal-add.
# Snapshots for 9.4.8, 9.2.8, 9.0.2, 8.10.7 do not have a recent enough base-compat; 0.13 is needed.
# On ubuntu-22.04 the old versions 8.8.4, 8.6.5, 8.4.4, 8.2.2 fail due to HsOpenSSL linking errors.
# They used to work under ubuntu-20.04, but it is not worth the trouble maintaining them.
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog for hackage-cli

## 0.3.0.0

_Andreas Abel, 2026-08-23_

- Remove `--message` option from `add-bound` command and make it work with `common` stanzas
(Bodigrim, PR [#76](https://github.com/hackage-trustees/hackage-cli/pull/76)).
- Dropped support for GHC < 9.4.8.

Builds with `Cabal 3.8 - 3.16` and `GHC 9.4.8 - 9.14.1`.

## 0.2.0.0

_Andreas Abel, 2026-04-18_
Expand Down
2 changes: 1 addition & 1 deletion cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ branches: master
-- By default `installed` constraints are used for packages
-- in global db. We can modify which constraints are used.
-- 2026-04-18: For building with GHC 8, we'd need to unconstrain Cabal:
-- installed: +all -binary -Cabal
installed: +all -directory -process -time

apt: libbrotli-dev
58 changes: 24 additions & 34 deletions hackage-cli.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cabal-version: 2.4
name: hackage-cli
version: 0.2.0.0
x-revision: 1
version: 0.3.0.0

synopsis: CLI tool for Hackage
description:
Expand All @@ -25,14 +24,6 @@ tested-with:
GHC == 9.8.4
GHC == 9.6.7
GHC == 9.4.8
GHC == 9.2.8
GHC == 9.0.2
-- -- 2026-04-18: Stop testing GHC 8 on CI
-- GHC == 8.10.7
-- GHC == 8.8.4
-- GHC == 8.6.5
-- GHC == 8.4.4
-- GHC == 8.2.2

extra-doc-files:
CHANGELOG.md
Expand All @@ -44,8 +35,6 @@ extra-source-files:
-- Supported GHC versions when building with stack:
stack-9.12.yaml
stack-9.10.yaml
stack-9.8.yaml
stack-9.6.yaml

source-repository head
Type: git
Expand All @@ -57,13 +46,14 @@ library cabal-revisions
hs-source-dirs: lib
ghc-options: -Wall -Wcompat

-- lower bounds from lts-21.25 (GHC 9.4.8)
build-depends:
, base >= 4.10.0.0 && < 5
, bytestring >= 0.10.4.0 && < 0.13
, Cabal >= 3.4 && < 3.17
, containers >= 0.5.0.0 && < 1
, base >= 4.17.2.1 && < 5
, bytestring >= 0.11.5.3 && < 0.13
, Cabal >= 3.8.1.0 && < 3.17
, containers >= 0.6.7 && < 1
, mtl >= 2.2.2 && < 2.3 || >= 2.3.1 && < 2.4
, pretty ^>= 1.1.2
, pretty ^>= 1.1.3.6

exposed-modules:
Distribution.Server.Util.CabalRevisions
Expand All @@ -79,10 +69,10 @@ test-suite cabal-revisions-tests
, bytestring
, Cabal
, cabal-revisions
, tasty >= 1.0 && < 1.6
, tasty >= 1.4.3 && < 1.6
-- tasty-1.0 for stack-8.2.2.yaml
, tasty-golden ^>= 2.3.2
, filepath >= 1.4.0.0 && < 1.6
, filepath >= 1.4.2.2 && < 1.6

executable hackage-cli
default-language: Haskell2010
Expand Down Expand Up @@ -117,26 +107,26 @@ executable hackage-cli
, mtl

build-depends:
, aeson >= 1.2.4.0 && < 2.4
-- aeson-1.2.4.0 for stack-8.2.2.yaml
, aeson >= 2.1.2.1 && < 2.4
, base-compat >= 0.13.0 && < 1
-- base-compat for applyWhen (added to base in 4.18)
, deepseq ^>= 1.4.0.0 || ^>= 1.5.0.0
, directory ^>= 1.2.0.1 || ^>= 1.3.0.0
, filepath >= 1.4.0.0 && < 2
, http-io-streams ^>= 0.1.0.0
, io-streams ^>= 1.5.0.1
, microlens >= 0.4.8.3 && < 4.13
, microlens-mtl >= 0.1.11.1 && < 0.3
, microlens-th >= 0.4.1.3 && < 0.5
, cabal-add >= 0.2 && < 0.3
, deepseq >= 1.4.8.0 && < 1.6
, directory >= 1.3.7.1 && < 1.4
, filepath >= 1.4.2.2 && < 2
, http-io-streams >= 0.1.6.3 && < 0.2
, io-streams >= 1.5.2.2 && < 1.6
, microlens >= 0.4.13.1 && < 0.6
, microlens-mtl >= 0.2.0.3 && < 0.3
, microlens-th >= 0.4.3.14 && < 0.5
, netrc ^>= 0.2.0.0
, optparse-applicative >= 0.14 && < 1
, optparse-applicative >= 0.17.1.0 && < 1
, process-extras ^>= 0.7.4
, stringsearch ^>= 0.3.6
, tagsoup ^>= 0.14
, tar >= 0.5 && < 1
, text >= 1.2 && < 2.2
, time >= 1.5.0.1 && < 2
, zlib >= 0.6.1 && < 0.8
, tar >= 0.5.1.1 && < 1
, text >= 2.0.2 && < 2.2
, time >= 1.12.2 && < 2
, zlib >= 0.6.3.0 && < 0.8

ghc-options: -Wall -Wcompat -threaded
33 changes: 12 additions & 21 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@

-- import Cabal

import Distribution.Client.Add
import Distribution.Server.Util.CabalRevisions ( diffCabalRevisions, Change(Change) )
import IndexShaSum ( IndexShaSumOptions(IndexShaSumOptions), run )
import CabalEdit ( PkgRev, cabalEditXRev )
Expand Down Expand Up @@ -388,7 +389,7 @@
-- if any.
--
findLibrarySection :: [C.Field C.Position] -> Maybe (Int, Int)
findLibrarySection [] = Nothing

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (windows-latest, 9.12)

Defined but not used: `findLibrarySection'

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (windows-latest, 9.12)

Defined but not used: `findLibrarySection'

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (ubuntu-latest, 9.10)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (ubuntu-latest, 9.10)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (macos-latest, 9.10)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (macos-latest, 9.10)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (macos-latest, 9.12)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (macos-latest, 9.12)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (ubuntu-latest, 9.12)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (ubuntu-latest, 9.12)

Defined but not used: ‘findLibrarySection’

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (windows-latest, 9.10)

Defined but not used: `findLibrarySection'

Check warning on line 392 in src/Main.hs

View workflow job for this annotation

GitHub Actions / check (windows-latest, 9.10)

Defined but not used: `findLibrarySection'
findLibrarySection (C.Section (C.Name (C.Position row _) "library") [] fs : _) =
Just (row, findIndent fs)
where
Expand Down Expand Up @@ -441,7 +442,6 @@
{ optABPackageName :: C.PackageName
, optABVersionRange :: C.VersionRange
, optForce :: Bool -- ^ Disable the check whether bound is subsumed by existing constraints.
, optABMessage :: [String]
, optABFiles :: a -- ^ One or several files.
} deriving (Show, Functor)

Expand Down Expand Up @@ -512,7 +512,6 @@
addboundParser = AddBound <$> (AddBoundOptions <$> OA.argument prsc (metavar "DEPENDENCY")
<*> OA.argument prsc (metavar "VERSIONRANGE")
<*> OA.switch (long "force" <> help "Add bound even if it is already subsumed by existing constraints.")
<*> many (OA.option str (OA.short 'm' <> OA.long "message" <> metavar "MSG" <> help "Use given MSG as a comment. If multiple -m options are given, their values are concatenated with 'unlines'."))
<*> some (OA.argument str (metavar "CABALFILES..." <> action "file")))

oParser
Expand Down Expand Up @@ -814,29 +813,21 @@
-- Non-fatal errors (like parse errors) are reported in the Except monad.
--
addBound :: AddBoundOptions' FilePath -> ExceptT String IO ()
addBound AddBoundOptions{ optABPackageName, optABVersionRange, optForce, optABMessage, optABFiles = fp } = do
addBound AddBoundOptions{ optABPackageName, optABVersionRange, optForce, optABFiles = fp } = do

old <- liftIO $ BS.readFile fp

-- idea is simple:
-- - .cabal is line oriented file
-- - find "library" section start
-- - bonus: look of an indentation used from the next field/section there
-- - insert data into a bytestring "manually"
fs <- either (\ err -> throwError $ unwords ["Parsing", fp, "failed:", show err]) return $
C.readFields old
(lin, indent) <- maybe
(throwError $ "Cannot find library section in " ++ fp)
return
(findLibrarySection fs)

let msgLines = map ("-- " ++) optABMessage
bdLine = "build-depends: " ++ C.prettyShow optABPackageName ++ " " ++ C.prettyShow optABVersionRange
midLines = [ BS8.pack $ replicate indent ' ' ++ l
| l <- msgLines ++ [bdLine]
] ++ [""] -- also add an empty line separator
(preLines, postLines) = splitAt lin $ BS8.lines old
new = BS8.unlines (preLines ++ midLines ++ postLines)
let addConfig = AddConfig
{ cnfOrigContents = old
, cnfFields = fs
, cnfComponent = Right (C.CLibName C.LMainLibName)
, cnfTargetField = BuildDepends
, cnfAdditions = pure $ BS8.pack $ C.prettyShow optABPackageName ++ " " ++ C.prettyShow optABVersionRange
}
new <- case executeAddConfig (\_ _ -> True) addConfig of
Just x -> pure x
Nothing -> throwError $ "Cannot find library section in " ++ fp

-- interpretation of version ranges
let oldGpd = parseGenericPackageDescription' old
Expand Down
4 changes: 1 addition & 3 deletions stack-9.10.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
resolver: lts-24.37
compiler: ghc-9.10.2
compiler-check: match-exact
resolver: lts-24.55

flags:
HsOpenSSL:
Expand Down
4 changes: 1 addition & 3 deletions stack-9.12.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
resolver: nightly-2026-04-15
compiler: ghc-9.12.2
compiler-check: match-exact
resolver: nightly-2026-08-16

flags:
HsOpenSSL:
Expand Down