summaryrefslogtreecommitdiff
path: root/source4/wscript
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-06-28 13:40:32 +1000
committerAndrew Tridgell <tridge@samba.org>2010-06-29 14:28:08 +1000
commit30dc87dab98a864ea640fb1df693b6eb8df6a920 (patch)
tree15346580ebdda6bf5ff94b798382424fd832a258 /source4/wscript
parent3774ba350e6b828512e693b982e0927877cd13eb (diff)
downloadsamba-30dc87dab98a864ea640fb1df693b6eb8df6a920.tar.gz
samba-30dc87dab98a864ea640fb1df693b6eb8df6a920.tar.bz2
samba-30dc87dab98a864ea640fb1df693b6eb8df6a920.zip
build: only use git when found by configure
this rebuilds version.h whenever the git version changes, so we always get the right version with samba -V. That adds about 15s to the build time on each git commit, which shouldn't be too onerous
Diffstat (limited to 'source4/wscript')
-rw-r--r--source4/wscript19
1 files changed, 17 insertions, 2 deletions
diff --git a/source4/wscript b/source4/wscript
index e973d6f0ac..6bf8663d6c 100644
--- a/source4/wscript
+++ b/source4/wscript
@@ -4,14 +4,24 @@ srcdir = '..'
blddir = 'bin'
APPNAME='samba'
+VERSION=None
import sys, os
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
import wafsamba, Options, samba_dist, Scripting
-version = wafsamba.samba_version_file("./VERSION")
-VERSION=version.STRING
+def load_version(have_git=False):
+ '''load samba versions either from ./VERSION or git
+ return a version object for detailed breakdown'''
+ import samba_utils, Utils
+ if not have_git:
+ env = samba_utils.LOAD_ENVIRONMENT()
+ have_git = 'GIT' in env
+ version = wafsamba.samba_version_file("./VERSION", have_git=have_git)
+ Utils.g_module.VERSION = version.STRING
+ return version
+
samba_dist.DIST_DIRS('.')
@@ -51,6 +61,8 @@ def set_options(opt):
def configure(conf):
+ version = load_version(have_git=True)
+
conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
conf.DEFINE('PACKAGE_STRING', 'Samba ' + version.STRING, quote=True)
conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
@@ -129,6 +141,7 @@ def ctags(ctx):
# of commands in --help
def build(bld):
'''build all targets'''
+ load_version()
pass
@@ -154,10 +167,12 @@ def wafdocs(ctx):
def dist():
'''makes a tarball for distribution'''
+ load_version()
samba_dist.dist()
def distcheck():
'''test that distribution tarball builds and installs'''
+ load_version()
import Scripting
d = Scripting.distcheck
d(subdir='source4')