Skip to content

Commit

Permalink
Merge pull request #4791 from commercialhaskell/4789-package-name-fro…
Browse files Browse the repository at this point in the history
…m-completed

Get package name from completed information #4789
  • Loading branch information
snoyberg authored May 2, 2019
2 parents 91fc080 + 38826df commit 28138a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions subs/pantry/src/Pantry.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,9 +1175,9 @@ addAndCompletePackagesToSnapshot loc cachedPL newPackages (AddPackagesConfig dro
-> RawPackageLocationImmutable
-> RIO env ([(PackageName, SnapshotPackage)], [CompletedPLI])
addPackage (ps, completed) rawLoc = do
name <- getPackageLocationName rawLoc
complLoc <- cachedSnapshotCompletePackageLocation cachedPL rawLoc
let p = (name, SnapshotPackage
let PackageIdentifier name _ = pliIdent complLoc
p = (name, SnapshotPackage
{ spLocation = complLoc
, spFlags = Map.findWithDefault mempty name flags
, spHidden = Map.findWithDefault False name hiddens
Expand Down
9 changes: 8 additions & 1 deletion subs/pantry/src/Pantry/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ module Pantry.Types
, SnapshotCacheHash (..)
, getGlobalHintsFile
, bsToBlobKey
, pliIdent
) where

import RIO
Expand Down Expand Up @@ -2262,7 +2263,13 @@ getGlobalHintsFile = do

-- | Creates BlobKey for an input ByteString
--
-- @sinc 0.1.0.0
-- @since 0.1.0.0
bsToBlobKey :: ByteString -> BlobKey
bsToBlobKey bs =
BlobKey (SHA256.hashBytes bs) (FileSize (fromIntegral (B.length bs)))

-- | Identifier from a 'PackageLocationImmutable'
pliIdent :: PackageLocationImmutable -> PackageIdentifier
pliIdent (PLIHackage ident _ _) = ident
pliIdent (PLIArchive _ pm) = pmIdent pm
pliIdent (PLIRepo _ pm) = pmIdent pm

0 comments on commit 28138a9

Please sign in to comment.