@@ -24,7 +24,7 @@ import Distribution.Gentoo.Packages
2424-- Cabal imports
2525import qualified Distribution.Simple.Utils as DSU
2626import Distribution.Verbosity (silent )
27- import Distribution.Package (PackageIdentifier , packageId )
27+ import Distribution.Package (packageId )
2828import Distribution.InstalledPackageInfo (InstalledPackageInfo )
2929import Distribution.Text (display )
3030
@@ -51,7 +51,13 @@ import Output
5151
5252-- Get only the first line of output
5353rawSysStdOutLine :: FilePath -> [String ] -> IO String
54- rawSysStdOutLine app = fmap (head . lines ) . rawCommand app
54+ rawSysStdOutLine app args = do
55+ out <- rawCommand app args
56+ case lines out of
57+ [] -> error $ unwords
58+ [ " rawSysStdOutLine: Empty output from rawCommand"
59+ , show app, show args ]
60+ (s: _) -> pure s
5561
5662rawCommand :: FilePath -> [String ] -> IO String
5763rawCommand cmd args = do (out,_,_) <- DSU. rawSystemStdInOut
@@ -157,11 +163,9 @@ parse_as_cabal_package cont =
157163 -- ebuilds that have CABAL_CORE_LIB_GHC_PV set
158164 -- for this version of GHC will have a .conf
159165 -- file containing just []
160- [([] ,_)] -> Nothing
161- rd -> Just $ CPV $ display $ cfNm rd
162- where
163- cfNm :: [([InstalledPackageInfo ], String )] -> PackageIdentifier
164- cfNm = packageId . head . fst . head
166+ (([] ,_): _) -> Nothing
167+ ((i: _,_): _) -> Just $ CPV $ display
168+ $ packageId (i :: InstalledPackageInfo )
165169
166170-- ghc package text format
167171-- "name: zlib-conduit\n
0 commit comments