Safe Haskell | None |
---|---|
Language | Haskell2010 |
Static B9 configuration. Read, write and merge configurable properties. The properties are independent of specific build targets.
- data B9Config = B9Config {
- _verbosity :: Maybe LogLevel
- _logFile :: Maybe FilePath
- _buildDirRoot :: Maybe FilePath
- _keepTempDirs :: Bool
- _execEnvType :: ExecEnvType
- _profileFile :: Maybe FilePath
- _envVars :: BuildVariables
- _uniqueBuildDirs :: Bool
- _repositoryCache :: Maybe SystemPath
- _repository :: Maybe String
- _interactive :: Bool
- _maxLocalSharedImageRevisions :: Maybe Int
- _libVirtLXCConfigs :: Maybe LibVirtLXCConfig
- _remoteRepos :: [RemoteRepo]
- verbosity :: Lens' B9Config (Maybe LogLevel)
- logFile :: Lens' B9Config (Maybe FilePath)
- buildDirRoot :: Lens' B9Config (Maybe FilePath)
- keepTempDirs :: Lens' B9Config Bool
- execEnvType :: Lens' B9Config ExecEnvType
- profileFile :: Lens' B9Config (Maybe FilePath)
- envVars :: Lens' B9Config BuildVariables
- uniqueBuildDirs :: Lens' B9Config Bool
- repositoryCache :: Lens' B9Config (Maybe SystemPath)
- repository :: Lens' B9Config (Maybe String)
- interactive :: Lens' B9Config Bool
- libVirtLXCConfigs :: Lens' B9Config (Maybe LibVirtLXCConfig)
- remoteRepos :: Lens' B9Config [RemoteRepo]
- maxLocalSharedImageRevisions :: Lens' B9Config (Maybe Int)
- data B9ConfigOverride = B9ConfigOverride {}
- noB9ConfigOverride :: B9ConfigOverride
- data B9ConfigAction m a
- execB9ConfigAction :: MonadIO m => B9ConfigAction m a -> B9ConfigOverride -> m a
- invokeB9 :: MonadIO m => B9ConfigAction m a -> m a
- askRuntimeConfig :: Monad m => B9ConfigAction m B9Config
- localRuntimeConfig :: Monad m => (B9Config -> B9Config) -> B9ConfigAction m a -> B9ConfigAction m a
- modifyPermanentConfig :: Monad m => Endo B9Config -> B9ConfigAction m ()
- customB9Config :: Lens' B9ConfigOverride B9Config
- customB9ConfigPath :: Lens' B9ConfigOverride (Maybe SystemPath)
- overrideB9ConfigPath :: SystemPath -> B9ConfigOverride -> B9ConfigOverride
- overrideB9Config :: (B9Config -> B9Config) -> B9ConfigOverride -> B9ConfigOverride
- overrideWorkingDirectory :: FilePath -> B9ConfigOverride -> B9ConfigOverride
- overrideVerbosity :: LogLevel -> B9ConfigOverride -> B9ConfigOverride
- overrideKeepBuildDirs :: Bool -> B9ConfigOverride -> B9ConfigOverride
- defaultB9ConfigFile :: SystemPath
- defaultRepositoryCache :: SystemPath
- defaultB9Config :: B9Config
- openOrCreateB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument
- writeB9CPDocument :: MonadIO m => Maybe SystemPath -> CPDocument -> m ()
- readB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument
- parseB9Config :: CPDocument -> Either CPError B9Config
- appendPositionalArguments :: [String] -> B9Config -> B9Config
- modifyCPDocument :: CPDocument -> Endo B9Config -> Either CPError CPDocument
- b9ConfigToCPDocument :: B9Config -> Either CPError CPDocument
- data LogLevel
- data ExecEnvType = LibVirtLXC
- type BuildVariables = [(String, String)]
Documentation
data B9ConfigOverride Source #
Override b9 configuration items and/or the path of the b9 configuration file. This is useful, i.e. when dealing with command line parameters.
noB9ConfigOverride :: B9ConfigOverride Source #
An empty default B9ConfigOverride
value, that will neither apply any
additional B9Config
nor change the path of the configuration file.
data B9ConfigAction m a Source #
A monad that gives access to the (transient) B9Config
to be used to
_runtime_ with askRuntimeConfig
or localRuntimeConfig
, and that allows
to write permanent B9Config
changes back to the configuration file using
modifyPermanentConfig
. Execute a B9ConfigAction
by invoking
either invokeB9
(which is simple) or execB9ConfigAction
.
Monad m => Monad (B9ConfigAction m) Source # | |
Functor m => Functor (B9ConfigAction m) Source # | |
Applicative m => Applicative (B9ConfigAction m) Source # | |
MonadIO m => MonadIO (B9ConfigAction m) Source # | |
execB9ConfigAction :: MonadIO m => B9ConfigAction m a -> B9ConfigOverride -> m a Source #
Execute a B9ConfigAction
.
It will take a B9ConfigOverride
as input. The B9Config
in that value is
treated as the _runtime_ configuration, and the _customConfigPath
is used
as the alternative location of the configuration file.
The configuration file is read from either the path in _customB9ConfigPath
or from defaultB9ConfigFile
.
Every modification done via modifyPermanentConfig
is applied to
the **contents** of the configuration file
and written back to that file, note that these changes are ONLY reflected
in the configuration file and **not** in the _runtime configuration_.
See also invokeB9
, which does not need the B9ConfigOverride
parameter.
invokeB9 :: MonadIO m => B9ConfigAction m a -> m a Source #
Run a B9ConfigAction
using noB9ConfigOverride
.
See execB9ConfigAction
for more details.
askRuntimeConfig :: Monad m => B9ConfigAction m B9Config Source #
Return the runtime configuration, that should be the configuration merged from all configuration sources. This is the configuration to be used during a VM image build.
localRuntimeConfig :: Monad m => (B9Config -> B9Config) -> B9ConfigAction m a -> B9ConfigAction m a Source #
Run an action with an updated runtime configuration.
modifyPermanentConfig :: Monad m => Endo B9Config -> B9ConfigAction m () Source #
Add a modification to the permanent configuration file.
overrideB9ConfigPath :: SystemPath -> B9ConfigOverride -> B9ConfigOverride Source #
Convenience utility to override the B9 configuration file path.
overrideB9Config :: (B9Config -> B9Config) -> B9ConfigOverride -> B9ConfigOverride Source #
Modify the runtime configuration.
overrideWorkingDirectory :: FilePath -> B9ConfigOverride -> B9ConfigOverride Source #
Define the current working directory to be used when building.
overrideVerbosity :: LogLevel -> B9ConfigOverride -> B9ConfigOverride Source #
Overwrite the verbosity
settings in the configuration with those given.
overrideKeepBuildDirs :: Bool -> B9ConfigOverride -> B9ConfigOverride Source #
Overwrite the keepTempDirs
flag in the configuration with those given.
openOrCreateB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument Source #
Open the configuration file that contains the B9Config
.
If the configuration does not exist, write a default configuration file,
and create a all missing directories.
writeB9CPDocument :: MonadIO m => Maybe SystemPath -> CPDocument -> m () Source #
Write the configuration in the CPDocument
to either the user supplied
configuration file path or to defaultB9ConfigFile
.
Create all missing (parent) directories.
readB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument Source #
appendPositionalArguments :: [String] -> B9Config -> B9Config Source #
If environment variables arg_1 .. arg_n
are bound
and a list of k
additional values are passed to this function,
store them with keys arg_(n+1) .. arg_(n+k)
.
modifyCPDocument :: CPDocument -> Endo B9Config -> Either CPError CPDocument Source #
Parse a B9Config
, modify it, and merge it back to the given CPDocument
.
b9ConfigToCPDocument :: B9Config -> Either CPError CPDocument Source #
Append a config file section for the B9Config
to an empty CPDocument
.
data ExecEnvType Source #
type BuildVariables = [(String, String)] Source #