@@ -611,7 +611,7 @@ processPkg verbosity opts config docInfo = do
611611 createDirectoryIfMissing True $ resultsDirectory opts
612612 notice verbosity $ " Writing cabal.project for " ++ display (docInfoPackage docInfo)
613613 let projectFile = installDirectory opts </> " cabal.project"
614- cabal opts " unpack" [show (docInfoTarGzURI config docInfo) ] Nothing
614+ cabal opts " unpack" [cabalPackageTarget config docInfo] Nothing
615615 writeFile projectFile $ " packages: */*.cabal" -- ++ show (docInfoTarGzURI config docInfo)
616616
617617 setTestOutcome :: String -> [String ] -> [String ]
@@ -756,14 +756,7 @@ buildPackage verbosity opts config docInfo = do
756756 " --haddock-hoogle" ,
757757 -- Generate the quickjump index files
758758 " --haddock-option=--quickjump" ,
759- -- For candidates we need to use the full URL, because
760- -- otherwise cabal-install will not find the package.
761- -- For regular packages however we need to use just the
762- -- package name, otherwise cabal-install will not
763- -- generate a report
764- if docInfoIsCandidate docInfo
765- then show (docInfoTarGzURI config docInfo)
766- else display pkgid
759+ cabalPackageTarget config docInfo
767760 ]
768761
769762 -- The installDirectory is purely temporary, while the resultsDirectory is
@@ -830,6 +823,18 @@ cabal opts cmd args moutput = do
830823 Nothing Nothing moutput moutput
831824 waitForProcess ph
832825
826+ cabalPackageTarget :: BuildConfig -> DocInfo -> String
827+ cabalPackageTarget config docInfo =
828+ -- For candidates we need to use the full URL, because
829+ -- otherwise cabal install/unpack will not find the package.
830+ -- For regular packages however we need to use just the
831+ -- package name, otherwise cabal install will not
832+ -- generate a report and cabal unpack will not use the
833+ -- latest cabal file revision from the package archive.
834+ if docInfoIsCandidate docInfo
835+ then show (docInfoTarGzURI config docInfo)
836+ else display (docInfoPackage docInfo)
837+
833838pruneHaddockFiles :: FilePath -> IO ()
834839pruneHaddockFiles dir = do
835840 -- Hackage doesn't support the haddock frames view, so remove it
0 commit comments