Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Oct 2020 10:49:47 +0000 (UTC)
From:      Kurt Jaeger <pi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r553254 - in head/databases/mongodb36: . files
Message-ID:  <202010251049.09PAnlU3078941@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pi
Date: Sun Oct 25 10:49:46 2020
New Revision: 553254
URL: https://svnweb.freebsd.org/changeset/ports/553254

Log:
  databases/mongodb36: allow build with python 3
  
  PR:		249597
  Submitted by:	mikael
  Reported by:	swills
  Reviewed by:	Ronald Klop <ronald-lists@klop.ws>
  Approved by:	dev@dudu.ro (maintainer)

Added:
  head/databases/mongodb36/files/patch-python3   (contents, props changed)
Modified:
  head/databases/mongodb36/Makefile

Modified: head/databases/mongodb36/Makefile
==============================================================================
--- head/databases/mongodb36/Makefile	Sun Oct 25 10:47:14 2020	(r553253)
+++ head/databases/mongodb36/Makefile	Sun Oct 25 10:49:46 2020	(r553254)
@@ -23,14 +23,14 @@ LICENSE_PERMS_SSPLv1=	dist-mirror dist-sell pkg-mirror
 ONLY_FOR_ARCHS=	aarch64 amd64
 ONLY_FOR_ARCHS_REASON=	"Only supported on amd64 and aarch64 (i386 deprecated in v3)"
 
-BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cheetah>=2.4.4:devel/py-cheetah@${PY_FLAVOR} \
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} \
 		${PY_TYPING} \
 		${PYTHON_PKGNAMEPREFIX}yaml>=3.11:devel/py-yaml@${PY_FLAVOR}
 LIB_DEPENDS=	libboost_system.so:devel/boost-libs \
 		libpcre.so:devel/pcre \
 		libsnappy.so:archivers/snappy
 
-USES=		compiler:c++14-lang cpe python:2.7,build scons:python2 shebangfix
+USES=		compiler:c++14-lang cpe python:3.5+,build scons shebangfix
 USE_RC_SUBR=	mongod
 
 CONFLICTS_BUILD=	mongo-cxx-driver

Added: head/databases/mongodb36/files/patch-python3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/mongodb36/files/patch-python3	Sun Oct 25 10:49:46 2020	(r553254)
@@ -0,0 +1,1977 @@
+From cbfdc41e1d05aa1bfc298b8bd1a2fae9b3477e87 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:26:21 +0200
+Subject: [PATCH 01/24] Backport SConstruct patch
+
+---
+ SConstruct | 61 ++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 32 insertions(+), 29 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index cd4100e9..63f22862 100644
+--- SConstruct
++++ SConstruct
+@@ -28,8 +28,8 @@ import mongo.platform as mongo_platform
+ import mongo.toolchain as mongo_toolchain
+ import mongo.generators as mongo_generators
+ 
+-EnsurePythonVersion(2, 7)
+-EnsureSConsVersion(2, 5)
++EnsurePythonVersion(3, 5)
++EnsureSConsVersion(3, 0, 4)
+ 
+ from buildscripts import utils
+ from buildscripts import moduleconfig
+@@ -389,7 +389,7 @@ win_version_min_choices = {
+ }
+ 
+ add_option('win-version-min',
+-    choices=win_version_min_choices.keys(),
++    choices=list(win_version_min_choices.keys()),
+     default=None,
+     help='minimum Windows version to support',
+     type='choice',
+@@ -482,7 +482,7 @@ try:
+ except IOError as e:
+     # If the file error wasn't because the file is missing, error out
+     if e.errno != errno.ENOENT:
+-        print("Error opening version.json: {0}".format(e.strerror))
++        print(("Error opening version.json: {0}".format(e.strerror)))
+         Exit(1)
+ 
+     version_data = {
+@@ -491,14 +491,14 @@ except IOError as e:
+     }
+ 
+ except ValueError as e:
+-    print("Error decoding version.json: {0}".format(e))
++    print(("Error decoding version.json: {0}".format(e)))
+     Exit(1)
+ 
+ # Setup the command-line variables
+ def variable_shlex_converter(val):
+     # If the argument is something other than a string, propogate
+     # it literally.
+-    if not isinstance(val, basestring):
++    if not isinstance(val, str):
+         return val
+     parse_mode = get_option('variable-parse-mode')
+     if parse_mode == 'auto':
+@@ -563,7 +563,7 @@ def variable_distsrc_converter(val):
+ 
+ variables_files = variable_shlex_converter(get_option('variables-files'))
+ for file in variables_files:
+-    print("Using variable customization file %s" % file)
++    print(("Using variable customization file %s" % file))
+ 
+ env_vars = Variables(
+     files=variables_files,
+@@ -572,7 +572,7 @@ env_vars = Variables(
+ 
+ sconsflags = os.environ.get('SCONSFLAGS', None)
+ if sconsflags:
+-    print("Using SCONSFLAGS environment variable arguments: %s" % sconsflags)
++    print(("Using SCONSFLAGS environment variable arguments: %s" % sconsflags))
+ 
+ env_vars.Add('ABIDW',
+     help="Configures the path to the 'abidw' (a libabigail) utility")
+@@ -691,7 +691,7 @@ env_vars.Add('MONGO_DISTNAME',
+ def validate_mongo_version(key, val, env):
+     regex = r'^(\d+)\.(\d+)\.(\d+)-?((?:(rc)(\d+))?.*)?'
+     if not re.match(regex, val):
+-        print("Invalid MONGO_VERSION '{}', or could not derive from version.json or git metadata. Please add a conforming MONGO_VERSION=x.y.z[-extra] as an argument to SCons".format(val))
++        print(("Invalid MONGO_VERSION '{}', or could not derive from version.json or git metadata. Please add a conforming MONGO_VERSION=x.y.z[-extra] as an argument to SCons".format(val)))
+         Exit(1)
+ 
+ env_vars.Add('MONGO_VERSION',
+@@ -822,12 +822,12 @@ if installDir[0] not in ['$', '#']:
+         Exit(1)
+ 
+ sconsDataDir = Dir(buildDir).Dir('scons')
+-SConsignFile(str(sconsDataDir.File('sconsign')))
++SConsignFile(str(sconsDataDir.File('sconsign.py3')))
+ 
+ def printLocalInfo():
+     import sys, SCons
+-    print( "scons version: " + SCons.__version__ )
+-    print( "python version: " + " ".join( [ `i` for i in sys.version_info ] ) )
++    print(( "scons version: " + SCons.__version__ ))
++    print(( "python version: " + " ".join( [ repr(i) for i in sys.version_info ] ) ))
+ 
+ printLocalInfo()
+ 
+@@ -904,12 +904,12 @@ env.AddMethod(mongo_platform.env_os_is_wrapper, 'TargetOSIs')
+ env.AddMethod(mongo_platform.env_get_os_name_wrapper, 'GetTargetOSName')
+ 
+ def fatal_error(env, msg, *args):
+-    print(msg.format(*args))
++    print((msg.format(*args)))
+     Exit(1)
+ 
+ def conf_error(env, msg, *args):
+-    print(msg.format(*args))
+-    print("See {0} for details".format(env.File('$CONFIGURELOG').abspath))
++    print((msg.format(*args)))
++    print(("See {0} for details".format(env.File('$CONFIGURELOG').abspath)))
+     Exit(1)
+ 
+ env.AddMethod(fatal_error, 'FatalError')
+@@ -928,12 +928,12 @@ else:
+ env.AddMethod(lambda env: env['VERBOSE'], 'Verbose')
+ 
+ if has_option('variables-help'):
+-    print(env_vars.GenerateHelpText(env))
++    print((env_vars.GenerateHelpText(env)))
+     Exit(0)
+ 
+ #unknown_vars = env_vars.UnknownVariables()
+ #if unknown_vars:
+-#    env.FatalError("Unknown variables specified: {0}", ", ".join(unknown_vars.keys()))
++#    env.FatalError("Unknown variables specified: {0}", ", ".join(list(unknown_vars.keys())))
+ 
+ def set_config_header_define(env, varname, varval = 1):
+     env['CONFIG_HEADER_DEFINES'][varname] = varval
+@@ -1018,7 +1018,7 @@ def CheckForProcessor(context, which_arch):
+         context.Result(ret)
+         return ret;
+ 
+-    for k in processor_macros.keys():
++    for k in list(processor_macros.keys()):
+         ret = run_compile_check(k)
+         if ret:
+             context.Result('Detected a %s processor' % k)
+@@ -1136,7 +1136,7 @@ else:
+     env['TARGET_ARCH'] = detected_processor
+ 
+ if env['TARGET_OS'] not in os_macros:
+-    print("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS']))
++    print(("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS'])))
+ elif not detectConf.CheckForOS(env['TARGET_OS']):
+     env.ConfError("TARGET_OS ({0}) is not supported by compiler", env['TARGET_OS'])
+ 
+@@ -1922,7 +1922,7 @@ def doConfigure(myenv):
+             # form -Wno-xxx (but not -Wno-error=xxx), we also add -Wxxx to the flags. GCC does
+             # warn on unknown -Wxxx style flags, so this lets us probe for availablity of
+             # -Wno-xxx.
+-            for kw in test_mutation.keys():
++            for kw in list(test_mutation.keys()):
+                 test_flags = test_mutation[kw]
+                 for test_flag in test_flags:
+                     if test_flag.startswith("-Wno-") and not test_flag.startswith("-Wno-error="):
+@@ -1936,7 +1936,7 @@ def doConfigure(myenv):
+         # to make them real errors.
+         cloned.Append(CCFLAGS=['-Werror'])
+         conf = Configure(cloned, help=False, custom_tests = {
+-                'CheckFlag' : lambda(ctx) : CheckFlagTest(ctx, tool, extension, flag)
++                'CheckFlag' : lambda ctx : CheckFlagTest(ctx, tool, extension, flag)
+         })
+         available = conf.CheckFlag()
+         conf.Finish()
+@@ -2408,7 +2408,7 @@ def doConfigure(myenv):
+             "undefined" : myenv.File("#etc/ubsan.blacklist"),
+         }
+ 
+-        blackfiles = set([v for (k, v) in blackfiles_map.iteritems() if k in sanitizer_list])
++        blackfiles = {v for (k, v) in blackfiles_map.items() if k in sanitizer_list}
+         blacklist_options=["-fsanitize-blacklist=%s" % blackfile
+                            for blackfile in blackfiles
+                            if os.stat(blackfile.path).st_size != 0]
+@@ -2420,7 +2420,7 @@ def doConfigure(myenv):
+         llvm_symbolizer = get_option('llvm-symbolizer')
+         if os.path.isabs(llvm_symbolizer):
+             if not myenv.File(llvm_symbolizer).exists():
+-                print("WARNING: Specified symbolizer '%s' not found" % llvm_symbolizer)
++                print(("WARNING: Specified symbolizer '%s' not found" % llvm_symbolizer))
+                 llvm_symbolizer = None
+         else:
+             llvm_symbolizer = myenv.WhereIs(llvm_symbolizer)
+@@ -2710,7 +2710,7 @@ def doConfigure(myenv):
+             files = ['ssleay32.dll', 'libeay32.dll']
+             for extra_file in files:
+                 if not addOpenSslLibraryToDistArchive(extra_file):
+-                    print("WARNING: Cannot find SSL library '%s'" % extra_file)
++                    print(("WARNING: Cannot find SSL library '%s'" % extra_file))
+ 
+         # Used to import system certificate keychains
+         if conf.env.TargetOSIs('darwin'):
+@@ -2738,7 +2738,7 @@ def doConfigure(myenv):
+                         # TODO: If we could programmatically extract the paths from the info output
+                         # we could give a better message here, but brew info's machine readable output
+                         # doesn't seem to include the whole 'caveats' section.
+-                        message = subprocess.check_output([brew, "info", "openssl"])
++                        message = subprocess.check_output([brew, "info", "openssl"]).decode('utf-8')
+                         advice = textwrap.dedent(
+                             """\
+                             NOTE: HomeBrew installed to {0} appears to have OpenSSL installed.
+@@ -3114,7 +3114,7 @@ def doConfigure(myenv):
+ 
+         outputIndex = next((idx for idx in [0,1] if conf.CheckAltivecVbpermqOutput(idx)), None)
+         if outputIndex is not None:
+-	    conf.env.SetConfigHeaderDefine("MONGO_CONFIG_ALTIVEC_VEC_VBPERMQ_OUTPUT_INDEX", outputIndex)
++            conf.env.SetConfigHeaderDefine("MONGO_CONFIG_ALTIVEC_VEC_VBPERMQ_OUTPUT_INDEX", outputIndex)
+         else:
+             myenv.ConfError("Running on ppc64le, but can't find a correct vec_vbpermq output index.  Compiler or platform not supported")
+ 
+@@ -3176,9 +3176,12 @@ def doLint( env , target , source ):
+     import buildscripts.pylinters
+     buildscripts.pylinters.lint_all(None, {}, [])
+ 
+-    import buildscripts.lint
+-    if not buildscripts.lint.run_lint( [ "src/mongo/" ] ):
+-        raise Exception( "lint errors" )
++    env.Command(
++        target="#run_lint",
++        source=["buildscripts/lint.py", "src/mongo"],
++        action="$PYTHON $SOURCES[0] $SOURCES[1]",
++    )
++
+ 
+ env.Alias( "lint" , [] , [ doLint ] )
+ env.AlwaysBuild( "lint" )
+-- 
+2.28.0
+
+
+From 81abd3f9ba48ffb27919e574c8d518f4a1d8fbf3 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:27:46 +0200
+Subject: [PATCH 02/24] Backport buildscripts/aggregate_tracefiles.py
+
+---
+ buildscripts/aggregate_tracefiles.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildscripts/aggregate_tracefiles.py b/buildscripts/aggregate_tracefiles.py
+index 8f1db785..0b4bfd24 100644
+--- buildscripts/aggregate_tracefiles.py
++++ buildscripts/aggregate_tracefiles.py
+@@ -16,7 +16,7 @@ def aggregate(inputs, output):
+ 
+     args += ['-o', output]
+ 
+-    print ' '.join(args)
++    print(' '.join(args))
+     
+     return subprocess.call(args)  
+ 
+-- 
+2.28.0
+
+
+From 035a04745cb159c2a971180d1d76bca51de9245c Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:32:28 +0200
+Subject: [PATCH 03/24] Backport buildscripts/aws_ec2.py
+
+---
+ buildscripts/aws_ec2.py | 83 ++++++++++++++++++-----------------------
+ 1 file changed, 37 insertions(+), 46 deletions(-)
+
+diff --git a/buildscripts/aws_ec2.py b/buildscripts/aws_ec2.py
+index bc467d6e..f2e033a4 100755
+--- buildscripts/aws_ec2.py
++++ buildscripts/aws_ec2.py
+@@ -2,7 +2,7 @@
+ 
+ """AWS EC2 instance launcher and controller."""
+ 
+-from __future__ import print_function
++
+ 
+ import base64
+ import collections
+@@ -94,12 +94,13 @@ class AwsEc2(object):
+             if reached_state:
+                 print(" Instance {}!".format(instance.state["Name"]), file=sys.stdout)
+             else:
+-                print(" Instance in state '{}', failed to reach state '{}'{}!".format(
+-                    instance.state["Name"], state, client_error), file=sys.stdout)
++                print(
++                    " Instance in state '{}', failed to reach state '{}'{}!".format(
++                        instance.state["Name"], state, client_error), file=sys.stdout)
+             sys.stdout.flush()
+         return 0 if reached_state else 1
+ 
+-    def control_instance(  #pylint: disable=too-many-arguments,too-many-branches
++    def control_instance(  #pylint: disable=too-many-arguments,too-many-branches,too-many-locals
+             self, mode, image_id, wait_time_secs=0, show_progress=False, console_output_file=None,
+             console_screenshot_file=None):
+         """Control an AMI instance. Returns 0 & status information, if successful."""
+@@ -257,40 +258,34 @@ def main():
+     create_options = optparse.OptionGroup(parser, "Create options")
+     status_options = optparse.OptionGroup(parser, "Status options")
+ 
+-    parser.add_option("--mode",
+-                      dest="mode",
+-                      choices=_MODES,
+-                      default="status",
+-                      help="Operations to perform on an EC2 instance, choose one of"
+-                           " '{}', defaults to '%default'.".format(", ".join(_MODES)))
++    parser.add_option(
++        "--mode", dest="mode", choices=_MODES, default="status",
++        help=("Operations to perform on an EC2 instance, choose one of"
++              " '{}', defaults to '%default'.".format(", ".join(_MODES))))
+ 
+     control_options.add_option("--imageId",
+                                dest="image_id",
+                                default=None,
+                                help="EC2 image_id to perform operation on [REQUIRED for control].")
+ 
+-    control_options.add_option("--waitTimeSecs",
+-                               dest="wait_time_secs",
+-                               type=int,
+-                               default=5 * 60,
+-                               help="Time to wait for EC2 instance to reach it's new state,"
+-                                    " defaults to '%default'.")
++    control_options.add_option(
++        "--waitTimeSecs", dest="wait_time_secs", type=int, default=5 * 60,
++        help=("Time to wait for EC2 instance to reach it's new state,"
++              " defaults to '%default'."))
++
+ 
+     create_options.add_option("--ami",
+                               dest="ami",
+                               default=None,
+                               help="EC2 AMI to launch [REQUIRED for create].")
+ 
+-    create_options.add_option("--blockDevice",
+-                              dest="block_devices",
+-                              metavar="DEVICE-NAME DEVICE-SIZE-GB",
+-                              action="append",
+-                              default=[],
+-                              nargs=2,
+-                              help="EBS device name and volume size in GiB."
+-                                   " More than one device can be attached, by specifying"
+-                                   " this option more than once."
+-                                   " The device will be deleted on termination of the instance.")
++    create_options.add_option(
++        "--blockDevice", dest="block_devices", metavar="DEVICE-NAME DEVICE-SIZE-GB",
++        action="append", default=[], nargs=2,
++        help=("EBS device name and volume size in GiB."
++              " More than one device can be attached, by specifying"
++              " this option more than once."
++              " The device will be deleted on termination of the instance."))
+ 
+     create_options.add_option("--instanceType",
+                               dest="instance_type",
+@@ -302,19 +297,15 @@ def main():
+                               default=None,
+                               help="EC2 key name [REQUIRED for create].")
+ 
+-    create_options.add_option("--securityGroupIds",
+-                              dest="security_group_ids",
+-                              action="append",
+-                              default=[],
+-                              help="EC2 security group ids. More than one security group id can be"
+-                                   " added, by specifying this option more than once.")
++    create_options.add_option(
++        "--securityGroupIds", dest="security_group_ids", action="append", default=[],
++        help=("EC2 security group ids. More than one security group id can be"
++              " added, by specifying this option more than once."))
+ 
+-    create_options.add_option("--securityGroup",
+-                              dest="security_groups",
+-                              action="append",
+-                              default=[],
+-                              help="EC2 security group. More than one security group can be added,"
+-                                   " by specifying this option more than once.")
++    create_options.add_option(
++        "--securityGroup", dest="security_groups", action="append", default=[],
++        help=("EC2 security group. More than one security group can be added,"
++              " by specifying this option more than once."))
+ 
+     create_options.add_option("--subnetId",
+                               dest="subnet_id",
+@@ -350,14 +341,15 @@ def main():
+                               default=None,
+                               help="Save the status into the specified YAML file.")
+ 
+-    status_options.add_option("--consoleOutputFile", dest="console_output_file", default=None,
+-                              help="Save the console output into the specified file, if"
+-                              " available.")
++    status_options.add_option(
++        "--consoleOutputFile", dest="console_output_file", default=None,
++        help="Save the console output into the specified file, if"
++        " available.")
+ 
+-    status_options.add_option("--consoleScreenshotFile", dest="console_screenshot_file",
+-                              default=None,
+-                              help="Save the console screenshot (JPG format) into the specified"
+-                              " file, if available.")
++    status_options.add_option(
++        "--consoleScreenshotFile", dest="console_screenshot_file", default=None,
++        help="Save the console screenshot (JPG format) into the specified"
++        " file, if available.")
+ 
+     parser.add_option_group(control_options)
+     parser.add_option_group(create_options)
+@@ -382,7 +374,6 @@ def main():
+                 parser.error("Block size must be an integer")
+             block_devices[device_name] = device_size
+ 
+-        # The 'expire-on' key is a UTC time.
+         expire_dt = datetime.datetime.utcnow() + datetime.timedelta(hours=options.tag_expire_hours)
+         tags = [{"Key": "expire-on", "Value": expire_dt.strftime("%Y-%m-%d %H:%M:%S")},
+                 {"Key": "Name", "Value": options.tag_name},
+-- 
+2.28.0
+
+
+From b6f97aeb89868c62c3c01f7f2e6f47ecda846d94 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:33:44 +0200
+Subject: [PATCH 04/24] backport site_scons/mongo/__init__.py
+
+---
+ site_scons/mongo/__init__.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/site_scons/mongo/__init__.py b/site_scons/mongo/__init__.py
+index 510bd7bc..f7747809 100644
+--- site_scons/mongo/__init__.py
++++ site_scons/mongo/__init__.py
+@@ -5,4 +5,4 @@
+ def print_build_failures():
+     from SCons.Script import GetBuildFailures
+     for bf in GetBuildFailures():
+-        print "%s failed: %s" % (bf.node, bf.errstr)
++        print("%s failed: %s" % (bf.node, bf.errstr))
+-- 
+2.28.0
+
+
+From 054ba812f02c54663a76b7092aa0c1eeeaf9925e Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:35:06 +0200
+Subject: [PATCH 05/24] backport site_scons/mongo/generators.py
+
+---
+ site_scons/mongo/generators.py | 75 +++++++++++++++++++++++++++-------
+ 1 file changed, 61 insertions(+), 14 deletions(-)
+
+diff --git a/site_scons/mongo/generators.py b/site_scons/mongo/generators.py
+index c07e86a4..052f18d3 100644
+--- site_scons/mongo/generators.py
++++ site_scons/mongo/generators.py
+@@ -1,6 +1,6 @@
+ # -*- mode: python; -*-
+ 
+-import md5
++import hashlib
+ 
+ # Default and alternative generator definitions go here.
+ 
+@@ -15,22 +15,69 @@ import md5
+ # want to define them.
+ def default_buildinfo_environment_data():
+     return (
+-        ('distmod', '$MONGO_DISTMOD', True, True,),
+-        ('distarch', '$MONGO_DISTARCH', True, True,),
+-        ('cc', '$CC_VERSION', True, False,),
+-        ('ccflags', '$CCFLAGS', True, False,),
+-        ('cxx', '$CXX_VERSION', True, False,),
+-        ('cxxflags', '$CXXFLAGS', True, False,),
+-        ('linkflags', '$LINKFLAGS', True, False,),
+-        ('target_arch', '$TARGET_ARCH', True, True,),
+-        ('target_os', '$TARGET_OS', True, False,),
++        (
++            'distmod',
++            '$MONGO_DISTMOD',
++            True,
++            True,
++        ),
++        (
++            'distarch',
++            '$MONGO_DISTARCH',
++            True,
++            True,
++        ),
++        (
++            'cc',
++            '$CC_VERSION',
++            True,
++            False,
++        ),
++        (
++            'ccflags',
++            '$CCFLAGS',
++            True,
++            False,
++        ),
++        (
++            'cxx',
++            '$CXX_VERSION',
++            True,
++            False,
++        ),
++        (
++            'cxxflags',
++            '$CXXFLAGS',
++            True,
++            False,
++        ),
++        (
++            'linkflags',
++            '$LINKFLAGS',
++            True,
++            False,
++        ),
++        (
++            'target_arch',
++            '$TARGET_ARCH',
++            True,
++            True,
++        ),
++        (
++            'target_os',
++            '$TARGET_OS',
++            True,
++            False,
++        ),
+     )
+ 
++
+ # If you want buildInfo and --version to be relatively empty, set
+ # MONGO_BUILDINFO_ENVIRONMENT_DATA = empty_buildinfo_environment_data()
+ def empty_buildinfo_environment_data():
+     return ()
+ 
++
+ def default_variant_dir_generator(target, source, env, for_signature):
+ 
+     if env.GetOption('cache') != None:
+@@ -44,11 +91,11 @@ def default_variant_dir_generator(target, source, env, for_signature):
+ 
+     # Hash the named options and their values, and take the first 8 characters of the hash as
+     # the variant name
+-    hasher = md5.md5()
++    hasher = hashlib.md5()
+     for option in variant_options:
+-        hasher.update(option)
+-        hasher.update(str(env.GetOption(option)))
+-    variant_dir = hasher.hexdigest()[0:8]
++        hasher.update(option.encode('utf-8'))
++        hasher.update(str(env.GetOption(option)).encode('utf-8'))
++    variant_dir = str(hasher.hexdigest()[0:8])
+ 
+     # If our option hash yields a well known hash, replace it with its name.
+     known_variant_hashes = {
+-- 
+2.28.0
+
+
+From 83a4ac06adfa2d7adfb6dedeb6fb258130ab3015 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:36:14 +0200
+Subject: [PATCH 06/24] backport buildscripts/utils.py
+
+---
+ buildscripts/utils.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/buildscripts/utils.py b/buildscripts/utils.py
+index 69a78921..1c08bdf8 100644
+--- buildscripts/utils.py
++++ buildscripts/utils.py
+@@ -107,7 +107,7 @@ def getGitDescribe():
+             stderr=devnull,
+             stdin=devnull,
+             shell=True)
+-        return proc.communicate()[0].strip()
++        return proc.communicate()[0].strip().decode('utf-8')
+ 
+ def execsys( args ):
+     import subprocess
+@@ -122,7 +122,7 @@ def getprocesslist():
+     raw = ""
+     try:
+         raw = execsys( "/bin/ps axww" )[0]
+-    except Exception,e:
++    except Exception as e:
+         print( "can't get processlist: " + str( e ) )
+ 
+     r = re.compile( "[\r\n]+" )
+@@ -176,7 +176,7 @@ def didMongodStart( port=27017 , timeout=20 ):
+         try:
+             checkMongoPort( port )
+             return True
+-        except Exception,e:
++        except Exception as e:
+             print( e )
+             timeout = timeout - 1
+     return False
+-- 
+2.28.0
+
+
+From f38206bde5a4e7cf14a7e17b67ccf074b222c9a6 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:48:44 +0200
+Subject: [PATCH 07/24] backport site_scons/libdeps.py
+
+---
+ site_scons/libdeps.py | 46 ++++++++++++++++++++++++++-----------------
+ 1 file changed, 28 insertions(+), 18 deletions(-)
+
+diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py
+index 632ed29b..62272052 100644
+--- site_scons/libdeps.py
++++ site_scons/libdeps.py
+@@ -61,7 +61,7 @@ syslibdeps_env_var = 'SYSLIBDEPS'
+ missing_syslibdep = 'MISSING_LIBDEP_'
+ 
+ class dependency(object):
+-    Public, Private, Interface = range(3)
++    Public, Private, Interface = list(range(3))
+ 
+     def __init__(self, value, dynamic, deptype):
+         self.target_node = value
+@@ -74,7 +74,7 @@ class dependency(object):
+ class DependencyCycleError(SCons.Errors.UserError):
+     """Exception representing a cycle discovered in library dependencies."""
+ 
+-    def __init__(self, first_node ):
++    def __init__(self, first_node):
+         super(DependencyCycleError, self).__init__()
+         self.cycle_nodes = [first_node]
+ 
+@@ -89,8 +89,8 @@ def __get_sorted_direct_libdeps(node):
+         setattr(node.attributes, "libdeps_direct_sorted", direct_sorted)
+     return direct_sorted
+ 
+-def __get_libdeps(node):
+ 
++def __get_libdeps(node):
+     """Given a SCons Node, return its library dependencies, topologically sorted.
+ 
+     Computes the dependencies if they're not already cached.
+@@ -122,7 +122,7 @@ def __get_libdeps(node):
+                 marked.add(n.target_node)
+                 tsorted.append(n.target_node)
+ 
+-            except DependencyCycleError, e:
++            except DependencyCycleError as e:
+                 if len(e.cycle_nodes) == 1 or e.cycle_nodes[0] != e.cycle_nodes[-1]:
+                     e.cycle_nodes.insert(0, n.target_node)
+                 raise
+@@ -139,6 +139,7 @@ def __get_libdeps(node):
+ 
+     return tsorted
+ 
++
+ def __get_syslibdeps(node):
+     """ Given a SCons Node, return its system library dependencies.
+ 
+@@ -150,11 +151,11 @@ def __get_syslibdeps(node):
+         for lib in __get_libdeps(node):
+             for syslib in node.get_env().Flatten(lib.get_env().get(syslibdeps_env_var, [])):
+                 if syslib:
+-                    if type(syslib) in (str, unicode) and syslib.startswith(missing_syslibdep):
+-                        print("Target '%s' depends on the availability of a "
++                    if type(syslib) is str and syslib.startswith(missing_syslibdep):
++                        print(("Target '%s' depends on the availability of a "
+                               "system provided library for '%s', "
+                               "but no suitable library was found during configuration." %
+-                              (str(node), syslib[len(missing_syslibdep):]))
++                              (str(node), syslib[len(missing_syslibdep):])))
+                         node.get_env().Exit(1)
+                     syslibdeps.append(syslib)
+         setattr(node.attributes, cached_var_name, syslibdeps)
+@@ -170,17 +171,20 @@ def update_scanner(builder):
+ 
+     if old_scanner:
+         path_function = old_scanner.path_function
++
+         def new_scanner(node, env, path=()):
+             result = old_scanner.function(node, env, path)
+             result.extend(__get_libdeps(node))
+             return result
+     else:
+         path_function = None
++
+         def new_scanner(node, env, path=()):
+             return __get_libdeps(node)
+ 
+     builder.target_scanner = SCons.Scanner.Scanner(function=new_scanner,
+-                                                    path_function=path_function)
++                                                   path_function=path_function)
++
+ 
+ def get_libdeps(source, target, env, for_signature):
+     """Implementation of the special _LIBDEPS environment variable.
+@@ -191,6 +195,7 @@ def get_libdeps(source, target, env, for_signature):
+     target = env.Flatten([target])
+     return __get_libdeps(target[0])
+ 
++
+ def get_libdeps_objs(source, target, env, for_signature):
+     objs = []
+     for lib in get_libdeps(source, target, env, for_signature):
+@@ -198,6 +203,7 @@ def get_libdeps_objs(source, target, env, for_signature):
+         objs.extend(lib.sources)
+     return objs
+ 
++
+ def get_syslibdeps(source, target, env, for_signature):
+     deps = __get_syslibdeps(target[0])
+     lib_link_prefix = env.subst('$LIBLINKPREFIX')
+@@ -209,7 +215,7 @@ def get_syslibdeps(source, target, env, for_signature):
+         # they're believed to represent library short names, that should be prefixed with -l
+         # or the compiler-specific equivalent.  I.e., 'm' becomes '-lm', but 'File("m.a") is passed
+         # through whole cloth.
+-        if type(d) in (str, unicode):
++        if type(d) is str:
+             result.append('%s%s%s' % (lib_link_prefix, d, lib_link_suffix))
+         else:
+             result.append(d)
+@@ -252,8 +258,8 @@ def libdeps_emitter(target, source, env):
+     prereqs.extend(dependency(l, False, dependency.Private) for l in env.get(libdeps_env_var + '_PRIVATE', []) if l)
+ 
+     for prereq in prereqs:
+-        prereqWithIxes = SCons.Util.adjustixes(
+-            prereq.target_node, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
++        prereqWithIxes = SCons.Util.adjustixes(prereq.target_node, lib_builder.get_prefix(env),
++                                               lib_builder.get_suffix(env))
+         prereq.target_node = lib_node_factory(prereqWithIxes)
+ 
+     for t in target:
+@@ -264,16 +270,16 @@ def libdeps_emitter(target, source, env):
+     for dependent in env.get('LIBDEPS_DEPENDENTS', []):
+         if dependent is None:
+             continue
+-        dependentWithIxes = SCons.Util.adjustixes(
+-            dependent, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
++        dependentWithIxes = SCons.Util.adjustixes(dependent, lib_builder.get_prefix(env),
++                                                  lib_builder.get_suffix(env))
+         dependentNode = lib_node_factory(dependentWithIxes)
+         __append_direct_libdeps(dependentNode, [dependency(target[0], False, dependency.Public)])
+ 
+     for dependent in env.get('PROGDEPS_DEPENDENTS', []):
+         if dependent is None:
+             continue
+-        dependentWithIxes = SCons.Util.adjustixes(
+-            dependent, prog_builder.get_prefix(env), prog_builder.get_suffix(env))
++        dependentWithIxes = SCons.Util.adjustixes(dependent, prog_builder.get_prefix(env),
++                                                  prog_builder.get_suffix(env))
+         dependentNode = prog_node_factory(dependentWithIxes)
+         __append_direct_libdeps(dependentNode, [dependency(target[0], False, dependency.Public)])
+ 
+@@ -372,9 +378,11 @@ def setup_environment(env, emitting_shared=False):
+                 if 'init-no-global-side-effects' in env.Entry(lib).get_env().get('LIBDEPS_TAGS', []):
+                     result.append(str(lib))
+                 else:
+-                    result.extend(env.subst('$LINK_WHOLE_ARCHIVE_LIB_START'
+-                                            '$TARGET'
+-                                            '$LINK_WHOLE_ARCHIVE_LIB_END', target=lib).split())
++                    result.extend(
++                        env.subst(
++                            '$LINK_WHOLE_ARCHIVE_LIB_START'
++                            '$TARGET'
++                            '$LINK_WHOLE_ARCHIVE_LIB_END', target=lib).split())
+             return result
+ 
+         env['_LIBDEPS_LIBS_WITH_TAGS'] = expand_libdeps_with_extraction_flags
+@@ -394,6 +402,7 @@ def setup_environment(env, emitting_shared=False):
+         except KeyError:
+             pass
+ 
++
+ def setup_conftests(conf):
+     def FindSysLibDep(context, name, libs, **kwargs):
+         var = "LIBDEPS_" + name.upper() + "_SYSLIBDEP"
+@@ -406,4 +415,5 @@ def setup_conftests(conf):
+                 return context.Result(result)
+         context.env[var] = __missing_syslib(name)
+         return context.Result(result)
++
+     conf.AddTest('FindSysLibDep', FindSysLibDep)
+-- 
+2.28.0
+
+
+From 2bc91392ab7dba6a09aa4100a9e8666a82dd7941 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:49:45 +0200
+Subject: [PATCH 08/24] backport site_scons/site_tools/distsrc.py
+
+---
+ site_scons/site_tools/distsrc.py | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/site_scons/site_tools/distsrc.py b/site_scons/site_tools/distsrc.py
+index 861f5d9e..cc72c065 100644
+--- site_scons/site_tools/distsrc.py
++++ site_scons/site_tools/distsrc.py
+@@ -20,7 +20,7 @@ import shutil
+ import tarfile
+ import time
+ import zipfile
+-import StringIO
++import io
+ 
+ from distutils.spawn import find_executable
+ 
+@@ -28,7 +28,7 @@ __distsrc_callbacks = []
+ 
+ class DistSrcFile:
+     def __init__(self, **kwargs):
+-        [ setattr(self, key, val) for (key, val) in kwargs.items() ]
++        [ setattr(self, key, val) for (key, val) in list(kwargs.items()) ]
+ 
+     def __str__(self):
+         return self.name
+@@ -60,6 +60,7 @@ class DistSrcArchive:
+     def close(self):
+         self.archive_file.close()
+ 
++
+ class DistSrcTarArchive(DistSrcArchive):
+     def __iter__(self):
+         file_list = self.archive_file.getnames()
+@@ -82,7 +83,7 @@ class DistSrcTarArchive(DistSrcArchive):
+ 
+     def append_file_contents(self, filename, file_contents,
+             mtime=time.time(),
+-            mode=0644,
++            mode=0o644,
+             uname="root",
+             gname="root"):
+         file_metadata = tarfile.TarInfo(name=filename)
+@@ -91,7 +92,7 @@ class DistSrcTarArchive(DistSrcArchive):
+         file_metadata.uname = uname
+         file_metadata.gname = gname
+         file_metadata.size = len(file_contents)
+-        file_buf = StringIO.StringIO(file_contents)
++        file_buf = io.BytesIO(file_contents.encode('utf-8'))
+         if self.archive_mode == 'r':
+             self.archive_file.close()
+             self.archive_file = tarfile.open(
+@@ -105,6 +106,7 @@ class DistSrcTarArchive(DistSrcArchive):
+     def append_file(self, filename, localfile):
+         self.archive_file.add(localfile, arcname=filename)
+ 
++
+ class DistSrcZipArchive(DistSrcArchive):
+     def __iter__(self):
+         file_list = self.archive_file.namelist()
+@@ -119,7 +121,7 @@ class DistSrcZipArchive(DistSrcArchive):
+             name=key,
+             size=item_data.file_size,
+             mtime=time.mktime(fixed_time),
+-            mode=0775 if is_dir else 0664,
++            mode=0o775 if is_dir else 0o664,
+             type=tarfile.DIRTYPE if is_dir else tarfile.REGTYPE,
+             uid=0,
+             gid=0,
+@@ -129,7 +131,7 @@ class DistSrcZipArchive(DistSrcArchive):
+ 
+     def append_file_contents(self, filename, file_contents,
+             mtime=time.time(),
+-            mode=0644,
++            mode=0o644,
+             uname="root",
+             gname="root"):
+         self.archive_file.writestr(filename, file_contents)
+@@ -139,7 +141,7 @@ class DistSrcZipArchive(DistSrcArchive):
+ 
+ def build_error_action(msg):
+     def error_stub(target=None, source=None, env=None):
+-        print msg
++        print(msg)
+         env.Exit(1)
+     return [ error_stub ]
+ 
+@@ -162,7 +164,7 @@ def distsrc_action_generator(source, target, env, for_signature):
+ 
+     target_ext = str(target[0])[-3:]
+     if not target_ext in [ 'zip', 'tar' ]:
+-        print "Invalid file format for distsrc. Must be tar or zip file"
++        print("Invalid file format for distsrc. Must be tar or zip file")
+         env.Exit(1)
+ 
+     git_cmd = "\"%s\" archive --format %s --output %s --prefix ${MONGO_DIST_SRC_PREFIX} HEAD" % (
+@@ -173,14 +175,14 @@ def distsrc_action_generator(source, target, env, for_signature):
+         SCons.Action.Action(run_distsrc_callbacks, "Running distsrc callbacks for $TARGET")
+     ]
+ 
++
+ def add_callback(env, fn):
+     __distsrc_callbacks.append(fn)
+ 
++
+ def generate(env, **kwargs):
+     env.AddMethod(add_callback, 'AddDistSrcCallback')
+-    env['BUILDERS']['__DISTSRC'] = SCons.Builder.Builder(
+-        generator=distsrc_action_generator,
+-    )
++    env['BUILDERS']['__DISTSRC'] = SCons.Builder.Builder(generator=distsrc_action_generator, )
+ 
+     def DistSrc(env, target):
+         result = env.__DISTSRC(target=target, source=[])
+@@ -190,5 +192,6 @@ def generate(env, **kwargs):
+ 
+     env.AddMethod(DistSrc, 'DistSrc')
+ 
++
+ def exists(env):
+     return True
+-- 
+2.28.0
+
+
+From b27a4fc533e5290495f3b2d2bc78ea208d607bf5 Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:50:41 +0200
+Subject: [PATCH 09/24] backport site_scons/site_tools/mongo_benchmark.py
+
+---
+ site_scons/site_tools/mongo_benchmark.py | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/site_scons/site_tools/mongo_benchmark.py b/site_scons/site_tools/mongo_benchmark.py
+index 7c12627b..f3f84d73 100644
+--- site_scons/site_tools/mongo_benchmark.py
++++ site_scons/site_tools/mongo_benchmark.py
+@@ -11,10 +11,10 @@ def register_benchmark(env, test):
+     env.Alias('$BENCHMARK_ALIAS', test)
+ 
+ def benchmark_list_builder_action(env, target, source):
+-    ofile = open(str(target[0]), 'wb')
++    ofile = open(str(target[0]), 'w')
+     try:
+         for s in _benchmarks:
+-            print '\t' + str(s)
++            print('\t' + str(s))
+             ofile.write('%s\n' % s)
+     finally:
+         ofile.close()
+@@ -37,9 +37,10 @@ def build_benchmark(env, target, source, **kwargs):
+     bmEnv.Install("#/build/benchmark/", result[0])
+     return result
+ 
++
+ def generate(env):
+     env.Command('$BENCHMARK_LIST', env.Value(_benchmarks),
+-            Action(benchmark_list_builder_action, "Generating $TARGET"))
++                Action(benchmark_list_builder_action, "Generating $TARGET"))
+     env.AddMethod(register_benchmark, 'RegisterBenchmark')
+     env.AddMethod(build_benchmark, 'Benchmark')
+     env.Alias('$BENCHMARK_ALIAS', '$BENCHMARK_LIST')
+-- 
+2.28.0
+
+
+From 2059bb295d0d440a615241a834094dba3c840d6f Mon Sep 17 00:00:00 2001
+From: MikaelUrankar <mikael.urankar@gmail.com>
+Date: Sat, 3 Oct 2020 17:51:30 +0200
+Subject: [PATCH 10/24] backport site_scons/site_tools/mongo_integrationtest.py
+
+---
+ site_scons/site_tools/mongo_integrationtest.py | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/site_scons/site_tools/mongo_integrationtest.py b/site_scons/site_tools/mongo_integrationtest.py
+index ff9a5f45..324cac63 100644
+--- site_scons/site_tools/mongo_integrationtest.py
++++ site_scons/site_tools/mongo_integrationtest.py
+@@ -12,10 +12,10 @@ def register_integration_test(env, test):
+     env.Alias('$INTEGRATION_TEST_ALIAS', installed_test)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010251049.09PAnlU3078941>