diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index e9732cc..20e692a 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -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 @@ -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 <> 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 diff --git a/.github/workflows/stack.yml b/.github/workflows/stack.yml index 5f3824b..166e848 100644 --- a/.github/workflows/stack.yml +++ b/.github/workflows/stack.yml @@ -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. diff --git a/CHANGELOG.md b/CHANGELOG.md index 697b37d..b16ec6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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_ diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 1977761..5bd00b8 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -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 \ No newline at end of file diff --git a/hackage-cli.cabal b/hackage-cli.cabal index 8a54ff3..7cdefb7 100644 --- a/hackage-cli.cabal +++ b/hackage-cli.cabal @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/Main.hs b/src/Main.hs index 080dacf..15481e5 100755 --- a/src/Main.hs +++ b/src/Main.hs @@ -81,6 +81,7 @@ import qualified Distribution.Types.GenericPackageDescription.Lens as LC -- import Cabal +import Distribution.Client.Add import Distribution.Server.Util.CabalRevisions ( diffCabalRevisions, Change(Change) ) import IndexShaSum ( IndexShaSumOptions(IndexShaSumOptions), run ) import CabalEdit ( PkgRev, cabalEditXRev ) @@ -441,7 +442,6 @@ data AddBoundOptions' a = AddBoundOptions { 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) @@ -512,7 +512,6 @@ optionsParserInfo 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 @@ -814,29 +813,21 @@ condTreeDataL f (C.CondNode x c cs) = f x <&> \y -> C.CondNode y c cs -- 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 diff --git a/stack-9.10.yaml b/stack-9.10.yaml index 4e91797..33f63df 100644 --- a/stack-9.10.yaml +++ b/stack-9.10.yaml @@ -1,6 +1,4 @@ -resolver: lts-24.37 -compiler: ghc-9.10.2 -compiler-check: match-exact +resolver: lts-24.55 flags: HsOpenSSL: diff --git a/stack-9.12.yaml b/stack-9.12.yaml index 784741a..b54ef5a 100644 --- a/stack-9.12.yaml +++ b/stack-9.12.yaml @@ -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: