Skip to content

Commit

Permalink
Die earlier if we can't parse the package name in 'hackport status'
Browse files Browse the repository at this point in the history
  • Loading branch information
kolmodin committed Aug 3, 2010
1 parent a30c3fc commit 85f4f4e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Status.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import Control.Applicative
-- cabal
import Distribution.Verbosity
import Distribution.Simple.Utils (equating, comparing)
import Distribution.Text(display, simpleParse)
import Distribution.Text ( display, simpleParse )
import Distribution.Simple.Utils ( die )

data FileStatus a
= Same a
Expand Down Expand Up @@ -88,15 +89,15 @@ runStatus :: Verbosity -> FilePath -> FilePath -> Bool -> [String] -> IO ()
runStatus verbosity portdir overlaydir toPortageFlag pkgs = do
let pkgFilter | toPortageFlag = toPortageFilter
| otherwise = id
pkgs' <- forM pkgs $ \p ->
case simpleParse p of
Nothing -> die ("Could not parse package name: " ++ p ++ ". Format cat/pkg")
Just pn -> return pn
tree0 <- status verbosity portdir overlaydir
let tree = pkgFilter tree0
if (null pkgs)
if (null pkgs')
then statusPrinter tree
else forM_ pkgs $ \pkg -> do
case simpleParse pkg of
Nothing -> putStrLn ("Could not parse package name: " ++ pkg ++ ". Format cat/pkg")
Just p -> do
statusPrinter (Map.filterWithKey (\k _ -> k == p) tree)
else forM_ pkgs' $ \pkg -> statusPrinter (Map.filterWithKey (\k _ -> k == pkg) tree)

-- |Only return packages that seems interesting to sync to portage;
--
Expand Down

0 comments on commit 85f4f4e

Please sign in to comment.