From c9d09afafac30ab40f16faf45a216782fb02c39b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 1 Dec 2014 11:59:23 -0400 Subject: [PATCH] Run apt-cache policy with LANG=C. --- debian/changelog | 1 + src/Propellor/Property/Apt.hs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1780147..aa19165 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,7 @@ propellor (1.1.0) UNRELEASED; urgency=medium This is more robust. * propellor.debug can be set in the git config to enable more persistent debugging output. + * Run apt-cache policy with LANG=C. -- Joey Hess Sat, 22 Nov 2014 00:12:35 -0400 diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 471d619..68e877e 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -193,13 +193,15 @@ isInstalled p = (== [True]) <$> isInstalled' [p] -- even vary. If apt does not know about a package at all, it will not -- be included in the result list. isInstalled' :: [Package] -> IO [Bool] -isInstalled' ps = catMaybes . map parse . lines - <$> readProcess "apt-cache" ("policy":ps) +isInstalled' ps = catMaybes . map parse . lines <$> policy where parse l | "Installed: (none)" `isInfixOf` l = Just False | "Installed: " `isInfixOf` l = Just True | otherwise = Nothing + policy = do + environ <- addEntry "LANG" "C" <$> getEnvironment + readProcessEnv "apt-cache" ("policy":ps) (Just environ) autoRemove :: Property autoRemove = runApt ["-y", "autoremove"]