Use wget -q --show-progress for less verbose wget output, when built with wget 1.16.
This commit is contained in:
parent
7aa66cb185
commit
c64ede23cd
5 changed files with 72 additions and 28 deletions
|
@ -10,10 +10,13 @@ import Control.Monad
|
|||
|
||||
import Build.TestConfig
|
||||
import Build.Version
|
||||
import Utility.PartialPrelude
|
||||
import Utility.Process
|
||||
import Utility.SafeCommand
|
||||
import Utility.ExternalSHA
|
||||
import Utility.Env
|
||||
import qualified Git.Version
|
||||
import Utility.DottedVersion
|
||||
|
||||
tests :: [TestCase]
|
||||
tests =
|
||||
|
@ -29,6 +32,7 @@ tests =
|
|||
, TestCase "rsync" $ requireCmd "rsync" "rsync --version >/dev/null"
|
||||
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
|
||||
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
||||
, TestCase "wget supports -q --show-progress" checkWgetQuietProgress
|
||||
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
||||
, TestCase "nice" $ testCmd "nice" "nice true >/dev/null"
|
||||
, TestCase "ionice" $ testCmd "ionice" "ionice -c3 true >/dev/null"
|
||||
|
@ -96,6 +100,18 @@ getGitVersion = do
|
|||
error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
|
||||
return $ Config "gitversion" $ StringConfig $ show v
|
||||
|
||||
checkWgetQuietProgress :: Test
|
||||
checkWgetQuietProgress = Config "wgetquietprogress" . BoolConfig
|
||||
. maybe False (>= normalize "1.16")
|
||||
<$> getWgetVersion
|
||||
|
||||
getWgetVersion :: IO (Maybe DottedVersion)
|
||||
getWgetVersion = extract <$> readProcess "wget" ["--version"]
|
||||
where
|
||||
extract s = case lines s of
|
||||
[] -> Nothing
|
||||
(l:_) -> normalize <$> headMaybe (drop 2 $ words l)
|
||||
|
||||
getSshConnectionCaching :: Test
|
||||
getSshConnectionCaching = Config "sshconnectioncaching" . BoolConfig <$>
|
||||
boolSystem "sh" [Param "-c", Param "ssh -o ControlPersist=yes -V >/dev/null 2>/dev/null"]
|
||||
|
|
|
@ -5,18 +5,16 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Git.Version where
|
||||
module Git.Version (
|
||||
installed,
|
||||
normalize,
|
||||
GitVersion,
|
||||
) where
|
||||
|
||||
import Common
|
||||
import Utility.DottedVersion
|
||||
|
||||
data GitVersion = GitVersion String Integer
|
||||
deriving (Eq)
|
||||
|
||||
instance Ord GitVersion where
|
||||
compare (GitVersion _ x) (GitVersion _ y) = compare x y
|
||||
|
||||
instance Show GitVersion where
|
||||
show (GitVersion s _) = s
|
||||
type GitVersion = DottedVersion
|
||||
|
||||
installed :: IO GitVersion
|
||||
installed = normalize . extract <$> readProcess "git" ["--version"]
|
||||
|
@ -24,20 +22,3 @@ installed = normalize . extract <$> readProcess "git" ["--version"]
|
|||
extract s = case lines s of
|
||||
[] -> ""
|
||||
(l:_) -> unwords $ drop 2 $ words l
|
||||
|
||||
{- To compare dotted versions like 1.7.7 and 1.8, they are normalized to
|
||||
- a somewhat arbitrary integer representation. -}
|
||||
normalize :: String -> GitVersion
|
||||
normalize v = GitVersion v $
|
||||
sum $ mult 1 $ reverse $ extend precision $ take precision $
|
||||
map readi $ split "." v
|
||||
where
|
||||
extend n l = l ++ replicate (n - length l) 0
|
||||
mult _ [] = []
|
||||
mult n (x:xs) = (n*x) : mult (n*10^width) xs
|
||||
readi :: String -> Integer
|
||||
readi s = case reads s of
|
||||
((x,_):_) -> x
|
||||
_ -> 0
|
||||
precision = 10 -- number of segments of the version to compare
|
||||
width = length "yyyymmddhhmmss" -- maximum width of a segment
|
||||
|
|
36
Utility/DottedVersion.hs
Normal file
36
Utility/DottedVersion.hs
Normal file
|
@ -0,0 +1,36 @@
|
|||
{- dotted versions, such as 1.0.1
|
||||
-
|
||||
- Copyright 2011-2014 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- License: BSD-2-clause
|
||||
-}
|
||||
|
||||
module Utility.DottedVersion where
|
||||
|
||||
import Common
|
||||
|
||||
data DottedVersion = DottedVersion String Integer
|
||||
deriving (Eq)
|
||||
|
||||
instance Ord DottedVersion where
|
||||
compare (DottedVersion _ x) (DottedVersion _ y) = compare x y
|
||||
|
||||
instance Show DottedVersion where
|
||||
show (DottedVersion s _) = s
|
||||
|
||||
{- To compare dotted versions like 1.7.7 and 1.8, they are normalized to
|
||||
- a somewhat arbitrary integer representation. -}
|
||||
normalize :: String -> DottedVersion
|
||||
normalize v = DottedVersion v $
|
||||
sum $ mult 1 $ reverse $ extend precision $ take precision $
|
||||
map readi $ split "." v
|
||||
where
|
||||
extend n l = l ++ replicate (n - length l) 0
|
||||
mult _ [] = []
|
||||
mult n (x:xs) = (n*x) : mult (n*10^width) xs
|
||||
readi :: String -> Integer
|
||||
readi s = case reads s of
|
||||
((x,_):_) -> x
|
||||
_ -> 0
|
||||
precision = 10 -- number of segments of the version to compare
|
||||
width = length "yyyymmddhhmmss" -- maximum width of a segment
|
|
@ -191,9 +191,18 @@ download' quiet url file uo =
|
|||
wget = go "wget" $ headerparams ++ quietopt "-q" ++ wgetparams
|
||||
{- Regular wget needs --clobber to continue downloading an existing
|
||||
- file. On Android, busybox wget is used, which does not
|
||||
- support, or need that option. -}
|
||||
- support, or need that option.
|
||||
-
|
||||
- When the wget version is new enough, pass options for
|
||||
- a less cluttered download display.
|
||||
-}
|
||||
#ifndef __ANDROID__
|
||||
wgetparams = [Params "--clobber -c -O"]
|
||||
wgetparams = catMaybes
|
||||
[ if Build.SysConfig.wgetquietprogress
|
||||
then Just $ Params "-q --show-progress"
|
||||
else Nothing
|
||||
, Just $ Params "--clobber -c -O"
|
||||
]
|
||||
#else
|
||||
wgetparams = [Params "-c -O"]
|
||||
#endif
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -7,6 +7,8 @@ git-annex (5.20141204) UNRELEASED; urgency=medium
|
|||
* Urls can now be claimed by remotes. This will allow creating,
|
||||
for example, a external special remote that handles magnet: and
|
||||
*.torrent urls.
|
||||
* Use wget -q --show-progress for less verbose wget output,
|
||||
when built with wget 1.16.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Fri, 05 Dec 2014 13:42:08 -0400
|
||||
|
||||
|
|
Loading…
Reference in a new issue