summaryrefslogtreecommitdiff
path: root/Build/Configure.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <id@joeyh.name>2013-05-10 15:36:31 -0500
committerGravatar Joey Hess <joey@kitenet.net>2013-05-10 18:51:21 -0400
commit0986ef0f888fb73dabe5f069e67e41a0b5fa090f (patch)
treeea7ac656d5515013dd522607918f4c955d767c4c /Build/Configure.hs
parent6ac5856873e1701484ac6086cb2edd82d801f3ae (diff)
only update version in cabal file on release builds
This was being very annoying in windows. (cherry picked from commit ccce4b0ded18c6eecea5d666f38f55a4fc6a1977)
Diffstat (limited to 'Build/Configure.hs')
-rw-r--r--Build/Configure.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 46a3a2452..a448c5f02 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -9,6 +9,7 @@ import Control.Applicative
import System.FilePath
import System.Environment
import Data.Maybe
+import Control.Monad.IfElse
import Build.TestConfig
import Utility.SafeCommand
@@ -81,19 +82,21 @@ testCp k option = TestCase cmd $ testCmd k cmdline
cmd = "cp " ++ option
cmdline = cmd ++ " " ++ testFile ++ " " ++ testFile ++ ".new"
+{- For release builds, VERSION_FROM_CHANGELOG makes it use just the most
+ - recent version from the changelog. -}
+isReleaseBuild :: IO Bool
+isReleaseBuild = isJust <$> catchMaybeIO (getEnv "VERSION_FROM_CHANGELOG")
+
{- Version is usually based on the major version from the changelog,
- plus the date of the last commit, plus the git rev of that commit.
- This works for autobuilds, ad-hoc builds, etc.
-
- - For official builds, VERSION_FROM_CHANGELOG makes it use just the most
- - recent version from the changelog.
- -
- If git or a git repo is not available, or something goes wrong,
- just use the version from the changelog. -}
getVersion :: Test
getVersion = do
changelogversion <- getChangelogVersion
- version <- ifM (isJust <$> catchMaybeIO (getEnv "VERSION_FROM_CHANGELOG"))
+ version <- ifM (isReleaseBuild)
( return changelogversion
, catchDefaultIO changelogversion $ do
let major = takeWhile (/= '.') changelogversion
@@ -160,7 +163,8 @@ run ts = do
then writeSysConfig $ androidConfig config
else writeSysConfig config
cleanup
- cabalSetup
+ whenM (isReleaseBuild) $
+ cabalSetup
{- Hard codes some settings to cross-compile for Android. -}
androidConfig :: [Config] -> [Config]