lxc 0.3.1.1 → 0.3.2
raw patch · 5 files changed
+49/−45 lines, 5 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +25/−20
- README.md +4/−9
- lxc.cabal +2/−2
- src/System/LXC/Internal/AttachOptions.hs +2/−1
- src/System/LXC/Internal/Container.hs +16/−13
CHANGELOG.md view
@@ -1,34 +1,39 @@+0.3.2+---+* Relax upper bound for `base`+* Fix warnings+ 0.3.1.1 ----* loose `mtl` and `transformers` dependencies for `lxc` to play nice with other libraries+* Loose `mtl` and `transformers` dependencies for `lxc` to play nice with other libraries 0.3.1 ----* added `snapshotDestroy` to `System.LXC.Container`-* minor documentation improvements+* Add `snapshotDestroy` to `System.LXC.Container`+* Improve documentation slightly 0.3 ----* introduced `LXC` monad-* `transformers` and `mtl` added to dependencies-* convert container-related functions to use `LXC` monad-* `listContainers` functions now return `[Container]` instead of `[(String, Ptr C'lxc_container)]`-* removed `mkContainer` function-* remove `getRef` and `dropRef` from `System.LXC.Container`-* `Container` is now pure Haskell data structure-* added `examples/`-* `Internal` gains `C'lxc_container` marshalling helpers (e.g. `withC'lxc_container`)-* fixed potential segfaults in `snapshotList` and `list*Containers`+* Introduce `LXC` monad+* Add `transformers` and `mtl` dependencies+* Change container-related functions to use `LXC` monad+* Change `listContainers` functions to return `[Container]` instead of `[(String, Ptr C'lxc_container)]`+* Remove `mkContainer` function+* Remove `getRef` and `dropRef` from `System.LXC.Container`+* Make `Container` a pure Haskell data structure+* Add `examples/`+* Add `C'lxc_container` marshalling helpers (e.g. `withC'lxc_container`) to `Internal`+* Fix potential segfaults in `snapshotList` and `list*Containers` 0.2 ----* LXC errors through `getLastError` function-* `getDaemonize` function-* `start` function fixed (and changed type)-* `Show` instance for `BDevSpecs`-* updated documentation (haddock and README)+* Handle LXC errors through `getLastError` function+* Add `getDaemonize` function+* Fix `start` function (and changed type)+* Add `Show` instance for `BDevSpecs`+* Update documentation (haddock and README) 0.1.1 ----* fixed package (`bindings-lxc` dependency)-* exposed `System.LXC.Internal.AttachOptions` module+* Fix `bindings-lxc` dependency+* Expose `System.LXC.Internal.AttachOptions` module
README.md view
@@ -1,24 +1,19 @@ lxc === +[](http://hackage.haskell.org/package/lxc) [](https://travis-ci.org/fizruk/lxc) High level Haskell bindings to LXC (Linux containers). -The library provides Haskell LXC API, wrapping <http://hackage.haskell.org/package/bindings-lxc bindings-lxc package>. +The library provides Haskell LXC API, wrapping [bindings-lxc package](http://hackage.haskell.org/package/bindings-lxc). ## Requirements Before installation make sure you have LXC installed on your system with header files and static library. -On Ubuntu 14.04 LTS (Trusty Tahr):--```-$ sudo apt-get install lxc-dev-```--On previous Ubuntu versions (including 12.04 LTS Precise Pangolin) standard repositories do not contain `liblxc1` package.-You might want to use `ppa:ubuntu-lxc/stable` repository instead:+Although there is `lxc-dev` package in standard Ubuntu repositories,+you might want to use `ppa:ubuntu-lxc/stable` repository instead: ``` $ sudo apt-get install software-properties-common python-software-properties
lxc.cabal view
@@ -1,5 +1,5 @@ name: lxc-version: 0.3.1.1+version: 0.3.2 synopsis: High level Haskell bindings to LXC (Linux containers). description: The library provides Haskell LXC API, wrapping <http://hackage.haskell.org/package/bindings-lxc bindings-lxc package>. homepage: https://github.com/fizruk/lxc@@ -27,7 +27,7 @@ System.LXC.Internal.AttachOptions System.LXC.Internal.Container System.LXC.Internal.Utils- build-depends: base >=4.7 && <4.8+ build-depends: base >=4.7 && <5 , bindings-lxc >=0.2 && <0.3 , transformers >=0.2 , mtl
src/System/LXC/Internal/AttachOptions.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_HADDOCK not-home #-} ----------------------------------------------------------------------------- -- | -- Module : System.LXC.Internal.AttachOptions@@ -121,7 +122,7 @@ -- | Representation of a command to run in a container. data AttachCommand = AttachCommand- { attachProgram :: String -- ^ The program to run (passed to @execvp@).+ { attachProgram :: FilePath -- ^ The program to run (passed to @execvp@). , attachArgv :: [String] -- ^ The @argv@ of that program, including the program itself as the first element. }
src/System/LXC/Internal/Container.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_HADDOCK not-home #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -----------------------------------------------------------------------------@@ -19,10 +21,11 @@ import Bindings.LXC.Container import Bindings.LXC.Sys.Types +#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.Monad import Control.Monad.Reader-import Control.Monad.IO.Class import Data.Maybe import Data.Word@@ -224,7 +227,7 @@ withC'lxc_container c f = do cc <- newC'lxc_container c ret <- f cc- dropRef cc+ _ <- dropRef cc return ret -- | Container state.@@ -333,7 +336,7 @@ then return Nothing else allocaBytes (fromIntegral sz) $ \cretv -> do -- we call fn second time to actually get item into cretv buffer- fn cs cretv sz+ _ <- fn cs cretv sz Just <$> peekCString cretv setItemFn :: Field C'lxc_container (FunPtr ContainerSetItemFn) -> String -> Maybe String -> LXC Bool@@ -594,7 +597,7 @@ -> Maybe String -- ^ Information about how to create the new storage (i.e. fstype and fsdata). -> Maybe Word64 -- ^ In case of a block device backing store, an optional size. If @Nothing@, the original backing store's size will be used if possible. Note this only applies to the rootfs. For any other filesystems, the original size will be duplicated. -> [String] -- ^ Additional arguments to pass to the clone hook script.- -> LXC (Maybe Container) -- ^ Newly-allocated copy of container $c$, or @Nothing@ on error.+ -> LXC (Maybe Container) -- ^ Newly-allocated copy of container @c@, or @Nothing@ on error. clone newname lxcpath flags bdevtype bdevdata newsize hookargs = do oldname <- asks fst lxc $ \c -> do@@ -615,7 +618,7 @@ chookargs' c'' <- maybePeek peekC'lxc_container c' when (isJust c'') $ do- dropRef c'+ _ <- dropRef c' return () return $ c'' <*> pure (fromMaybe oldname newname) @@ -720,12 +723,12 @@ if (n <= 0) then return [] else do- css' <- peek css- let css'' = take n $ iterate (flip advancePtr 1) css'- css <- mapM peekC'lxc_snapshot css''- forM_ css'' $ join . mkFn mkFreeFn p'lxc_snapshot'free- free css'- return css+ css1 <- peek css+ let css2 = take n $ iterate (flip advancePtr 1) css1+ css3 <- mapM peekC'lxc_snapshot css2+ forM_ css2 $ join . mkFn mkFreeFn p'lxc_snapshot'free+ free css1+ return css3 -- | Create a new container based on a snapshot. --@@ -780,7 +783,7 @@ withArray0 nullPtr cargv $ \cargv' -> withCString t $ \ct -> maybeWith withCString bdevtype $ \cbdevtype ->- maybeWith withC'bdev_specs bdevspecs $ \cbdevspecs -> do+ maybeWith withC'bdev_specs bdevspecs $ \_cbdevspecs -> do fn <- peek $ p'lxc_container'create $ c mkCreateFn fn (c)@@ -811,7 +814,7 @@ getWaitStates = do sz <- fromIntegral <$> c'lxc_get_wait_states nullPtr allocaArray sz $ \cstates -> do- c'lxc_get_wait_states cstates+ _ <- c'lxc_get_wait_states cstates cstates' <- peekArray sz cstates map parseState <$> mapM peekCString cstates' -- we do not need to free the strings themselves