summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/Configure.hs16
-rw-r--r--Git/Version.hs33
-rw-r--r--Utility/DottedVersion.hs36
-rw-r--r--Utility/Url.hs13
-rw-r--r--debian/changelog2
5 files changed, 72 insertions, 28 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 31b7ccd25..0a0e87c3a 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -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"]
diff --git a/Git/Version.hs b/Git/Version.hs
index 5c61f859e..1c53b4bfd 100644
--- a/Git/Version.hs
+++ b/Git/Version.hs
@@ -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
diff --git a/Utility/DottedVersion.hs b/Utility/DottedVersion.hs
new file mode 100644
index 000000000..14aa16da9
--- /dev/null
+++ b/Utility/DottedVersion.hs
@@ -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
diff --git a/Utility/Url.hs b/Utility/Url.hs
index cb950b824..cc15c82d0 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -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
diff --git a/debian/changelog b/debian/changelog
index 39f165d6b..0b21cb4af 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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