SERVER-88284 upgrade windows cyrus sasl to 2.1.28 (#26444)

GitOrigin-RevId: f068fc1b1ccc00d045e17e98b9df676149ddfe27
This commit is contained in:
Daniel Moody 2024-11-26 17:31:35 -05:00 committed by MongoDB Bot
parent 2564e09af4
commit 1d98379c16
10 changed files with 93 additions and 18 deletions

View File

@ -27,6 +27,7 @@ a notice will be included in
| [benchmark] | Apache-2.0 | 1.5.2 | | |
| [Boost] | BSL-1.0 | 1.79.0 | | ✗ |
| [c-ares] | MIT | 1.19.1 | | ✗ |
| [Cyrus SASL] | BSD-Attribution-HPND-disclaimer | 2.1.28 | unknown | |
| [fmt] | BSD-2-Clause | 7.1.3 | | ✗ |
| [GPerfTools] | BSD-3-Clause | 2.9.1 | | ✗ |
| [gRPC] | Apache-2.0 | 1.46.6 | | ✗ |
@ -66,6 +67,7 @@ a notice will be included in
[ASIO]: https://github.com/chriskohlhoff/asio
[benchmark]: https://github.com/google/benchmark
[Boost]: http://www.boost.org/
[Cyrus SASL]: https://www.cyrusimap.org/sasl/
[fmt]: http://fmtlib.net/
[GPerfTools]: https://github.com/gperftools/gperftools
[ICU4]: http://site.icu-project.org/download/

View File

@ -1805,6 +1805,14 @@ if unknown_vars:
install_actions.setup(env, get_option('install-action'))
if env.TargetOSIs("windows") and os.path.exists(
env.File("#/src/mongo/db/modules/enterprise/SConscript").abspath):
# the sasl zip can be rebuilt by following the instructions at:
# https://github.com/mongodb-forks/cyrus-sasl/blob/mongo-sasl-2-1-28/README.md
import mongo.download_windows_sasl
mongo.download_windows_sasl.download_sasl(env)
def set_config_header_define(env, varname, varval=1):
env['CONFIG_HEADER_DEFINES'][varname] = varval

View File

@ -171,8 +171,6 @@ variables:
compile_flags: >-
--ssl
MONGO_DISTMOD=windows
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(( $(grep -c ^processor /proc/cpuinfo) / 2 ))
--win-version-min=win10
num_scons_link_jobs_available: 0.5
@ -762,8 +760,6 @@ buildvariants:
--opt=off
--ssl
MONGO_DISTMOD=windows
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5")
--win-version-min=win10
num_scons_link_jobs_available: 0.25
@ -1644,8 +1640,6 @@ buildvariants:
expansions:
num_scons_link_jobs_available: 0.1
compile_flags: >-
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(( $(grep -c ^processor /proc/cpuinfo) / 2 ))
--win-version-min=win10
python: '/cygdrive/c/python/python37/python.exe'
@ -2796,8 +2790,6 @@ buildvariants:
# --link-model=dynamic is set by visiblity_test's task_compile_flags
# expansion
compile_flags: >-
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(( $(grep -c ^processor /proc/cpuinfo) / 2 ))
--win-version-min=win10
--modules=

View File

@ -181,8 +181,6 @@ buildvariants:
compile_flags: >-
--ssl
MONGO_DISTMOD=windows
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.8")
--win-version-min=win10
num_scons_link_jobs_available: 0.2

View File

@ -89,8 +89,7 @@ buildvariants:
compile_flags: >-
--ssl
MONGO_DISTMOD=windows
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib" -j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5")
-j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5")
--win-version-min=win10
num_scons_link_jobs_available: 0.25
python: '/cygdrive/c/python/python37/python.exe'

View File

@ -2490,8 +2490,6 @@ buildvariants:
compile_flags: >-
--ssl
MONGO_DISTMOD=windows
CPPPATH="c:/sasl/include"
LIBPATH="c:/sasl/lib"
-j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5")
--win-version-min=win10
num_scons_link_jobs_available: 0.25

View File

@ -4,7 +4,7 @@ buildvariants:
display_name: "Ninja Build: Enterprise Windows"
cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
expansions:
compile_flags: --ssl MONGO_DISTMOD=windows CPPPATH="c:/sasl/include c:/snmp/include" LIBPATH="c:/sasl/lib c:/snmp/lib" -j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5") --win-version-min=win10
compile_flags: --ssl MONGO_DISTMOD=windows -j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5") --win-version-min=win10
compile_variant: enterprise-windows-ninja
tasks:
- name: compile_ninja_next_TG
@ -59,7 +59,7 @@ buildvariants:
display_name: "Ninja Build Profiles: Windows"
cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
expansions:
compile_flags: --ssl MONGO_DISTMOD=windows CPPPATH="c:/sasl/include c:/snmp/include" LIBPATH="c:/sasl/lib c:/snmp/lib" -j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5") --win-version-min=win10
compile_flags: --ssl MONGO_DISTMOD=windows -j$(bc <<< "$(grep -c '^processor' /proc/cpuinfo) / 1.5") --win-version-min=win10
tasks:
- name: compile_ninja_default_profile_TG
distros:

View File

@ -96,6 +96,14 @@ components:
team_owner: "Service Architecture"
upgrade_suppression: TODO SERVER-74870
"Cyrus SASL":
homepage_url: https://www.cyrusimap.org/sasl/
open_hub_url: https://openhub.net/p/cyrus-sasl
release_monitoring_id: 13280
# Empty since the library is linked and not in the source tree
local_directory_path:
team_owner: "Server Security"
"dcleblanc/SafeInt":
homepage_url: https://github.com/dcleblanc/SafeInt
open_hub_url: https://www.openhub.net/p/SafeInt

View File

@ -271,7 +271,7 @@
"name": "Organization: github"
},
"name": "Cyrus SASL",
"version": "2.1.26",
"version": "2.1.28",
"licenses": [
{
"license": {
@ -279,7 +279,7 @@
}
}
],
"purl": "pkg:github/cyrusimap/cyrus-sasl@cyrus-sasl-2.1.26",
"purl": "pkg:github/cyrusimap/cyrus-sasl@cyrus-sasl-2.1.28",
"properties": [
{
"name": "internal:team_responsible",

View File

@ -0,0 +1,70 @@
import urllib
import urllib.request
import hashlib
import zipfile
import os
import time
SASL_HASH = "3e22e2b16f802277123590f64dfda44f1c9c8a2b7e758180cd956d8ab0965817"
SASL_URL = "https://s3.amazonaws.com/boxes.10gen.com/build/windows_cyrus_sasl-2.1.28.zip"
def hash_sasl(sasl_dir):
md5_hash = hashlib.md5()
for root, _, files in os.walk(sasl_dir):
for name in files:
if name.endswith("md5sum"):
continue
with open(os.path.join(root, name), "rb") as f:
for block in iter(lambda: f.read(4096), b""):
md5_hash.update(block)
return md5_hash.hexdigest()
def hash_sasl_zip(sasl_zip):
sha_hash = hashlib.sha256()
with open(sasl_zip, "rb") as f:
for block in iter(lambda: f.read(4096), b""):
sha_hash.update(block)
return sha_hash.hexdigest()
def download_sasl(env):
complete = False
sasl_dir = env.Dir("$BUILD_ROOT/sasl_2_1_28").path
sasl_md5 = os.path.join(sasl_dir, "sasl.md5sum")
os.makedirs(sasl_dir, exist_ok=True)
if os.path.exists(sasl_md5):
with open(sasl_md5) as md5_file:
if hash_sasl(sasl_dir) == md5_file.read():
complete = True
if not complete:
print(f"Downloading sasl {SASL_URL}...")
for i in range(1, 5):
try:
local_filename, _ = urllib.request.urlretrieve(SASL_URL)
downloaded_hash = hash_sasl_zip(local_filename)
if downloaded_hash != SASL_HASH:
raise urllib.error.URLError(
f"Downloaded file hash: {downloaded_hash} does not match expected hash: {SASL_HASH}"
)
except urllib.error.URLError as exc:
wait_time = i * i * 10
if i == 4:
raise exc
else:
print(f"Failed to download {SASL_URL} because of:\n{exc}")
print(f"Retrying in {wait_time}...")
time.sleep(wait_time)
zip_file_object = zipfile.ZipFile(local_filename, "r")
zip_file_object.extractall(sasl_dir)
zip_file_object.close()
os.remove(local_filename)
with open(sasl_md5, "w") as md5_file:
md5_file.write(hash_sasl(sasl_dir))
env.Append(CPPPATH=[f"#{sasl_dir}/include"])
env.Append(LIBPATH=[f"#{sasl_dir}/lib"])