diff --git a/subs/pantry/src/Pantry.hs b/subs/pantry/src/Pantry.hs index 94087594c5..88b48eaaf8 100644 --- a/subs/pantry/src/Pantry.hs +++ b/subs/pantry/src/Pantry.hs @@ -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 diff --git a/subs/pantry/src/Pantry/Types.hs b/subs/pantry/src/Pantry/Types.hs index 3dd8be058a..0020243e7c 100644 --- a/subs/pantry/src/Pantry/Types.hs +++ b/subs/pantry/src/Pantry/Types.hs @@ -107,6 +107,7 @@ module Pantry.Types , SnapshotCacheHash (..) , getGlobalHintsFile , bsToBlobKey + , pliIdent ) where import RIO @@ -2269,7 +2270,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