packages feed

aura 3.1.6 → 3.1.7

raw patch · 5 files changed

+48/−13 lines, 5 filesdep ~optparse-applicativedep ~prettyprinterPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: optparse-applicative, prettyprinter

API changes (from Hackage documentation)

- Aura.Settings.External: defaultAuraConf :: FilePath
- Aura.Settings.External: getAuraConf :: FilePath -> IO Config
+ Aura.Settings.External: getAuraConf :: Environment -> IO Config

Files

CHANGELOG.md view
@@ -1,5 +1,20 @@ # Aura Changelog +## 3.1.7 (2020-08-12)++Thanks to Sam Horvath-Hunt for contributing to this release.++#### Added++- Users can now configure Aura in `/home/YOU/.config/aura/aura.conf` instead,+  which takes priority over the default one at `/etc/aura.conf`.++#### Fixed++- Complications involving the cloning of `*-git` packages. [#615]++[#615]: https://github.com/fosskers/aura/issues/615+ ## 3.1.6 (2020-07-21)  #### Changed
aura.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               aura-version:            3.1.6+version:            3.1.7 synopsis:           A secure package manager for Arch Linux and the AUR. description:   Aura is a package manager for Arch Linux. It connects to both the@@ -53,7 +53,7 @@     , aeson                        >=1.2 && <1.6     , aur                          ^>=7.0     , http-client                  >=0.5 && <0.8-    , prettyprinter                >=1.2 && <1.7+    , prettyprinter                >=1.2 && <1.8     , prettyprinter-ansi-terminal  ^>=1.1     , scheduler                    >=1.1 && <1.5     , transformers                 ^>=0.5
exec/Aura/Settings/Runtime.hs view
@@ -54,10 +54,10 @@ withEnv (Program op co bc lng ll) f = do   let ign = S.fromList $ op ^.. _Right . _AurSync . to toList . each . _AurIgnore . to toList . each       igg = S.fromList $ op ^.. _Right . _AurSync . to toList . each . _AurIgnoreGroup . to toList . each+  environment <- M.fromList . map (bimap T.pack T.pack) <$> getEnvironment   confFile    <- getPacmanConf (either id id $ configPathOf co) >>= either throwM pure-  auraConf    <- auraConfig <$> getAuraConf defaultAuraConf+  auraConf    <- auraConfig <$> getAuraConf environment   when (ll == LevelDebug) . printf "%s\n" $ show auraConf-  environment <- M.fromList . map (bimap T.pack T.pack) <$> getEnvironment   manager     <- newManager tlsManagerSettings   isTerm      <- hIsTerminalDevice stdout   fromGroups  <- maybe (pure S.empty) (groupPackages environment) . nes
lib/Aura/Build.hs view
@@ -154,6 +154,9 @@ -- just pull the latest instead of cloning. pullRepo :: RIO Env (Either Failure ()) pullRepo = do+  logDebug "git: Clearing worktree. "+  void . runProcess . setStderr closed . setStdout closed $ proc "git" ["reset", "--hard", "HEAD"]+  logDebug "git: Pulling repo."   ec <- runProcess . setStderr closed . setStdout closed $ proc "git" ["pull"]   case ec of     ExitFailure _ -> pure . Left $ Failure buildFail_12
lib/Aura/Settings/External.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE LambdaCase         #-}  -- | -- Module    : Aura.Settings.External@@ -14,7 +15,6 @@     AuraConfig(..)   , getAuraConf   , auraConfig-  , defaultAuraConf     -- * Parsing   , Config(..)   , config@@ -22,10 +22,13 @@  import           Aura.Languages (langFromLocale) import           Aura.Settings+import           Aura.Shell (getTrueUser) import           Aura.Types+import           Aura.Utils (hush) import           RIO hiding (some, try) import qualified RIO.ByteString as BS import           RIO.Directory+import           RIO.FilePath ((</>)) import qualified RIO.Map as M import qualified RIO.Text as T import           Text.Megaparsec hiding (single)@@ -45,17 +48,31 @@   , acAnalyse   :: !(Maybe BuildSwitch) }   deriving stock (Show) -defaultAuraConf :: FilePath-defaultAuraConf = "/etc/aura.conf"+userAuraConfPath :: Environment -> Maybe FilePath+userAuraConfPath env = case getTrueUser env of+  Nothing            -> Nothing+  Just (User "root") -> Nothing+  Just (User u)      -> Just $ "/home/" </> T.unpack u </> ".config/aura/aura.conf" -getAuraConf :: FilePath -> IO Config-getAuraConf fp = do-  exists <- doesFileExist fp+systemAuraConfPath :: FilePath+systemAuraConfPath = "/etc/aura.conf"++-- | Attempt to get a valid Aura config from a specified path.+getAuraConfFrom :: FilePath -> IO (Maybe Config)+getAuraConfFrom path = do+  exists <- doesFileExist path   if not exists-    then pure $ Config mempty+    then pure Nothing     else do-      file <- decodeUtf8Lenient <$> BS.readFile fp-      pure . either (const $ Config M.empty) id $ parse config "aura config" file+      file <- decodeUtf8Lenient <$> BS.readFile path+      pure . hush $ parse config "aura config" file++getAuraConf :: Environment -> IO Config+getAuraConf env = case userAuraConfPath env of+  Nothing   -> bad+  Just path -> getAuraConfFrom path >>= maybe bad pure+  where+    bad = fromMaybe (Config M.empty) <$> getAuraConfFrom systemAuraConfPath  auraConfig :: Config -> AuraConfig auraConfig (Config m) = AuraConfig