summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-04 11:00:42 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:25 +1000
commit1883ee6dbc2482a34ce531cec3c1c7e5e85af1e7 (patch)
treeaadeca78d8c2cb90afb691293fa5a1d6d7d15c0f
parent3ed6d7e76f9e2936e2d27ceeee8984950ea900a3 (diff)
downloadsamba-1883ee6dbc2482a34ce531cec3c1c7e5e85af1e7.tar.gz
samba-1883ee6dbc2482a34ce531cec3c1c7e5e85af1e7.tar.bz2
samba-1883ee6dbc2482a34ce531cec3c1c7e5e85af1e7.zip
s4-waf: avoid having to run waf configure before waf dist
This should be useful for building tarballs from a clean checkout
-rwxr-xr-xbuildtools/testwaf.sh1
-rw-r--r--buildtools/wafsamba/samba_dist.py23
-rw-r--r--lib/replace/wscript18
-rw-r--r--lib/talloc/wscript5
-rw-r--r--lib/tdb/wscript5
-rw-r--r--lib/tevent/wscript5
-rw-r--r--source4/lib/ldb/wscript7
-rw-r--r--source4/wscript3
8 files changed, 42 insertions, 25 deletions
diff --git a/buildtools/testwaf.sh b/buildtools/testwaf.sh
index 3be5ef96a9..a007bc8611 100755
--- a/buildtools/testwaf.sh
+++ b/buildtools/testwaf.sh
@@ -18,6 +18,7 @@ for d in $tests; do
pushd $d || exit 1
rm -rf bin
type waf
+ waf dist || exit 1
waf configure -C --enable-developer --prefix=$PREFIX || exit 1
time waf build || exit 1
time waf build || exit 1
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index eacc7c0534..3663bc0bf5 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -4,6 +4,8 @@
import Utils, os, sys, tarfile, stat, Scripting
from samba_utils import *
+dist_dirs = None
+
def add_tarfile(tar, fname, abspath):
'''add a file to the tarball'''
tinfo = tar.gettarinfo(name=abspath, arcname=fname)
@@ -17,19 +19,13 @@ def add_tarfile(tar, fname, abspath):
def dist():
-
appname = Utils.g_module.APPNAME
version = Utils.g_module.VERSION
- env = LOAD_ENVIRONMENT()
srcdir = os.path.normpath(os.path.join(os.path.dirname(Utils.g_module.root_path), Utils.g_module.srcdir))
- if not env.DIST_DIRS:
- print('You must use conf.DIST_DIRS() to set which directories to package')
- sys.exit(1)
-
- if not env.GIT:
- print('You need git installed to run waf dist')
+ if not dist_dirs:
+ print('You must use samba_dist.DIST_DIRS() to set which directories to package')
sys.exit(1)
dist_base = '%s-%s' % (appname, version)
@@ -37,14 +33,14 @@ def dist():
tar = tarfile.open(dist_name, 'w:gz')
- for dir in env.DIST_DIRS.split():
+ for dir in dist_dirs.split():
if dir.find(':') != -1:
destdir=dir.split(':')[1]
dir=dir.split(':')[0]
else:
destdir = '.'
absdir = os.path.join(srcdir, dir)
- git_cmd = [ env.GIT, 'ls-files', '--full-name', absdir ]
+ git_cmd = [ 'git', 'ls-files', '--full-name', absdir ]
try:
files = Utils.cmd_output(git_cmd).split()
except:
@@ -65,9 +61,10 @@ def dist():
@conf
-def DIST_DIRS(conf, dirs):
+def DIST_DIRS(dirs):
'''set the directories to package, relative to top srcdir'''
- if not conf.env.DIST_DIRS:
- conf.env.DIST_DIRS = dirs
+ global dist_dirs
+ if not dist_dirs:
+ dist_dirs = dirs
Scripting.dist = dist
diff --git a/lib/replace/wscript b/lib/replace/wscript
index cc718939e1..db6bc5c450 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -1,13 +1,25 @@
#!/usr/bin/env python
-srcdir = '../..'
+APPNAME = 'libreplace'
+VERSION = '1.2.1'
+
blddir = 'bin'
-import sys
+import sys, os
+
+# find the buildtools directory
+buildtools = 'buildtools ../../buildtools'
+for d in buildtools.split():
+ if os.path.exists(d):
+ srcdir = os.path.dirname(d) or '.'
+ break
+
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba
+import wafsamba, samba_dist
import Options, os, preproc
+samba_dist.DIST_DIRS('lib/replace buildtools:buildtools')
+
def set_options(opt):
opt.BUILTIN_DEFAULT('NONE')
opt.BUNDLED_EXTENSION_DEFAULT('')
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index a7476b7ec4..17b3b1d349 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -20,13 +20,16 @@ import sys
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
import wafsamba, samba_dist
+# setup what directories to put in a tarball
+samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
+
+
def set_options(opt):
opt.BUILTIN_DEFAULT('replace')
opt.BUNDLED_EXTENSION_DEFAULT('talloc', noextenion='talloc')
opt.recurse(LIBREPLACE_DIR)
def configure(conf):
- conf.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
conf.sub_config(LIBREPLACE_DIR)
if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index c4b59e3a8f..3004c2dd92 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -15,7 +15,9 @@ for d in buildtools.split():
break
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba
+import wafsamba, samba_dist
+
+samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
LIBREPLACE_DIR= srcdir + '/lib/replace'
@@ -26,7 +28,6 @@ def set_options(opt):
opt.recurse(LIBREPLACE_DIR)
def configure(conf):
- conf.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
conf.sub_config(LIBREPLACE_DIR)
if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index 41ca66ad15..976048d016 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -15,7 +15,9 @@ for d in buildtools.split():
break
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba
+import wafsamba, samba_dist
+
+samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools')
LIBREPLACE_DIR= srcdir + '/lib/replace'
LIBTALLOC_DIR= srcdir + '/lib/talloc'
@@ -27,7 +29,6 @@ def set_options(opt):
opt.recurse(LIBTALLOC_DIR)
def configure(conf):
- conf.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools')
conf.sub_config(LIBREPLACE_DIR)
conf.sub_config(LIBTALLOC_DIR)
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index ddd5e138c4..4e8b80515d 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -14,7 +14,10 @@ for d in buildtools.split():
break
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba
+import wafsamba, samba_dist
+
+samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
+ lib/tdb:lib/tdb lib/tevent:lib/tevent buildtools:buildtools''')
LIBTDB_DIR= srcdir + '/lib/tdb'
@@ -28,8 +31,6 @@ def set_options(opt):
opt.recurse(LIBTEVENT_DIR)
def configure(conf):
- conf.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
- lib/tdb:lib/tdb lib/tevent:lib/tevent buildtools:buildtools''')
conf.sub_config(LIBTDB_DIR)
conf.sub_config(LIBTEVENT_DIR)
conf.sub_config(LIBPOPT_DIR)
diff --git a/source4/wscript b/source4/wscript
index 816093e293..36796d6333 100644
--- a/source4/wscript
+++ b/source4/wscript
@@ -10,6 +10,8 @@ import sys, os
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
import wafsamba, Options, samba_dist
+samba_dist.DIST_DIRS('.')
+
# install in /usr/local/samba by default
Options.default_prefix = '/usr/local/samba'
@@ -39,7 +41,6 @@ def configure(conf):
conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
conf.DEFINE('_SAMBA_BUILD_', 4, add_to_cflags=True)
conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
- conf.DIST_DIRS('.')
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')