Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #66: print correct revision in push-cabal --incr-rev #70

Merged
merged 2 commits into from
Jan 26, 2024
Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc-ver: [9.8.1, 9.6.4, 9.4.8, 9.2.8, 9.0.2, 8.10.7]
ghc-ver: [9.8.1, 9.6.4]
# 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.
# Apparently, HsOpenSSL-0.11.6 and older are too old for ubuntu-22.04.
include:
- os: macos-latest
ghc-ver: 9.6.4
ghc-ver: 9.8.1
- os: windows-latest
ghc-ver: 9.6.4
ghc-ver: 9.8.1
env:
ARGS: "--stack-yaml=stack-${{ matrix.ghc-ver }}.yaml --no-terminal --system-ghc"

Expand Down
4 changes: 3 additions & 1 deletion hackage-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ executable hackage-cli
, mtl

build-depends:
, aeson >= 1.2.4.0 && < 2.3
, aeson >= 1.2.4.0 && < 2.3
-- aeson-1.2.4.0 for stack-8.2.2.yaml
, 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
Expand Down
15 changes: 8 additions & 7 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Search as BSS
import Data.Char (isSpace)
import Data.Foldable (toList)
import Data.Function.Compat (applyWhen)
import qualified Data.List as List
import Data.Maybe
import Data.Time.Clock.POSIX (getPOSIXTime)
Expand Down Expand Up @@ -735,18 +736,18 @@ mainWithOptions Options {..} = do
putStrLn $ "Using Hackage credentials for username " ++ show username

forM_ optPsCFiles $ \fn -> do
(pkgn,pkgv,xrev) <- pkgDescToPkgIdXrev <$> C.readGenericPackageDescription C.deafening fn
(pkgn, pkgv, xrev0) <- pkgDescToPkgIdXrev <$> C.readGenericPackageDescription C.deafening fn
let xrev = applyWhen optPsCIncrRev (+1) xrev0

putStrLn $ concat [ "Pushing ", show fn
, " (", BS8.unpack pkgn, "-", BS8.unpack pkgv, "~", show xrev, ")"
, if not optPsCPublish then " [review-mode]" else "", " ..."
]

let editCab | optPsCIncrRev = cabalEditXRev (xrev+1)
| otherwise = id

rawcab <- editCab <$> BS.readFile fn
(dt,tmp) <- timeIt $ runHConn (hackagePostCabal (username,password) (pkgn,pkgv) rawcab
(if optPsCPublish then WetRun else DryRun))
rawcab <- applyWhen optPsCIncrRev (cabalEditXRev xrev) <$> BS.readFile fn
(dt, tmp) <- timeIt $ runHConn $
hackagePostCabal (username, password) (pkgn, pkgv) rawcab $
if optPsCPublish then WetRun else DryRun

printf "Hackage response was (after %.3f secs):\n" dt
putStrLn (replicate 80 '=')
Expand Down
Loading