@@ -336,12 +336,20 @@ dirsFromFiles dirs = Set.toAscList (Set.delete "." results)
336336--
337337-- Note that we temporarily decompress the archive to analyze it.
338338checkSDistTarball :: (StackM env m , HasEnvConfig env , MonadBaseUnlift IO m )
339- => Path Abs File -- ^ Absolute path to tarball
339+ => SDistOpts -- ^ The configuration of what to check
340+ -> Path Abs File -- ^ Absolute path to tarball
340341 -> m ()
341- checkSDistTarball tarball = withTempTarGzContents tarball $ \ pkgDir' -> do
342+ checkSDistTarball opts tarball = withTempTarGzContents tarball $ \ pkgDir' -> do
342343 pkgDir <- (pkgDir' </> ) `liftM`
343344 (parseRelDir . FP. takeBaseName . FP. takeBaseName . toFilePath $ tarball)
344345 -- ^ drop ".tar" ^ drop ".gz"
346+ buildExtractedTarball pkgDir
347+ unless (sdoptsIgnoreCheck opts) (checkPackageInExtractedTarball pkgDir)
348+
349+ checkPackageInExtractedTarball :: (StackM env m , HasEnvConfig env , MonadBaseUnlift IO m )
350+ => Path Abs Dir -- ^ Absolute path to tarball
351+ -> m ()
352+ checkPackageInExtractedTarball pkgDir = do
345353 cabalfp <- findOrGenerateCabalFile pkgDir
346354 name <- parsePackageNameFromFilePath cabalfp
347355 config <- getDefaultPackageConfig
@@ -405,13 +413,14 @@ buildExtractedTarball pkgDir = do
405413-- | Version of 'checkSDistTarball' that first saves lazy bytestring to
406414-- temporary directory and then calls 'checkSDistTarball' on it.
407415checkSDistTarball' :: (StackM env m , HasEnvConfig env , MonadBaseUnlift IO m )
408- => String -- ^ Tarball name
416+ => SDistOpts
417+ -> String -- ^ Tarball name
409418 -> L. ByteString -- ^ Tarball contents as a byte string
410419 -> m ()
411- checkSDistTarball' name bytes = withSystemTempDir " stack" $ \ tpath -> do
420+ checkSDistTarball' opts name bytes = withSystemTempDir " stack" $ \ tpath -> do
412421 npath <- (tpath </> ) `liftM` parseRelFile name
413422 liftIO $ L. writeFile (toFilePath npath) bytes
414- checkSDistTarball npath
423+ checkSDistTarball opts npath
415424
416425withTempTarGzContents :: (MonadIO m , MonadMask m )
417426 => Path Abs File -- ^ Location of tarball
0 commit comments