aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-12-14 12:46:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-12-14 12:46:57 -0400
commit3a0bd261d9cfd395ed23ff43515523e6c6658c33 (patch)
tree9186c5daf386ba8e76c47ec869a737344a5a74d1
parentac4b4a812da85b46e7d656b12d9ff5568ef706fd (diff)
fold Build/SysConfig.hs into BuildInfo via include
This avoids warnings from stack about the module not being listed in the cabal file. So, the generated file is also renamed to Build/SysConfig. Note that the setup program seems to be cached despite these changes; I had to cabal clean to get cabal to update it so that Build/SysConfig was written. This commit was sponsored by Jochen Bartl on Patreon.
-rw-r--r--.gitignore2
-rw-r--r--Annex/Ssh.hs4
-rw-r--r--Annex/Url.hs4
-rw-r--r--Assistant.hs4
-rw-r--r--Assistant/Threads/UpgradeWatcher.hs4
-rw-r--r--Assistant/Threads/Upgrader.hs6
-rw-r--r--Assistant/Upgrade.hs4
-rw-r--r--Backend/Hash.hs12
-rw-r--r--Build/BundledPrograms.hs22
-rw-r--r--Build/Configure.hs2
-rw-r--r--Build/TestConfig.hs5
-rw-r--r--BuildInfo.hs4
-rw-r--r--Command/Assistant.hs4
-rw-r--r--Command/Version.hs6
-rw-r--r--Git/BuildVersion.hs4
-rw-r--r--Makefile2
-rw-r--r--Test.hs4
-rw-r--r--Utility/CopyFile.hs10
-rw-r--r--Utility/Gpg.hs4
-rw-r--r--Utility/Lsof.hs6
-rw-r--r--Utility/Url.hs6
21 files changed, 60 insertions, 59 deletions
diff --git a/.gitignore b/.gitignore
index 7827344d6..f841f39e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@ Setup
*.o
tmp
test
-Build/SysConfig.hs
+Build/SysConfig
Build/InstallDesktopFile
Build/EvilSplicer
Build/Standalone
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index e3d2c3d8b..5154a50a4 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -25,7 +25,7 @@ module Annex.Ssh (
import Annex.Common
import Annex.LockFile
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
import qualified Annex
import qualified Git
import qualified Git.Url
@@ -138,7 +138,7 @@ sshConnectionCachingParams socketfile =
- a different filesystem. -}
sshCacheDir :: Annex (Maybe FilePath)
sshCacheDir
- | SysConfig.sshconnectioncaching =
+ | BuildInfo.sshconnectioncaching =
ifM (fromMaybe True . annexSshCaching <$> Annex.getGitConfig)
( ifM crippledFileSystem
( maybe (return Nothing) usetmpdir =<< gettmpdir
diff --git a/Annex/Url.hs b/Annex/Url.hs
index f12408a08..f777a0ed0 100644
--- a/Annex/Url.hs
+++ b/Annex/Url.hs
@@ -16,10 +16,10 @@ module Annex.Url (
import Annex.Common
import qualified Annex
import Utility.Url as U
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
defaultUserAgent :: U.UserAgent
-defaultUserAgent = "git-annex/" ++ SysConfig.packageversion
+defaultUserAgent = "git-annex/" ++ BuildInfo.packageversion
getUserAgent :: Annex (Maybe U.UserAgent)
getUserAgent = Annex.getState $
diff --git a/Assistant.hs b/Assistant.hs
index 81aa036f6..dc358c2bd 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -48,7 +48,7 @@ import Assistant.Types.UrlRenderer
import qualified Utility.Daemon
import Utility.ThreadScheduler
import Utility.HumanTime
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
import Annex.Perms
import Utility.LogFile
#ifdef mingw32_HOST_OS
@@ -135,7 +135,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
#else
go _webappwaiter = do
#endif
- notice ["starting", desc, "version", SysConfig.packageversion]
+ notice ["starting", desc, "version", BuildInfo.packageversion]
urlrenderer <- liftIO newUrlRenderer
#ifdef WITH_WEBAPP
let webappthread = [ assist $ webAppThread d urlrenderer False cannotrun Nothing listenhost webappwaiter ]
diff --git a/Assistant/Threads/UpgradeWatcher.hs b/Assistant/Threads/UpgradeWatcher.hs
index 952db1f13..a50c84596 100644
--- a/Assistant/Threads/UpgradeWatcher.hs
+++ b/Assistant/Threads/UpgradeWatcher.hs
@@ -21,7 +21,7 @@ import Assistant.Alert
import Assistant.DaemonStatus
#ifdef WITH_WEBAPP
import Assistant.WebApp.Types
-import qualified Build.SysConfig
+import qualified BuildInfo
#endif
import Control.Concurrent.MVar
@@ -103,7 +103,7 @@ showSuccessfulUpgrade urlrenderer = do
(T.pack "Enable Automatic Upgrades")
urlrenderer ConfigEnableAutomaticUpgradeR
)
- void $ addAlert $ upgradeFinishedAlert button Build.SysConfig.packageversion
+ void $ addAlert $ upgradeFinishedAlert button BuildInfo.packageversion
#else
noop
#endif
diff --git a/Assistant/Threads/Upgrader.hs b/Assistant/Threads/Upgrader.hs
index 2bfbe5be1..75c4353b9 100644
--- a/Assistant/Threads/Upgrader.hs
+++ b/Assistant/Threads/Upgrader.hs
@@ -19,7 +19,7 @@ import Assistant.DaemonStatus
import Assistant.Alert
import Utility.NotificationBroadcaster
import qualified Annex
-import qualified Build.SysConfig
+import qualified BuildInfo
import qualified Utility.DottedVersion as DottedVersion
import Types.Distribution
#ifdef WITH_WEBAPP
@@ -31,7 +31,7 @@ import qualified Data.Text as T
upgraderThread :: UrlRenderer -> NamedThread
upgraderThread urlrenderer = namedThread "Upgrader" $
- when (isJust Build.SysConfig.upgradelocation) $ do
+ when (isJust BuildInfo.upgradelocation) $ do
{- Check for upgrade on startup, unless it was just
- upgraded. -}
unlessM (liftIO checkSuccessfulUpgrade) $
@@ -63,7 +63,7 @@ checkUpgrade urlrenderer = do
where
go Nothing = debug [ "Failed to check if upgrade is available." ]
go (Just d) = do
- let installed = DottedVersion.normalize Build.SysConfig.packageversion
+ let installed = DottedVersion.normalize BuildInfo.packageversion
let avail = DottedVersion.normalize $ distributionVersion d
let old = DottedVersion.normalize <$> distributionUrgentUpgrade d
if Just installed <= old
diff --git a/Assistant/Upgrade.hs b/Assistant/Upgrade.hs
index cd1be4d4e..3b7b48833 100644
--- a/Assistant/Upgrade.hs
+++ b/Assistant/Upgrade.hs
@@ -36,7 +36,7 @@ import Utility.UserInfo
import Utility.Gpg
import Utility.FileMode
import qualified Utility.Lsof as Lsof
-import qualified Build.SysConfig
+import qualified BuildInfo
import qualified Utility.Url as Url
import qualified Annex.Url as Url
import Utility.Tuple
@@ -329,7 +329,7 @@ downloadDistributionInfo = do
)
distributionInfoUrl :: String
-distributionInfoUrl = fromJust Build.SysConfig.upgradelocation ++ ".info"
+distributionInfoUrl = fromJust BuildInfo.upgradelocation ++ ".info"
distributionInfoSigUrl :: String
distributionInfoSigUrl = distributionInfoUrl ++ ".sig"
diff --git a/Backend/Hash.hs b/Backend/Hash.hs
index a0a16b74d..da0f7df9b 100644
--- a/Backend/Hash.hs
+++ b/Backend/Hash.hs
@@ -18,7 +18,7 @@ import Types.KeySource
import Utility.Hash
import Utility.ExternalSHA
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
import qualified Data.ByteString.Lazy as L
import Data.Char
@@ -187,11 +187,11 @@ hashFile hash file filesize = go hash
shaHasher :: HashSize -> Integer -> Either (L.ByteString -> String) (String, L.ByteString -> String)
shaHasher (HashSize hashsize) filesize
- | hashsize == 1 = use SysConfig.sha1 sha1
- | hashsize == 256 = use SysConfig.sha256 sha2_256
- | hashsize == 224 = use SysConfig.sha224 sha2_224
- | hashsize == 384 = use SysConfig.sha384 sha2_384
- | hashsize == 512 = use SysConfig.sha512 sha2_512
+ | hashsize == 1 = use BuildInfo.sha1 sha1
+ | hashsize == 256 = use BuildInfo.sha256 sha2_256
+ | hashsize == 224 = use BuildInfo.sha224 sha2_224
+ | hashsize == 384 = use BuildInfo.sha384 sha2_384
+ | hashsize == 512 = use BuildInfo.sha512 sha2_512
| otherwise = error $ "unsupported SHA size " ++ show hashsize
where
use Nothing hasher = Left $ usehasher hasher
diff --git a/Build/BundledPrograms.hs b/Build/BundledPrograms.hs
index 9e590bcf1..a6afdb763 100644
--- a/Build/BundledPrograms.hs
+++ b/Build/BundledPrograms.hs
@@ -11,7 +11,7 @@ module Build.BundledPrograms where
import Data.Maybe
-import Build.SysConfig as SysConfig
+import BuildInfo
{- Programs that git-annex uses, to include in the bundle.
-
@@ -28,7 +28,7 @@ extraBundledPrograms = catMaybes
-- integrate with the system gpg-agent, etc.
-- On Windows, gpg is bundled with git for windows.
#ifndef mingw32_HOST_OS
- [ SysConfig.gpg
+ [ BuildInfo.gpg
#else
[
#endif
@@ -75,19 +75,19 @@ preferredBundledPrograms = catMaybes
-- wget on OSX has been problematic, looking for certs in the wrong
-- places. Don't ship it, use curl or the OSX's own wget if it has
-- one.
- , ifset SysConfig.wget "wget"
+ , ifset BuildInfo.wget "wget"
#endif
#endif
- , SysConfig.lsof
- , SysConfig.gcrypt
+ , BuildInfo.lsof
+ , BuildInfo.gcrypt
#ifndef mingw32_HOST_OS
-- All these utilities are included in git for Windows
- , ifset SysConfig.curl "curl"
- , SysConfig.sha1
- , SysConfig.sha256
- , SysConfig.sha512
- , SysConfig.sha224
- , SysConfig.sha384
+ , ifset BuildInfo.curl "curl"
+ , BuildInfo.sha1
+ , BuildInfo.sha256
+ , BuildInfo.sha512
+ , BuildInfo.sha224
+ , BuildInfo.sha384
, Just "cp"
#endif
#ifdef linux_HOST_OS
diff --git a/Build/Configure.hs b/Build/Configure.hs
index f51ceef79..b40ca9250 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -1,4 +1,4 @@
-{- Checks system configuration and generates SysConfig.hs. -}
+{- Checks system configuration and generates SysConfig. -}
{-# OPTIONS_GHC -fno-warn-tabs #-}
diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs
index f6ad2df6f..2f7213f46 100644
--- a/Build/TestConfig.hs
+++ b/Build/TestConfig.hs
@@ -1,4 +1,4 @@
-{- Tests the system and generates Build.SysConfig.hs. -}
+{- Tests the system and generates SysConfig. -}
{-# OPTIONS_GHC -fno-warn-tabs #-}
@@ -42,12 +42,11 @@ instance Show Config where
valuetype (MaybeBoolConfig _) = "Maybe Bool"
writeSysConfig :: [Config] -> IO ()
-writeSysConfig config = writeFile "Build/SysConfig.hs" body
+writeSysConfig config = writeFile "Build/SysConfig" body
where
body = unlines $ header ++ map show config ++ footer
header = [
"{- Automatically generated. -}"
- , "module Build.SysConfig where"
, ""
]
footer = []
diff --git a/BuildInfo.hs b/BuildInfo.hs
index 79253ee4f..e00f27a96 100644
--- a/BuildInfo.hs
+++ b/BuildInfo.hs
@@ -1,4 +1,4 @@
-{- git-annex build info reporting
+{- git-annex build info
-
- Copyright 2013-2017 Joey Hess <id@joeyh.name>
-
@@ -13,6 +13,8 @@ import Data.List
import Data.Ord
import qualified Data.CaseInsensitive as CI
+#include "Build/SysConfig"
+
buildFlags :: [String]
buildFlags = filter (not . null)
[ ""
diff --git a/Command/Assistant.hs b/Command/Assistant.hs
index af63778e6..70088674d 100644
--- a/Command/Assistant.hs
+++ b/Command/Assistant.hs
@@ -12,7 +12,7 @@ import qualified Command.Watch
import Annex.Init
import Annex.Path
import Config.Files
-import qualified Build.SysConfig
+import qualified BuildInfo
import Utility.HumanTime
import Assistant.Install
@@ -78,7 +78,7 @@ autoStart o = do
f <- autoStartFile
giveup $ "Nothing listed in " ++ f
program <- programPath
- haveionice <- pure Build.SysConfig.ionice <&&> inPath "ionice"
+ haveionice <- pure BuildInfo.ionice <&&> inPath "ionice"
pids <- forM dirs $ \d -> do
putStrLn $ "git-annex autostart in " ++ d
mpid <- catchMaybeIO $ go haveionice program d
diff --git a/Command/Version.hs b/Command/Version.hs
index 7af928750..5f9fcce67 100644
--- a/Command/Version.hs
+++ b/Command/Version.hs
@@ -8,7 +8,7 @@
module Command.Version where
import Command
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
import Annex.Version
import BuildInfo
import Types.Key
@@ -61,7 +61,7 @@ showVersion = do
showPackageVersion :: IO ()
showPackageVersion = do
- vinfo "git-annex version" SysConfig.packageversion
+ vinfo "git-annex version" BuildInfo.packageversion
vinfo "build flags" $ unwords buildFlags
vinfo "dependency versions" $ unwords dependencyVersions
vinfo "key/value backends" $ unwords $
@@ -70,7 +70,7 @@ showPackageVersion = do
showRawVersion :: IO ()
showRawVersion = do
- putStr SysConfig.packageversion
+ putStr BuildInfo.packageversion
hFlush stdout -- no newline, so flush
vinfo :: String -> String -> IO ()
diff --git a/Git/BuildVersion.hs b/Git/BuildVersion.hs
index 50e4a3ae7..7d1c53aa0 100644
--- a/Git/BuildVersion.hs
+++ b/Git/BuildVersion.hs
@@ -8,14 +8,14 @@
module Git.BuildVersion where
import Git.Version
-import qualified Build.SysConfig
+import qualified BuildInfo
{- Using the version it was configured for avoids running git to check its
- version, at the cost that upgrading git won't be noticed.
- This is only acceptable because it's rare that git's version influences
- code's behavior. -}
buildVersion :: GitVersion
-buildVersion = normalize Build.SysConfig.gitversion
+buildVersion = normalize BuildInfo.gitversion
older :: String -> Bool
older n = buildVersion < normalize n
diff --git a/Makefile b/Makefile
index cf3edc9a0..51f86c3e2 100644
--- a/Makefile
+++ b/Makefile
@@ -113,7 +113,7 @@ docs: mans
clean:
if [ "$(BUILDER)" != ./Setup ] && [ "$(BUILDER)" != cabal ]; then $(BUILDER) clean; fi
rm -rf tmp dist git-annex $(mans) configure *.tix .hpc \
- doc/.ikiwiki html dist tags Build/SysConfig.hs \
+ doc/.ikiwiki html dist tags Build/SysConfig \
Setup Build/InstallDesktopFile Build/EvilSplicer \
Build/Standalone Build/OSXMkLibs Build/LinuxMkLibs \
Build/DistributionUpdate Build/BuildVersion Build/MakeMans \
diff --git a/Test.hs b/Test.hs
index 766a6ca96..60876124f 100644
--- a/Test.hs
+++ b/Test.hs
@@ -88,7 +88,7 @@ import qualified Annex.Action
import qualified Logs.View
import qualified Utility.Path
import qualified Utility.FileMode
-import qualified Build.SysConfig
+import qualified BuildInfo
import qualified Utility.Format
import qualified Utility.Verifiable
import qualified Utility.Process
@@ -1622,7 +1622,7 @@ test_rsync_remote = intmpclonerepo $ do
annexed_present annexedfile
test_bup_remote :: Assertion
-test_bup_remote = intmpclonerepo $ when Build.SysConfig.bup $ do
+test_bup_remote = intmpclonerepo $ when BuildInfo.bup $ do
dir <- absPath "dir" -- bup special remote needs an absolute path
createDirectory dir
git_annex "initremote" (words $ "foo type=bup encryption=none buprepo="++dir) @? "initremote failed"
diff --git a/Utility/CopyFile.hs b/Utility/CopyFile.hs
index 01c600504..4ad85b7db 100644
--- a/Utility/CopyFile.hs
+++ b/Utility/CopyFile.hs
@@ -14,7 +14,7 @@ module Utility.CopyFile (
) where
import Common
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
data CopyMetaData
-- Copy timestamps when possible, but no other metadata, and
@@ -34,11 +34,11 @@ copyFileExternal meta src dest = do
where
#ifndef __ANDROID__
params = map snd $ filter fst
- [ (SysConfig.cp_reflink_auto, Param "--reflink=auto")
- , (allmeta && SysConfig.cp_a, Param "-a")
- , (allmeta && SysConfig.cp_p && not SysConfig.cp_a
+ [ (BuildInfo.cp_reflink_auto, Param "--reflink=auto")
+ , (allmeta && BuildInfo.cp_a, Param "-a")
+ , (allmeta && BuildInfo.cp_p && not BuildInfo.cp_a
, Param "-p")
- , (not allmeta && SysConfig.cp_preserve_timestamps
+ , (not allmeta && BuildInfo.cp_preserve_timestamps
, Param "--preserve=timestamps")
]
#else
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index 2ffb0add6..4af0067bb 100644
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -10,7 +10,7 @@
module Utility.Gpg where
import Common
-import qualified Build.SysConfig as SysConfig
+import qualified BuildInfo
#ifndef mingw32_HOST_OS
import System.Posix.Types
import qualified System.Posix.IO
@@ -35,7 +35,7 @@ newtype GpgCmd = GpgCmd { unGpgCmd :: String }
- command was found at configure time, use it, or otherwise, "gpg". -}
mkGpgCmd :: Maybe FilePath -> GpgCmd
mkGpgCmd (Just c) = GpgCmd c
-mkGpgCmd Nothing = GpgCmd (fromMaybe "gpg" SysConfig.gpg)
+mkGpgCmd Nothing = GpgCmd (fromMaybe "gpg" BuildInfo.gpg)
boolGpgCmd :: GpgCmd -> [CommandParam] -> IO Bool
boolGpgCmd (GpgCmd cmd) = boolSystem cmd
diff --git a/Utility/Lsof.hs b/Utility/Lsof.hs
index e3ed709ec..ab80258b7 100644
--- a/Utility/Lsof.hs
+++ b/Utility/Lsof.hs
@@ -10,7 +10,7 @@
module Utility.Lsof where
import Common
-import Build.SysConfig as SysConfig
+import BuildInfo
import Utility.Env
import System.Posix.Types
@@ -23,12 +23,12 @@ type CmdLine = String
data ProcessInfo = ProcessInfo ProcessID CmdLine
deriving (Show)
-{- lsof is not in PATH on all systems, so SysConfig may have the absolute
+{- lsof is not in PATH on all systems, so BuildInfo may have the absolute
- path where the program was found. Make sure at runtime that lsof is
- available, and if it's not in PATH, adjust PATH to contain it. -}
setup :: IO ()
setup = do
- let cmd = fromMaybe "lsof" SysConfig.lsof
+ let cmd = fromMaybe "lsof" BuildInfo.lsof
when (isAbsolute cmd) $ do
path <- getSearchPath
let path' = takeDirectory cmd : path
diff --git a/Utility/Url.hs b/Utility/Url.hs
index 3ebbf4160..14a755f26 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -33,7 +33,7 @@ module Utility.Url (
import Common
import Utility.Tmp
-import qualified Build.SysConfig
+import qualified BuildInfo
import Network.URI
import Network.HTTP.Types
@@ -163,7 +163,7 @@ getUrlInfo url uo = case parseURIRelaxed url of
sz <- getFileSize' f stat
found (Just sz) Nothing
Nothing -> dne
- | Build.SysConfig.curl -> existscurl u
+ | BuildInfo.curl -> existscurl u
| otherwise -> dne
Nothing -> dne
where
@@ -281,7 +281,7 @@ download' quiet url file uo = do
-}
#ifndef __ANDROID__
wgetparams = concat
- [ if Build.SysConfig.wgetunclutter && not quiet
+ [ if BuildInfo.wgetunclutter && not quiet
then [Param "-nv", Param "--show-progress"]
else []
, [ Param "--clobber", Param "-c", Param "-O"]