Skip to content

Commit

Permalink
[aura] Fix pacman.conf line parsing logic - fixes #697
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Mar 9, 2021
1 parent 2f9f3e3 commit 7525ccc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions aura/lib/Aura/Settings/External.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ single = L.lexeme garbage . void $ manyTill letterChar newline

pair :: Parsec Void Text (Text, [Text])
pair = L.lexeme garbage $ do
n <- takeWhile1P Nothing (/= ' ')
space
n <- T.stripEnd <$> takeWhile1P Nothing (/= '=')
void $ char '='
space
rest <- T.words <$> takeWhile1P Nothing (/= '\n')
Expand Down
7 changes: 5 additions & 2 deletions aura/test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ suite conf badRaw goodRaw = testGroup "Unit Tests"
, testGroup "Aura.Pacman"
[ testCase "Parsing pacman.conf" $ do
let p = parse config "pacman.conf" conf
r = either (const Nothing) (\(Config c) -> Just c) p >>= M.lookup "HoldPkg"
r @?= Just ["pacman", "glibc"]
r = either (const Nothing) (\(Config c) -> Just c) p
(r >>= M.lookup "HoldPkg") @?= Just ["pacman", "glibc"]
(r >>= M.lookup "GoodLine") @?= Just ["good"]
(r >>= M.lookup "BadLine") @?= Just ["bad"]
(r >>= M.lookup "OkLine") @?= Just ["ok"]
]
, testGroup "Aura.Languages"
[ testCase "Language names are complete" $ do
Expand Down
3 changes: 3 additions & 0 deletions aura/test/pacman.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ HoldPkg = pacman glibc
#CleanMethod = KeepInstalled
#UseDelta = 0.7
Architecture = auto
GoodLine = good
BadLine= bad
OkLine =ok

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
Expand Down

0 comments on commit 7525ccc

Please sign in to comment.