Skip to content

Commit

Permalink
Ignore extra cabal-file fields (CC @qrilka)
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Oct 4, 2019
1 parent 1295ec4 commit 55c943a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Pantry/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@ instance Display PackageMetadata where

parsePackageMetadata :: Object -> WarningParser PackageMetadata
parsePackageMetadata o = do
_oldCabalFile :: Maybe BlobKey <- o ..:? "cabal-file"
pantryTree :: BlobKey <- o ..: "pantry-tree"
CabalString pkgName <- o ..: "name"
CabalString pkgVersion <- o ..: "version"
Expand Down Expand Up @@ -1607,10 +1608,20 @@ instance FromJSON (WithJSONWarnings (Unresolved (NonEmpty RawPackageLocationImmu
Just x -> pure $ OSSubdirs x
Nothing -> OSPackageMetadata
<$> o ..:? "subdir" ..!= T.empty
<*> (RawPackageMetadata
<*> (rawPackageMetadataHelper
<$> (fmap unCabalString <$> (o ..:? "name"))
<*> (fmap unCabalString <$> (o ..:? "version"))
<*> o ..:? "pantry-tree")
<*> o ..:? "pantry-tree"
<*> o ..:? "cabal-file")

rawPackageMetadataHelper
:: Maybe PackageName
-> Maybe Version
-> Maybe TreeKey
-> Maybe BlobKey
-> RawPackageMetadata
rawPackageMetadataHelper name version pantryTree _ignoredCabalFile =
RawPackageMetadata name version pantryTree

repo = withObjectWarnings "UnresolvedPackageLocationImmutable.UPLIRepo" $ \o -> do
(repoType, repoUrl) <-
Expand Down
4 changes: 4 additions & 0 deletions test/Pantry/TypesSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ samplePLIRepo :: ByteString
samplePLIRepo =
[r|
subdir: wai
cabal-file:
# This is ignored, only included to make sure we get no warnings
size: 1765
sha256: eea52c4967d8609c2f79213d6dffe6d6601034f1471776208404781de7051410
name: wai
version: 3.2.1.2
git: https://github.com/yesodweb/wai.git
Expand Down

0 comments on commit 55c943a

Please sign in to comment.