Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
af358a62
Commit
af358a62
authored
May 21, 2007
by
mnislaih
Browse files
Be more verbose in Update
parent
7fb7bb62
Changes
3
Hide whitespace changes
Inline
Side-by-side
cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
View file @
af358a62
...
...
@@ -38,6 +38,7 @@ import Network.Hackage.CabalInstall.Config (packagesDirectory)
import
Network.Hackage.CabalInstall.Dependency
(
filterFetchables
,
resolveDependencies
)
import
Distribution.Package
(
PackageIdentifier
(
..
),
showPackageId
)
import
Distribution.Verbosity
import
System.FilePath
((
</>
),
(
<.>
))
import
System.Directory
(
copyFile
)
import
System.IO
(
IOMode
(
..
),
hPutStr
,
Handle
,
hClose
,
openBinaryFile
)
...
...
@@ -87,7 +88,7 @@ downloadFile path url
-- Downloads a package to [config-dir/packages/package-id] and returns the path to the package.
downloadPackage
::
ConfigFlags
->
PackageIdentifier
->
String
->
IO
String
downloadPackage
cfg
pkg
url
=
do
message
(
configOutputGen
cfg
)
2
$
"GET "
++
show
url
=
do
message
(
configOutputGen
cfg
)
verbose
$
"GET "
++
show
url
mbError
<-
downloadFile
path
url
case
mbError
of
Just
err
->
fail
$
printf
"Failed to download '%s': %s"
(
showPackageId
pkg
)
(
show
err
)
...
...
cabal-install/src/Network/Hackage/CabalInstall/Update.hs
View file @
af358a62
...
...
@@ -17,6 +17,7 @@ module Network.Hackage.CabalInstall.Update
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
(
..
),
OutputGen
(
..
),
PkgInfo
(
..
))
import
Network.Hackage.CabalInstall.Config
(
writeKnownPackages
)
import
Network.Hackage.CabalInstall.TarUtils
(
extractTarFile
,
tarballGetFiles
)
import
Network.Hackage.CabalInstall.Utils
(
isVerbose
)
import
Network.Hackage.CabalInstall.Fetch
(
downloadIndex
,
packagesDirectory
)
import
Distribution.Package
(
PackageIdentifier
(
..
),
pkgName
,
showPackageId
)
...
...
@@ -24,10 +25,12 @@ import Distribution.PackageDescription (PackageDescription(..), readPackageDescr
import
Distribution.Verbosity
import
System.FilePath
((
</>
),
joinPath
,
addExtension
,
takeExtension
)
import
Control.Monad
(
liftM
)
import
Control.Monad
(
liftM
,
when
)
import
Data.List
(
intersperse
,
isSuffixOf
)
import
Data.Version
(
showVersion
)
import
Text.Printf
-- | 'update' downloads the package list from all known servers
update
::
ConfigFlags
->
IO
()
update
cfg
=
...
...
@@ -36,6 +39,7 @@ update cfg =
indexPath
<-
downloadIndex
cfg
server
extractTarFile
tarPath
indexPath
contents
<-
tarballGetFiles
tarPath
indexPath
when
(
isVerbose
cfg
)
$
printf
"Retrieved %d package descriptions
\n
"
(
length
contents
)
let
packageDir
=
packagesDirectory
cfg
cabalFiles
=
[
packageDir
</>
path
|
path
<-
contents
...
...
@@ -45,6 +49,7 @@ update cfg =
packageDescriptions
<-
mapM
(
readPackageDescription
v'
)
cabalFiles
return
$
map
(
parsePkg
server
)
packageDescriptions
when
(
isVerbose
cfg
)
$
printf
"Processed %d package descriptions
\n
"
(
length
packages
)
writeKnownPackages
cfg
packages
where
servers
=
configServers
cfg
output
=
configOutputGen
cfg
...
...
cabal-install/src/Network/Hackage/CabalInstall/Utils.hs
0 → 100644
View file @
af358a62
module
Network.Hackage.CabalInstall.Utils
where
import
Distribution.Verbosity
import
Network.Hackage.CabalInstall.Types
isVerbose
cfg
=
configVerbose
cfg
>=
verbose
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment