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.
This commit is contained in:
Joey Hess 2017-12-14 12:46:57 -04:00
parent ad6683e722
commit 308cd1383c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
24 changed files with 64 additions and 63 deletions

2
.gitignore vendored
View file

@ -4,7 +4,7 @@ Setup
*.o
tmp
test
Build/SysConfig.hs
Build/SysConfig
Build/InstallDesktopFile
Build/EvilSplicer
Build/Standalone

View file

@ -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

View file

@ -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 $

View file

@ -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 ]

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -21,7 +21,7 @@ import Annex.NumCopies
import Utility.DataUnits
import Git.Config
import Types.Distribution
import qualified Build.SysConfig
import qualified BuildInfo
import qualified Data.Text as T
@ -58,7 +58,7 @@ prefsAForm d = PrefsForm
, ("disabled", NoAutoUpgrade)
]
autoUpgradeLabel
| isJust Build.SysConfig.upgradelocation = "Auto upgrade"
| isJust BuildInfo.upgradelocation = "Auto upgrade"
| otherwise = "Auto restart on upgrade"
positiveIntField = check isPositive intField

View file

@ -11,7 +11,7 @@ module Assistant.WebApp.Documentation where
import Assistant.WebApp.Common
import Assistant.Install (standaloneAppBase)
import Build.SysConfig (packageversion)
import BuildInfo (packageversion)
import BuildInfo
{- The full license info may be included in a file on disk that can

View file

@ -24,7 +24,7 @@ import Utility.WebApp
import Utility.Yesod
import Types.Transfer
import Utility.Gpg (KeyId)
import Build.SysConfig (packageversion)
import BuildInfo (packageversion)
import Types.ScheduledActivity
import Assistant.WebApp.RepoId
import Assistant.WebApp.Pairing

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
{- Checks system configuration and generates SysConfig.hs. -}
{- Checks system configuration and generates SysConfig. -}
{-# OPTIONS_GHC -fno-warn-tabs #-}

View file

@ -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 = []

View file

@ -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)
[ ""

View file

@ -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

View file

@ -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 ()

View file

@ -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

View file

@ -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 \

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"]