hackage-whatsnew 0.1.0.1 → 0.1.0.2
raw patch · 2 files changed
+26/−10 lines, 2 filesdep ~Cabaldep ~directorydep ~filepath
Dependency ranges changed: Cabal, directory, filepath, hackage-db, process
Files
- Main.hs +19/−3
- hackage-whatsnew.cabal +7/−7
Main.hs view
@@ -1,8 +1,12 @@+{-# language CPP #-} module Main where import qualified Data.Map as Map import Distribution.Hackage.DB.Parsed-import Distribution.Package (PackageName(..), PackageIdentifier(PackageIdentifier, pkgName, pkgVersion))+#if MIN_VERSION_hackage_db(2,0,0)+import Distribution.Hackage.DB.Path+#endif+import Distribution.Package (PackageName, PackageIdentifier(PackageIdentifier, pkgName, pkgVersion), unPackageName) import Distribution.PackageDescription (GenericPackageDescription(packageDescription), PackageDescription(package)) import Distribution.PackageDescription.Parse (readPackageDescription) import Distribution.Simple.Utils (defaultPackageDesc)@@ -21,18 +25,30 @@ local v = fmap packageDescription (readPackageDescription v =<< defaultPackageDesc v) +#if MIN_VERSION_hackage_db(2,0,0)+readHackage = hackageTarball >>= readTarball Nothing+#endif+ -- | get the package description from hackage -- -- This gets the latest version available. hackage :: PackageName -- ^ the package name -> IO (Maybe PackageDescription)-hackage (PackageName pn) = do+hackage pn = do hackage <- readHackage+#if MIN_VERSION_hackage_db(2,0,0) case Map.lookup pn hackage of+#else+ case Map.lookup (unPackageName pn) hackage of+#endif Nothing -> return Nothing (Just gpdMap) ->+#if MIN_VERSION_hackage_db(2,0,0)+ return $ Just $ packageDescription (cabalFile $ snd $ head $ Map.toDescList gpdMap)+#else return $ Just $ packageDescription (snd $ head $ Map.toDescList gpdMap)+#endif -- | calculate the directory to the tarball for `PackageIndentifier` packageDir :: FilePath -> PackageIdentifier -> FilePath@@ -49,7 +65,7 @@ -- returns path to downloaded `.tar.gz` fetchFromHackage :: PackageIdentifier -> IO FilePath-fetchFromHackage pi@(PackageIdentifier (PackageName pn) version) = do+fetchFromHackage pi@(PackageIdentifier _ version) = do (ec, out, err) <- readProcessWithExitCode "cabal" ["fetch", "--no-dependencies", display pi] "" case ec of ExitSuccess -> do
hackage-whatsnew.cabal view
@@ -1,5 +1,5 @@ name: hackage-whatsnew-version: 0.1.0.1+version: 0.1.0.2 synopsis: Check for differences between working directory and hackage description: This tool checks to see if the package in a local working directory has changes which are not yet on hackage. This is useful to check if@@ -12,7 +12,7 @@ homepage: https://github.com/stepcut/hackage-whatsnew build-type: Simple cabal-version: >=1.10-tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2 extra-source-files: README.md source-repository head@@ -22,11 +22,11 @@ executable hackage-whatsnew main-is: Main.hs build-depends: base >=4.6 && < 5.0,- Cabal >= 1.16 && < 1.25,+ Cabal >= 1.16 && < 2.1, containers >=0.5 && <0.6,- directory >= 1.2 && < 1.3,- filepath >= 1.4 && < 1.5,- hackage-db >= 1.22 && < 1.23,- process >= 1.2 && < 1.5,+ directory >= 1.2 && < 1.4,+ filepath >= 1.3 && < 1.5,+ hackage-db >= 1.22 && < 2.1,+ process >= 1.1 && < 1.7, temporary >= 1.2 && < 1.3 default-language: Haskell2010