Commit 1e1049e3 authored by md9ms's avatar md9ms
Browse files

Change license parsing to add a license-file field

As suggested by Igloo, the License field should deal with known licenses, so
we added a separate field called License-file that takes a FilePath.

It should be an error if both License and License-file are present, but this
is not enforced yet.
parent dfcc8d16
......@@ -195,6 +195,9 @@ parseDescription inp = do let (st:sts) = splitStanzas inp
parseBasicStanza pkg (f@"license", val) =
do l <- runP f parseLicense val
return pkg{license=l}
parseBasicStanza pkg (f@"license-file", val) =
do path <- runP f parseFilePath val
return pkg{license=OtherLicense path}
parseBasicStanza pkg (f@"maintainer", val) = return pkg{maintainer=val}
parseBasicStanza pkg (f@"stability", val) = return pkg{stability=val}
parseBasicStanza pkg (field, val) =
......@@ -292,7 +295,7 @@ parseDependency = do name <- many1 (letter <|> digit <|> oneOf "-_")
<?> "parseDependency"
parseLicense :: GenParser Char st License
parseLicense = try parseReadS <|> liftM OtherLicense parseFilePath
parseLicense = parseReadS
parseExtension :: GenParser Char st Extension
parseExtension = parseReadS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment