Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-7405 Stage banners as requested in modules

  • Loading branch information...
commit dfeb366b82a6eda05d54b4a5a4566d8f018d4461 1 parent 5864a3c
@acmorrow acmorrow authored
Showing with 30 additions and 10 deletions.
  1. +1 −0  SConstruct
  2. +29 −10 src/mongo/SConscript
View
1  SConstruct
@@ -285,6 +285,7 @@ env = Environment( BUILD_DIR=variantDir,
CLIENT_SCONSTRUCT='#distsrc/client/SConstruct',
DIST_ARCHIVE_SUFFIX='.tgz',
EXTRAPATH=get_option("extrapath"),
+ MODULE_BANNERS=[],
MODULE_LIBDEPS_MONGOD=[],
MODULE_LIBDEPS_MONGOS=[],
MODULE_LIBDEPS_MONGOSHELL=[],
View
39 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")
@@ -721,18 +722,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" )
Please sign in to comment.
Something went wrong with that request. Please try again.