packages feed

debian-build 0.1.0.1 → 0.2.0.0

raw patch · 3 files changed

+52/−35 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Debian.Package.Build.Sequence: cabalAutogenSources :: String -> Build ((FilePath, FilePath), HaskellPackage)
+ Debian.Package.Build.Sequence: cabalAutogenSources :: String -> Maybe String -> Build ((FilePath, FilePath), HaskellPackage)
- Debian.Package.Build.Sequence: genSources :: Build (Maybe ((FilePath, FilePath), Source, Maybe Hackage))
+ Debian.Package.Build.Sequence: genSources :: Maybe String -> Build (Maybe ((FilePath, FilePath), Source, Maybe Hackage))

Files

debian-build.cabal view
@@ -1,5 +1,5 @@ name:                debian-build-version:             0.1.0.1+version:             0.2.0.0 synopsis:            Debian package build sequence tools description:         This package provides functions to build                      debian package from source tree.
mains/odebuild.hs view
@@ -1,5 +1,6 @@ import System.Environment (getProgName, getArgs) import Control.Monad (void)+import Data.List (stripPrefix)  import Debian.Package.Data (Source, Hackage) import Debian.Package.Build@@ -20,51 +21,67 @@ help :: IO () help =  do   prog <- getProgName-  let opts = "<debuild options>"+  let rev  = "[--revision=<debian revision>]"+      opts = "[debuild options]"   putStr . unlines $ map unwords     [[prog, "clean"],-     [prog, "source"],-     [prog, "build", opts],-     [prog, "install", opts],-     [prog, "reinstall", opts, "  -- Remove and install support only for Haskell"] ]+     [prog, "source", rev],+     [prog, "build", rev, opts],+     [prog, "install", rev, opts],+     [prog, "reinstall", rev, opts],+     ["-- reinstall (Remove and install) support only for Haskell"],+     ["-- Revision string may use on auto-generating debian directory."]]  clean :: Build () clean =  removeBuildDir -source :: Build ((FilePath, FilePath), Source, Maybe Hackage)-source =  do+source :: Maybe String -> Build ((FilePath, FilePath), Source, Maybe Hackage)+source mayRev = do   clean-  maybe (fail "Illegal state: genSources") return =<< genSources+  maybe (fail "Illegal state: genSources") return =<< genSources mayRev -build :: [String] -> Build (Source, Maybe Hackage)-build opts = do-  ((_, dir), src, mayH) <- source+build :: Maybe String -> [String] -> Build (Source, Maybe Hackage)+build mayRev opts = do+  ((_, dir), src, mayH) <- source mayRev   liftTrace $ buildPackage dir All opts   return (src, mayH) -install :: [String] -> Build ()-install args = do-  (src, _mayH) <- build args+install :: Maybe String -> [String] -> Build ()+install mayRev args = do+  (src, _mayH) <- build mayRev args   install' src -reinstall :: [String] -> Build ()-reinstall args = do-  (src, mayH) <- build args+reinstall :: Maybe String -> [String] -> Build ()+reinstall mayRev args = do+  (src, mayH) <- build mayRev args   maybe (return ()) remove' mayH   install' src  run :: Build a -> IO a run b = uncurry (runBuild b baseDirCurrent) defaultConfig +parseArgs :: [String] -> (Maybe String, [String])+parseArgs =  d where+  d aas@(a:as) = case stripPrefix "--revision=" a of+    r@(Just _)  ->  (r, as)+    Nothing     ->  (Nothing, aas)+  d []         =    (Nothing, [])+ main :: IO () main =  do   as0 <- getArgs   case as0 of-    "help" : _            ->  help-    as1  ->  run $ case  as1  of-      "clean" : _         ->  clean-      "source" : _        ->  void $ source-      "build" : args      ->  void $ build args-      "install" : args    ->  install args-      "reinstall" : args  ->  reinstall args-      args                ->  void $ build args+    "-h"     : _          ->  help+    "--help" : _          ->  help+    "help"   : _          ->  help+    as2@(c : as1)  ->  do+      let (mayRev, args) = parseArgs as1+      run $ case c of+        "clean"         ->    clean+        "source"        ->    void $ source mayRev+        "build"         ->    void $ build mayRev args+        "install"       ->    install mayRev args+        "reinstall"     ->    reinstall mayRev args+        _               ->    void . uncurry build $ parseArgs as2++    []                  -> run . void $ build Nothing []
src/Debian/Package/Build/Sequence.hs view
@@ -198,8 +198,8 @@   copyDebianDir srcDir   return pair -cabalAutogenDebianDir :: Build FilePath-cabalAutogenDebianDir = do+cabalAutogenDebianDir :: Maybe String -> Build FilePath+cabalAutogenDebianDir mayRev =  do   baseDir  <-  getBaseDir   let ddName =  "debian"       tmpDD  =  baseDir </> ddName@@ -208,15 +208,15 @@    debDir   <-  (</> ddName) <$> getBuildDir   liftTrace $ do-    cabalDebian baseDir Nothing+    cabalDebian baseDir mayRev     createDirectoryIfMissing $ takeDirectory debDir     renameDirectory tmpDD debDir   return debDir  -- | Setup source directory and archive using Cabal and cabal-debian.-cabalAutogenSources :: String -> Build ((FilePath, FilePath), HaskellPackage)-cabalAutogenSources hname = do-  debDir   <-  cabalAutogenDebianDir+cabalAutogenSources :: String -> Maybe String -> Build ((FilePath, FilePath), HaskellPackage)+cabalAutogenSources hname mayRev = do+  debDir   <-  cabalAutogenDebianDir mayRev   pkg      <-  liftTrace . dpkgParseChangeLog $ debDir </> "changelog"   hpkg     <-  either fail return $ haskellPackageFromPackage hname pkg   pair@(_, srcDir)  <-  cabalGenOrigSources hpkg@@ -239,8 +239,8 @@ findCabalDescription =  MaybeT (getBaseDir >>= liftIO . Cabal.findDescriptionFile)  -- | On the fly setup of source directory and archive.-genSources :: Build (Maybe ((FilePath, FilePath), Source, Maybe Hackage))-genSources =  runMaybeT $+genSources :: Maybe String -> Build (Maybe ((FilePath, FilePath), Source, Maybe Hackage))+genSources mayRev = runMaybeT $   do clog <- findDebianChangeLog      src  <- lift . liftTrace $ dpkgParseChangeLog clog      (do hname <- takeBaseName <$> findCabalDescription@@ -252,7 +252,7 @@   <|>   do hname <- takeBaseName <$> findCabalDescription      lift $ do-       (p, hpkg) <- cabalAutogenSources hname+       (p, hpkg) <- cabalAutogenSources hname mayRev        return (p, package hpkg, Just $ hackage hpkg)   <|>   do fail "No source generate rule found."