arch-hs 0.12.1 → 0.12.2
raw patch · 4 files changed
+25/−6 lines, 4 filesdep +http-typesPVP ok
version bump matches the API change (PVP)
Dependencies added: http-types
API changes (from Hackage documentation)
+ Distribution.ArchHs.Exception: HackageUploadFailed :: Int -> String -> MyException
Files
- CHANGELOG.md +8/−0
- arch-hs.cabal +4/−3
- src/Distribution/ArchHs/Exception.hs +5/−0
- sync/Submit.hs +8/−3
CHANGELOG.md view
@@ -3,6 +3,14 @@ `arch-hs` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 0.12.2++- Fail `arch-hs-sync submit` when Hackage returns an unsuccessful upload status++- Allow algebraic-graphs 0.8++- Fix bounds for Diff+ ## 0.12.1 - Use license id from arch-web 0.3.2
arch-hs.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: arch-hs-version: 0.12.1+version: 0.12.2 synopsis: Distribute hackage packages to archlinux description: @arch-hs@ is a command-line program, which simplifies the process of producing@@ -37,7 +37,7 @@ common common-options build-depends: , aeson >=1.5.4 && <2.3- , algebraic-graphs >=0.5 && <0.8+ , algebraic-graphs >=0.5 && <0.9 , arch-web ^>=0.3.2 , base >=4.12 && <5 , bytestring@@ -46,12 +46,13 @@ , conduit-extra ^>=1.3.5 , containers , deepseq ^>=1.4.4 || ^>=1.5.0- , Diff ^>=0.4.0 || ^>=0.5.0+ , Diff ^>=0.4.0 || ^>=0.5 , directory ^>=1.3.6 , filepath ^>=1.4.2 , hackage-db ^>=2.1.0 , http-client , http-client-tls+ , http-types , megaparsec ^>=9.0.0 || ^>=9.1.0 || ^>=9.2.0 || ^>=9.3.0 || ^>=9.4.0 || ^>=9.5.0 || ^>=9.6.0 || ^>=9.7.0 , microlens ^>=0.4.11 , microlens-th ^>=0.4.3
src/Distribution/ArchHs/Exception.hs view
@@ -37,6 +37,7 @@ | TargetExist PackageName DependencyProvider | CyclicExist [PackageName] | NetworkException ClientError+ | HackageUploadFailed Int String | VersionNoParse String instance Show MyException where@@ -45,6 +46,10 @@ show (TargetExist name provider) = "Target \"" <> unPackageName name <> "\" has been provided by " <> show provider show (CyclicExist c) = "Graph contains a cycle \"" <> show (fmap unPackageName c) <> "\"" show (NetworkException e) = show e+ show (HackageUploadFailed status message) =+ "Hackage upload failed with HTTP status "+ <> show status+ <> if null message then "" else " " <> message show (VersionNoParse v) = "String \"" <> v <> "\" can not be parsed to Cabal version" -- | Catch 'CE.IOException' and print it.
sync/Submit.hs view
@@ -18,6 +18,7 @@ import Distribution.ArchHs.Utils import Distribution.Package (packageName) import Network.HTTP.Client+import Network.HTTP.Types.Status (statusCode, statusIsSuccessful, statusMessage) import Submit.CSV import Utils @@ -48,8 +49,8 @@ writeFile output v check csv manager <- ask- interceptHttpException $- when ((not . null) token && upload) $ do+ when ((not . null) token && upload) $ do+ status <- interceptHttpException $ do printInfo "Uploading..." initialRequest <- parseRequest "https://hackage.haskell.org/distro/Arch/packages" let req =@@ -62,9 +63,13 @@ ] } result <- httpLbs req manager- printInfo $ "Status" <> colon <+> viaShow (responseStatus result)+ let status = responseStatus result+ printInfo $ "Status" <> colon <+> viaShow status printInfo "ResponseBody:" printInfo . pretty . decodeUtf8 . LBS.toStrict $ responseBody result+ pure status+ unless (statusIsSuccessful status) $+ throw . HackageUploadFailed (statusCode status) . BS.unpack $ statusMessage status -- | Download Distro CSV from Hackage and print differences from @extra@ check :: Members [HackageEnv, WithMyErr, Reader Manager, Embed IO] r => DistroCSV -> Sem r ()