summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@10gen.com>2012-11-12 15:27:57 -0500
committerAndrew Morrow <acm@10gen.com>2012-12-03 13:43:36 -0500
commite342644da333b6efb493bdb6f1c30479f263ee15 (patch)
tree82627160b4aa825d1ecfeca722d81e97638ba936
parentc0888b35794e3f9da8eda3b3bd67adef34fc1689 (diff)
downloadmongo-e342644da333b6efb493bdb6f1c30479f263ee15.tar.gz
SERVER-7405 Stage banners as requested in modules
Backported from dfeb366b82a6eda05d54b4a5a4566d8f018d4461
-rw-r--r--SConstruct1
-rw-r--r--src/mongo/SConscript39
2 files changed, 30 insertions, 10 deletions
diff --git a/SConstruct b/SConstruct
index d564045232c..4cbe13176fd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -294,6 +294,7 @@ env = Environment( BUILD_DIR=variantDir,
CLIENT_SCONSTRUCT='#distsrc/client/SConstruct',
DIST_ARCHIVE_SUFFIX='.tgz',
EXTRAPATH=get_option("extrapath"),
+ MODULE_BANNERS=[],
MODULETEST_LIST='#build/moduletests.txt',
MSVS_ARCH=msarch ,
PYTHON=utils.find_python(),
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 181e89b3caf..ccb0367d9f3 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -3,6 +3,7 @@
# This SConscript describes build rules for the "mongo" project.
import os
+import itertools
from buildscripts import utils
Import("env")
@@ -564,18 +565,36 @@ if installSetup.libraries:
if has_option( "sharedclient" ):
env.Install( "$INSTALL_DIR/$NIX_LIB_DIR", '#${SHLIBPREFIX}mongoclient${SHLIBSUFFIX}')
+# Stage the top-level mongodb banners
+distsrc = env.Dir('#distsrc')
+env.Append(MODULE_BANNERS = [distsrc.File('README'),
+ distsrc.File('THIRD-PARTY-NOTICES')])
+
+# If no module has introduced a file named LICENSE.txt, then inject the AGPL.
+if sum(itertools.imap(lambda x: x.name == "LICENSE.txt", env['MODULE_BANNERS'])) == 0:
+ env.Append(MODULE_BANNERS = [distsrc.File('GNU-AGPL-3.0')])
+
+# All module banners get staged to the top level of the tarfile, so we
+# need to fail if we are going to have a name collision.
+module_banner_filenames = set([f.name for f in env['MODULE_BANNERS']])
+if not len(module_banner_filenames) == len(env['MODULE_BANNERS']):
+ # TODO: Be nice and identify conflicts in error.
+ print "ERROR: Filename conflicts exist in module banners."
+ Exit(-1)
+
+# Build a set of directories containing module banners, and use that
+# to build a --transform option for each directory so that the files
+# are tar'ed up to the proper location.
+module_banner_dirs = set([Dir('#').rel_path(f.get_dir()) for f in env['MODULE_BANNERS']])
+module_banner_transforms = ["--transform %s=$SERVER_DIST_BASENAME" % d for d in module_banner_dirs]
+
env.Command(
'#/${SERVER_ARCHIVE}',
- ['#buildscripts/make_archive.py',
- '#distsrc/GNU-AGPL-3.0',
- '#distsrc/README',
- '#distsrc/THIRD-PARTY-NOTICES',
- distBinaries],
- '$PYTHON ${SOURCES[0]} -o $TARGET '
- '--transform distsrc=$SERVER_DIST_BASENAME '
- '--transform ${str(Dir(BUILD_DIR))}/mongo/stripped=$SERVER_DIST_BASENAME/bin '
- '--transform ${str(Dir(BUILD_DIR))}/mongo=$SERVER_DIST_BASENAME/bin '
- '${TEMPFILE(SOURCES[1:])}')
+ ['#buildscripts/make_archive.py'] + env["MODULE_BANNERS"] + distBinaries,
+ ' '.join(['$PYTHON ${SOURCES[0]} -o $TARGET'] + module_banner_transforms + [
+ '--transform ${str(Dir(BUILD_DIR))}/mongo/stripped=$SERVER_DIST_BASENAME/bin',
+ '--transform ${str(Dir(BUILD_DIR))}/mongo=$SERVER_DIST_BASENAME/bin',
+ '${TEMPFILE(SOURCES[1:])}']))
#final alias
env.Alias( "install", "$INSTALL_DIR" )