Copyright | (c) Colin Woodbury 2012 - 2020 |
---|---|
License | GPL3 |
Maintainer | Colin Woodbury <colin@fosskers.ca> |
Safe Haskell | None |
Language | Haskell2010 |
Core types and functions which belong nowhere else.
Synopsis
- data Env = Env {
- repository :: !Repository
- settings :: !Settings
- data Repository = Repository {}
- liftMaybeM :: (MonadThrow m, Exception e) => e -> m (Maybe a) -> m a
- sudo :: RIO Env a -> RIO Env a
- trueRoot :: RIO Env a -> RIO Env a
- foreignPackages :: Environment -> IO (Set SimplePkg)
- orphans :: Environment -> IO (Set PkgName)
- develPkgs :: Environment -> IO (Set PkgName)
- isDevelPkg :: PkgName -> Bool
- newtype Unsatisfied = Unsatisfied (NonEmpty Dep)
- newtype Satisfied = Satisfied (NonEmpty Dep)
- areSatisfied :: Environment -> NonEmpty Dep -> IO (These Unsatisfied Satisfied)
- isInstalled :: Environment -> PkgName -> IO (Maybe PkgName)
- checkDBLock :: Settings -> IO ()
- removePkgs :: NonEmpty PkgName -> RIO Env ()
- partitionPkgs :: NonEmpty (NonEmpty Package) -> ([Prebuilt], [NonEmpty Buildable])
- diff :: MonadIO m => Settings -> FilePath -> FilePath -> m ()
- notify :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m ()
- warn :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m ()
- scold :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m ()
- report :: (Doc AnsiStyle -> Doc AnsiStyle) -> (Language -> Doc AnsiStyle) -> NonEmpty PkgName -> RIO Env ()
Types
The complete Aura runtime environment. Repository
has internal caches
instantiated in IO
, while Settings
is mostly static and derived from
command-line arguments.
Env | |
|
Instances
Generic Env Source # | |
HasLogFunc Env Source # | |
type Rep Env Source # | |
Defined in Aura.Core type Rep Env = D1 ('MetaData "Env" "Aura.Core" "aura-3.2.3-IqE4M9PmFEN9y4bYT1jkTk" 'False) (C1 ('MetaCons "Env" 'PrefixI 'True) (S1 ('MetaSel ('Just "repository") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Repository) :*: S1 ('MetaSel ('Just "settings") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Settings))) |
data Repository Source #
A Repository
is a place where packages may be fetched from. Multiple
repositories can be combined with the Semigroup
instance. Checks packages
in batches for efficiency.
Instances
Semigroup Repository Source # | |
Defined in Aura.Core (<>) :: Repository -> Repository -> Repository # sconcat :: NonEmpty Repository -> Repository # stimes :: Integral b => b -> Repository -> Repository # |
liftMaybeM :: (MonadThrow m, Exception e) => e -> m (Maybe a) -> m a Source #
User Privileges
trueRoot :: RIO Env a -> RIO Env a Source #
Stop the user if they are the true root. Building as root isn't allowed since makepkg v4.2.
Querying the Package Database
foreignPackages :: Environment -> IO (Set SimplePkg) Source #
A list of non-prebuilt packages installed on the system.
-Qm
yields a list of sorted values.
orphans :: Environment -> IO (Set PkgName) Source #
Packages marked as a dependency, yet are required by no other package.
develPkgs :: Environment -> IO (Set PkgName) Source #
Any installed package whose name is suffixed by git, hg, svn, darcs, cvs, or bzr.
isDevelPkg :: PkgName -> Bool Source #
Is a package suffixed by git, hg, svn, darcs, cvs, or bzr?
newtype Unsatisfied Source #
Depedencies which are not installed, or otherwise provided by some installed package.
areSatisfied :: Environment -> NonEmpty Dep -> IO (These Unsatisfied Satisfied) Source #
Similar to isSatisfied
, but dependencies are checked in a batch, since
-T
can accept multiple inputs.
isInstalled :: Environment -> PkgName -> IO (Maybe PkgName) Source #
Returns what it was given if the package is already installed. Reasoning: Using raw bools can be less expressive.
checkDBLock :: Settings -> IO () Source #
Block further action until the database is free.
Misc. Package Handling
partitionPkgs :: NonEmpty (NonEmpty Package) -> ([Prebuilt], [NonEmpty Buildable]) Source #
Partition a list of packages into pacman and buildable groups. Yes, this is
the correct signature. As far as this function (in isolation) is concerned,
there is no way to guarantee that the list of NonEmpty
s will itself be
non-empty.
Content Diffing
diff :: MonadIO m => Settings -> FilePath -> FilePath -> m () Source #
Given two filepaths, output the diff of the two files. Output will be coloured unless colour is deactivated by `--color never` or by detection of a non-terminal output target.
IO
notify :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m () Source #
Print some message in green with Aura flair.
warn :: MonadIO m => Settings -> (Language -> Doc AnsiStyle) -> m () Source #
Print some message in yellow with Aura flair.