diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b105c58..b91db24 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -6,11 +6,11 @@ # # haskell-ci regenerate # -# For more information, see https://github.com/andreasabel/haskell-ci +# For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20240630 +# version: 0.19.20250506 # -# REGENDATA ("0.19.20240630",["github","hackage-cli.cabal"]) +# REGENDATA ("0.19.20250506",["github","hackage-cli.cabal"]) # name: Haskell-CI on: @@ -23,7 +23,7 @@ on: jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 container: @@ -32,19 +32,24 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.10.1 + - compiler: ghc-9.12.2 compilerKind: ghc - compilerVersion: 9.10.1 + compilerVersion: 9.12.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.8.2 + - compiler: ghc-9.10.2 compilerKind: ghc - compilerVersion: 9.8.2 + compilerVersion: 9.10.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.5 + - compiler: ghc-9.8.4 compilerKind: ghc - compilerVersion: 9.6.5 + compilerVersion: 9.8.4 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.6.7 + compilerKind: ghc + compilerVersion: 9.6.7 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.8 @@ -89,17 +94,30 @@ jobs: allow-failure: false fail-fast: false steps: - - name: apt + - name: apt-get install run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev + apt-get install -y libbrotli-dev + - name: Install GHCup + run: | mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + - name: Install cabal-install + run: | + "$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + - name: Install GHC (GHCup) + if: matrix.setup-method == 'ghcup' + run: | "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - apt-get update - apt-get install -y libbrotli-dev + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -110,21 +128,12 @@ jobs: echo "LANG=C.UTF-8" >> "$GITHUB_ENV" echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCDIR=/opt/$HCKIND/$HCVER - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -240,8 +249,8 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: save cache - uses: actions/cache/save@v4 if: always() + uses: actions/cache/save@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store diff --git a/.github/workflows/stack.yml b/.github/workflows/stack.yml index ccf4aed..b9c19c8 100644 --- a/.github/workflows/stack.yml +++ b/.github/workflows/stack.yml @@ -32,6 +32,7 @@ jobs: defaults: run: shell: bash + steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8f509..65354ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog for hackage-cli +## 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_ diff --git a/cabal.project b/cabal.project index b3fb8ef..312f566 100644 --- a/cabal.project +++ b/cabal.project @@ -1,10 +1,3 @@ packages: . --- with-compiler: ghc-8.2.1 - --- In order to build hackage-cli w/ an unreleased Cabal-2.x (NB: this builds fine w/ GHC 8.2.1 and its bundled Cabal-2.0): --- 1. `cabal get -s Cabal` --- 2. uncomment the 2 lines below (the constraints-line is a hack to avoid `setup`-components picking up the local Cabal package) - --- packages: Cabal/Cabal --- constraints: setup.Cabal < 2 +constraints: HsOpenSSL +use-pkg-config diff --git a/hackage-cli.cabal b/hackage-cli.cabal index 108ab65..d5df8a1 100644 --- a/hackage-cli.cabal +++ b/hackage-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hackage-cli -version: 0.1.0.2 +version: 0.1.0.3 synopsis: CLI tool for Hackage description: @@ -18,9 +18,10 @@ build-type: Simple -- Supported GHC versions when building with cabal: tested-with: -- Keep in descending order. - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 + GHC == 9.12.2 + GHC == 9.10.2 + GHC == 9.8.4 + GHC == 9.6.7 GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 @@ -38,6 +39,7 @@ extra-source-files: fixtures/*.diff fixtures/*.cabal -- Supported GHC versions when building with stack: + stack-9.10.yaml stack-9.8.yaml stack-9.6.yaml @@ -54,7 +56,7 @@ library cabal-revisions build-depends: , base >= 4.10.0.0 && < 5 , bytestring >= 0.10.4.0 && < 0.13 - , Cabal >= 3.4 && < 3.13 + , Cabal >= 3.4 && < 3.15 , containers >= 0.5.0.0 && < 0.8 , mtl >= 2.2.2 && < 2.3 || >= 2.3.1 && < 2.4 , pretty ^>= 1.1.2 @@ -124,7 +126,7 @@ executable hackage-cli , microlens-mtl >= 0.1.11.1 && < 0.3 , microlens-th >= 0.4.1.3 && < 0.5 , netrc ^>= 0.2.0.0 - , optparse-applicative >= 0.14 && < 0.19 + , optparse-applicative >= 0.14 && < 1 , process-extras ^>= 0.7.4 , semigroups >= 0.18.3 && < 0.21 , stringsearch ^>= 0.3.6 diff --git a/src/Main.hs b/src/Main.hs index e154bc0..c4104f1 100755 --- a/src/Main.hs +++ b/src/Main.hs @@ -52,6 +52,9 @@ import qualified Distribution.Text as C #if MIN_VERSION_Cabal(3,7,0) import qualified Distribution.Simple.PackageDescription as C #endif +#if MIN_VERSION_Cabal(3,14,0) +import Distribution.Utils.Path (makeSymbolicPath) +#endif import Lens.Micro import Lens.Micro.Mtl @@ -79,9 +82,9 @@ import qualified Distribution.Types.GenericPackageDescription.Lens as LC -- import Cabal -import Distribution.Server.Util.CabalRevisions -import IndexShaSum -import CabalEdit +import Distribution.Server.Util.CabalRevisions ( diffCabalRevisions, Change(Change) ) +import IndexShaSum ( IndexShaSumOptions(IndexShaSumOptions), run ) +import CabalEdit ( PkgRev, cabalEditXRev ) type PkgName = ByteString type PkgVer = ByteString @@ -623,9 +626,9 @@ main = do mainWithOptions opts mainWithOptions :: Options -> IO () -mainWithOptions Options {..} = do +mainWithOptions Options{ optHost, optCommand } = do case optCommand of - PullCabal (PullCOptions {..}) -> do + PullCabal (PullCOptions{ optPlCPkgName, optPlCIncrRev, optPlCForce, optPlCPkgVers }) -> do let pkgn = optPlCPkgName cs <- runHConn (fetchAllCabalFiles pkgn (fromMaybe C.anyVersion optPlCPkgVers)) @@ -652,8 +655,16 @@ mainWithOptions Options {..} = do return () - SyncCabal (SyncCOptions {..}) -> do - (pkgn,pkgv,xrev) <- pkgDescToPkgIdXrev <$> C.readGenericPackageDescription C.deafening optSyCFile + SyncCabal (SyncCOptions{ optSyCFile, optSyCIncrRev, optSyCForce }) -> do + (pkgn,pkgv,xrev) <- pkgDescToPkgIdXrev <$> + C.readGenericPackageDescription + C.deafening +#if MIN_VERSION_Cabal(3,14,0) + Nothing + (makeSymbolicPath optSyCFile) +#else + optSyCFile +#endif cab0 <- BS.readFile optSyCFile BS8.putStrLn $ mconcat [ "local : " @@ -702,12 +713,12 @@ mainWithOptions Options {..} = do BS.writeFile optSyCFile cab' BS8.putStrLn $ mconcat [ "local : " - , pkgn, "-", pkgv, "-r", BS8.pack (show $ xrev') + , pkgn, "-", pkgv, "-r", BS8.pack (show xrev') , " ('", BS8.pack optSyCFile, "')" ] - ListCabal (ListCOptions {..}) -> do + ListCabal (ListCOptions{ optLCPkgName, optNoAnn, optRevUrls }) -> do let pkgn = optLCPkgName vs <- runHConn (fetchVersions pkgn) @@ -731,12 +742,20 @@ mainWithOptions Options {..} = do BS8.putStrLn $ status <> pkgn <> "-" <> v return () - PushCabal (PushCOptions {..}) -> do + PushCabal (PushCOptions{ optPsCIncrRev, optPsCPublish, optPsCFiles }) -> do (username,password) <- maybe (fail "missing Hackage credentials") return =<< getHackageCreds putStrLn $ "Using Hackage credentials for username " ++ show username forM_ optPsCFiles $ \fn -> do - (pkgn, pkgv, xrev0) <- pkgDescToPkgIdXrev <$> C.readGenericPackageDescription C.deafening fn + (pkgn, pkgv, xrev0) <- pkgDescToPkgIdXrev <$> + C.readGenericPackageDescription + C.deafening +#if MIN_VERSION_Cabal(3,14,0) + Nothing + (makeSymbolicPath fn) +#else + fn +#endif let xrev = applyWhen optPsCIncrRev (+1) xrev0 putStrLn $ concat [ "Pushing ", show fn @@ -754,7 +773,7 @@ mainWithOptions Options {..} = do BS8.putStrLn (tidyHtml tmp) putStrLn (replicate 80 '=') - PushCandidate (PushPCOptions {..}) -> do + PushCandidate (PushPCOptions{ optPPCFiles }) -> do (username,password) <- maybe (fail "missing Hackage credentials") return =<< getHackageCreds putStrLn $ "Using Hackage credentials for username " ++ show username @@ -770,7 +789,7 @@ mainWithOptions Options {..} = do putStrLn (replicate 80 '=') - CheckRevision (CheckROptions {..}) -> do + CheckRevision (CheckROptions{ optCRNew, optCROrig }) -> do old <- BS.readFile optCROrig new <- BS.readFile optCRNew diff --git a/stack-9.10.yaml b/stack-9.10.yaml index f782054..1f5707a 100644 --- a/stack-9.10.yaml +++ b/stack-9.10.yaml @@ -1,23 +1,7 @@ -resolver: nightly-2024-07-01 -compiler: ghc-9.10.1 +resolver: nightly-2025-05-28 +compiler: ghc-9.10.2 compiler-check: match-exact -# Libraries shipped with GHC 9.10.1: -extra-deps: -- Cabal-3.12.0.0 -- Cabal-syntax-3.12.0.0 -- directory-1.3.8.3 -- filepath-1.5.2.0 -- process-1.6.19.0 -- unix-2.8.5.1 -# For Windows: -- Win32-2.14.0.0 -- time-1.12.2 - flags: - directory: - os-string: true - unix: - os-string: true - Win32: - os-string: true + HsOpenSSL: + use-pkg-config: true diff --git a/stack-9.6.yaml b/stack-9.6.yaml index 5ed2ee4..445a8f1 100644 --- a/stack-9.6.yaml +++ b/stack-9.6.yaml @@ -1 +1,5 @@ -resolver: lts-22.27 +resolver: lts-22.44 + +flags: + HsOpenSSL: + use-pkg-config: true diff --git a/stack-9.8.yaml b/stack-9.8.yaml index b2a6c8e..904dcb7 100644 --- a/stack-9.8.yaml +++ b/stack-9.8.yaml @@ -1 +1,5 @@ -resolver: nightly-2024-07-01 +resolver: lts-23.24 + +flags: + HsOpenSSL: + use-pkg-config: true