Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (24 sloc) 0.742 kb
module Portage.Metadata
( Metadata(..)
, metadataFromFile
) where
import qualified Data.ByteString as B
import Control.Applicative
import Text.XML.Light
import Control.Monad
data Metadata = Metadata
{ metadataHerds :: [String]
-- , metadataMaintainers :: [String],
-- , metadataUseFlags :: [(String,String)]
} deriving (Show)
metadataFromFile :: FilePath -> IO (Maybe Metadata)
metadataFromFile fp = do
doc <- parseXMLDoc <$> B.readFile fp
return (doc >>= parseMetadata)
parseMetadata :: Element -> Maybe Metadata
parseMetadata xml = do
let herds = map strContent (findChildren (unqual "herd") xml)
return Metadata
{
metadataHerds = herds
}
Jump to Line
Something went wrong with that request. Please try again.