0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

SERVER-7405 Stage banners as requested in modules

This commit is contained in:
Andrew Morrow 2012-11-12 15:27:57 -05:00
parent 5864a3ca45
commit dfeb366b82
2 changed files with 30 additions and 10 deletions

View File

@ -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 File

@ -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" )