From 6ce0bf6e17f8e667f4b17d8dcc1f51be63a325b7 Mon Sep 17 00:00:00 2001 From: Willy Sudiarto Raharjo Date: Tue, 14 May 2024 11:57:50 +0700 Subject: [PATCH] system/mongodb: Switch to binary release. Signed-off-by: Willy Sudiarto Raharjo --- system/mongodb/README | 7 +- system/mongodb/doinst.sh | 2 +- system/mongodb/files/mongodb.conf | 34 ---- system/mongodb/mongodb.SlackBuild | 66 ++------ system/mongodb/mongodb.info | 8 +- .../patches/mongodb-5.0.2-no-compass.patch | 12 -- .../mongodb-5.0.2-skip-reqs-check.patch | 24 --- .../patches/mongodb-7.0.2-sconstruct.patch | 159 ------------------ 8 files changed, 17 insertions(+), 295 deletions(-) delete mode 100644 system/mongodb/files/mongodb.conf delete mode 100644 system/mongodb/patches/mongodb-5.0.2-no-compass.patch delete mode 100644 system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch delete mode 100644 system/mongodb/patches/mongodb-7.0.2-sconstruct.patch diff --git a/system/mongodb/README b/system/mongodb/README index f2e41d4aff..8898ea3511 100644 --- a/system/mongodb/README +++ b/system/mongodb/README @@ -13,9 +13,4 @@ if [ -x /etc/rc.d/rc.mongodb ]; then /etc/rc.d/rc.mongodb start fi -NOTE: mongodb 5.0 requires use of the AVX instruction set: check if -your cpu supports it with - - grep avx /proc/cpuinfo | uniq - -(no output means it doesn't) +NOTE: This script repackage binary source diff --git a/system/mongodb/doinst.sh b/system/mongodb/doinst.sh index 8721b3d5ee..a23b6a9f1f 100644 --- a/system/mongodb/doinst.sh +++ b/system/mongodb/doinst.sh @@ -23,6 +23,6 @@ preserve_perms() { } preserve_perms etc/rc.d/rc.mongodb.new -config etc/mongodb.conf.new +config etc/mongod.conf.new config etc/mongos.conf.new config etc/logrotate.d/mongodb.new diff --git a/system/mongodb/files/mongodb.conf b/system/mongodb/files/mongodb.conf deleted file mode 100644 index 83b4cc0589..0000000000 --- a/system/mongodb/files/mongodb.conf +++ /dev/null @@ -1,34 +0,0 @@ -# !! IMPORTANT !! -# -# This file uses the YAML format as described in the documentation: -# http://docs.mongodb.org/manual/reference/configuration-options/ - -storage: - dbPath: "/var/lib/mongodb" - #engine: wiredTiger - -systemLog: - destination: file - path: "/var/log/mongodb/mongodb.log" - quiet: true - logAppend: true - -net: - port: 27017 - bindIp: 127.0.0.1 - #ssl: - # mode: disabled - -#security: - #keyFile: - #clusterAuthMode: - -#replication: - #replSetName: - -# Specifies one of the MongoDB parameters described here: -# http://docs.mongodb.org/manual/reference/parameters/ -# -# You can specify multiple setParameter fields such as: -# setParameter: {enableTestCommands: 1} -#setParameter: diff --git a/system/mongodb/mongodb.SlackBuild b/system/mongodb/mongodb.SlackBuild index e1b70f5443..56cb0e953b 100644 --- a/system/mongodb/mongodb.SlackBuild +++ b/system/mongodb/mongodb.SlackBuild @@ -52,9 +52,6 @@ OUTPUT=${OUTPUT:-/tmp} MONGO_USER=${MONGO_USER:-285} MONGO_GROUP=${MONGO_GROUP:-285} -SRC_FILE=$PRGNAM-src-r$VERSION.tar.gz -SRC_FLDR=$PRGNAM-src-r$VERSION - if [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" @@ -81,15 +78,11 @@ EOF getent passwd mongo &>/dev/null || bailout getent group mongo &>/dev/null || bailout -rm -fr $TMP/$SRC_FLDR $PKG +rm -fr $PKG mkdir -p $TMP $PKG $OUTPUT -cd $TMP -tar xvf $CWD/$SRC_FILE -cd $SRC_FLDR -# remove bundled libs -rm -fR src/third_party/{boost,pcre-*,snappy-*,yaml-cpp,zlib-*} -# remove compass -rm -fR src/mongo/installer/compass +cd $PKG +ar p $CWD/mongodb-org-server_${VERSION}_amd64.deb data.tar.zst | zstd --decompress | tar xv +ar p $CWD/mongodb-org-mongos_${VERSION}_amd64.deb data.tar.zst | zstd --decompress | tar xv chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -97,63 +90,24 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# thanks gentoo, also for these patches -for i in $CWD/patches/* ; do patch -p1 < $i ; done - -sed -i "s|GCC 11.3|GCC 11.2|g" SConstruct -sed -i "s|__GNUC_MINOR__ < 3|__GNUC_MINOR__ < 2|g" SConstruct - -scons_opts=( - --disable-warnings-as-errors - --use-system-boost - --use-system-pcre2 - --use-system-snappy - --use-system-yaml - --use-system-zlib - --use-system-zstd - --use-sasl-client - --use-system-libbson - --use-system-mongo-c - --ssl -) - -# Thanks to Lockywolf -# scons can use multiple jobs. For convenience, read MAKEFLAGS from the environment, if set -JOBS="$( echo $MAKEFLAGS | sed 's,.*-j *\([0-9][0-9]*\)*.*,\1,' )" -# or if no MAKEFLAGS, use the number of cores minus 1 -JOBS="${JOBS:-$(( $( nproc ) - 1 ))}" -# or 1, if we really have one core -[ "$JOBS" = "0" ] && JOBS=1 - -if [ "$ARCH" = "x86_64" ]; then - PREFIX=${PKG}/usr CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" LDFLAGS="-L /lib$LIBDIRSUFFIX -L/usr/lib$LIBDIRSUFFIX" \ - ./buildscripts/scons.py "${scons_opts[@]}" --force-jobs --jobs="$JOBS" install-core -else - PREFIX=${PKG}/usr CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" LDFLAGS="-L /lib$LIBDIRSUFFIX -L/usr/lib$LIBDIRSUFFIX" \ - ./buildscripts/scons.py "${scons_opts[@]}" --force-jobs --jobs="$JOBS" --wiredtiger=off install-core -fi - -# manual install -( cd build/install/bin - for i in * ; do install -D -m 0755 $i $PKG/usr/bin/$i ; done ) -( cd debian - for i in *.1 ; do install -D -m 0644 $i $PKG/usr/man/man1/$i ; done ) +# We don't need systemd files +rm -rf lib find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -find $PKG/usr/man -type f -exec gzip -9 {} \; -for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +mv usr/share/man usr/ mkdir -p ${PKG}/usr/doc/${PRGNAM}-${VERSION} -cp distsrc/* ${PKG}/usr/doc/${PRGNAM}-${VERSION} +mv usr/share/doc/mongodb-org-* ${PKG}/usr/doc/${PRGNAM}-${VERSION} cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +rm -rf usr/share/doc mkdir -p $PKG/etc/{logrotate,rc}.d -cat $CWD/files/mongodb.conf > $PKG/etc/mongodb.conf.new cat $CWD/files/mongos.conf > $PKG/etc/mongos.conf.new cat $CWD/files/mongodb.logrotate > $PKG/etc/logrotate.d/mongodb.new cat $CWD/files/rc.mongodb > $PKG/etc/rc.d/rc.mongodb.new +mv etc/mongod.conf etc/mongod.conf.new mkdir -p $PKG/var/{lib,log}/mongodb chmod 750 $PKG/var/{lib,log}/mongodb diff --git a/system/mongodb/mongodb.info b/system/mongodb/mongodb.info index 7e2ff199e5..5653908c61 100644 --- a/system/mongodb/mongodb.info +++ b/system/mongodb/mongodb.info @@ -3,8 +3,10 @@ VERSION="7.0.9" HOMEPAGE="https://www.mongodb.org/" DOWNLOAD="UNSUPPORTED" MD5SUM="" -DOWNLOAD_x86_64="https://fastdl.mongodb.org/src/mongodb-src-r7.0.9.tar.gz" -MD5SUM_x86_64="96815d47735f5caf1bb024c7b4df8f6a" -REQUIRES="cheetah3 python3-psutil snappy snowballstemmer yaml-cpp python3-jsonschema mongo-c-driver pymongo" +DOWNLOAD_x86_64="https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/7.0/multiverse/binary-amd64/mongodb-org-server_7.0.9_amd64.deb \ + https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/7.0/multiverse/binary-amd64/mongodb-org-mongos_7.0.9_amd64.deb" +MD5SUM_x86_64="5c0915bf5b0bca2f96d272927953c24c \ + e51a4a81965f4d8ea9d482b7ca69ee8c" +REQUIRES="" MAINTAINER="Willy Sudiarto Raharjo" EMAIL="willysr@slackbuilds.org" diff --git a/system/mongodb/patches/mongodb-5.0.2-no-compass.patch b/system/mongodb/patches/mongodb-5.0.2-no-compass.patch deleted file mode 100644 index 7772515772..0000000000 --- a/system/mongodb/patches/mongodb-5.0.2-no-compass.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/mongo/installer/SConscript b/src/mongo/installer/SConscript -index 5bd89fe9..489e70ac 100644 ---- a/src/mongo/installer/SConscript -+++ b/src/mongo/installer/SConscript -@@ -7,7 +7,6 @@ env = env.Clone() - - env.SConscript( - dirs=[ -- 'compass', - 'msi', - ], - exports=[ diff --git a/system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch b/system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch deleted file mode 100644 index 823d481c20..0000000000 --- a/system/mongodb/patches/mongodb-5.0.2-skip-reqs-check.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/buildscripts/scons.py b/buildscripts/scons.py -index 534fca32..c38f64df 100755 ---- a/buildscripts/scons.py -+++ b/buildscripts/scons.py -@@ -19,13 +19,13 @@ SITE_TOOLS_DIR = os.path.join(MONGODB_ROOT, 'site_scons') - sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path - - # pylint: disable=C0413 --from mongo.pip_requirements import verify_requirements, MissingRequirements -+#from mongo.pip_requirements import verify_requirements, MissingRequirements - --try: -- verify_requirements('etc/pip/compile-requirements.txt') --except MissingRequirements as ex: -- print(ex) -- sys.exit(1) -+#try: -+# verify_requirements('etc/pip/compile-requirements.txt') -+#except MissingRequirements as ex: -+# print(ex) -+# sys.exit(1) - - try: - import SCons.Script diff --git a/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch b/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch deleted file mode 100644 index 822bd81d0b..0000000000 --- a/system/mongodb/patches/mongodb-7.0.2-sconstruct.patch +++ /dev/null @@ -1,159 +0,0 @@ -diff --git a/SConstruct b/SConstruct -index 92d557b..80ee9e8 100644 ---- a/SConstruct -+++ b/SConstruct -@@ -23,7 +23,6 @@ from pkg_resources import parse_version - - import SCons - import SCons.Script --from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics - from site_scons.mongo import build_profiles - - # This must be first, even before EnsureSConsVersion, if -@@ -1649,13 +1648,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption - - # The placement of this is intentional. Here we setup an atexit method to store tooling metrics. - # We should only register this function after env, env_vars and the parser have been properly initialized. --SConsToolingMetrics.register_metrics( -- utc_starttime=datetime.utcnow(), -- artifact_dir=env.Dir('$BUILD_DIR').get_abspath(), -- env_vars=env_vars, -- env=env, -- parser=_parser, --) - - if get_option('build-metrics'): - env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR' -@@ -3026,7 +3018,6 @@ if env.TargetOSIs('posix'): - env.Append( - CCFLAGS=[ - "-fasynchronous-unwind-tables", -- "-g2" if not env.TargetOSIs('emscripten') else "-g", - "-Wall", - "-Wsign-compare", - "-Wno-unknown-pragmas", -@@ -3093,6 +3084,8 @@ if env.TargetOSIs('posix'): - - # env.Append( " -Wconversion" ) TODO: this doesn't really work yet - env.Append(CXXFLAGS=["-Woverloaded-virtual"]) -+ env.Append(CXXFLAGS=os.environ['CXXFLAGS']) -+ env.Append(LINKFLAGS=os.environ['LDFLAGS']) - - # On OS X, clang doesn't want the pthread flag at link time, or it - # issues warnings which make it impossible for us to declare link -@@ -3143,7 +3136,7 @@ if env.TargetOSIs('posix'): - ], ) - - #make scons colorgcc friendly -- for key in ('HOME', 'TERM'): -+ for key in ('HOME', 'TERM', 'PATH'): - try: - env['ENV'][key] = os.environ[key] - except KeyError: -@@ -3543,33 +3536,6 @@ def doConfigure(myenv): - myenv.AddMethod( - functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported") - -- if myenv.ToolchainIs('gcc', 'clang'): -- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker -- # because it is much faster. Don't use it if the user has already configured another linker -- # selection manually. -- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']): -- myenv.FatalError( -- f"Use the '--linker' option instead of modifying the LINKFLAGS directly.") -- -- linker_ld = get_option('linker') -- if linker_ld == 'auto': -- if not env.TargetOSIs('darwin', 'macOS'): -- if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'): -- myenv.FatalError( -- f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'." -- ) -- elif link_model.startswith("dynamic") and linker_ld == 'bfd': -- # BFD is not supported due to issues with it causing warnings from some of -- # the third party libraries that mongodb is linked with: -- # https://jira.mongodb.org/browse/SERVER-49465 -- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.") -- else: -- if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'): -- myenv.FatalError(f"Linker {linker_ld} could not be configured.") -- -- if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'): -- myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single']) -- - detectCompiler = Configure( - myenv, - help=False, -@@ -4621,43 +4587,6 @@ def doConfigure(myenv): - if optBuild == "off" and myenv.ToolchainIs('clang') and env.TargetOSIs('darwin'): - myenv.AddToLINKFLAGSIfSupported("-Wl,-no_deduplicate") - -- # Apply any link time optimization settings as selected by the 'lto' option. -- if has_option('lto'): -- if myenv.ToolchainIs('msvc'): -- # Note that this is actually more aggressive than LTO, it is whole program -- # optimization due to /GL. However, this is historically what we have done for -- # windows, so we are keeping it. -- # -- # /GL implies /LTCG, so no need to say it in CCFLAGS, but we do need /LTCG on the -- # link flags. -- myenv.Append(CCFLAGS=['/GL']) -- myenv.Append(LINKFLAGS=['/LTCG']) -- myenv.Append(ARFLAGS=['/LTCG']) -- elif myenv.ToolchainIs('gcc', 'clang'): -- # For GCC and clang, the flag is -flto, and we need to pass it both on the compile -- # and link lines. -- if not myenv.AddToCCFLAGSIfSupported('-flto') or \ -- not myenv.AddToLINKFLAGSIfSupported('-flto'): -- myenv.ConfError("Link time optimization requested, " -- "but selected compiler does not honor -flto") -- -- if myenv.TargetOSIs('darwin'): -- myenv.AddToLINKFLAGSIfSupported('-Wl,-object_path_lto,${TARGET}.lto') -- else: -- # According to intel benchmarks -fno-plt increases perf -- # See PM-2215 -- if linker_ld != "gold": -- myenv.ConfError("lto compilation currently only works with the --linker=gold") -- if link_model != "object": -- myenv.ConfError( -- "lto compilation currently only works with the --link-model=object") -- if not myenv.AddToCCFLAGSIfSupported('-fno-plt') or \ -- not myenv.AddToLINKFLAGSIfSupported('-fno-plt'): -- myenv.ConfError("-fno-plt is not supported by the compiler") -- -- else: -- myenv.ConfError("Don't know how to enable --lto on current toolchain") -- - if get_option('runtime-hardening') == "on" and optBuild != "off": - # Older glibc doesn't work well with _FORTIFY_SOURCE=2. Selecting 2.11 as the minimum was an - # emperical decision, as that is the oldest non-broken glibc we seem to require. It is possible -@@ -5120,17 +5049,13 @@ def doConfigure(myenv): - "BOOST_LOG_NO_SHORTHAND_NAMES", - "BOOST_LOG_USE_NATIVE_SYSLOG", - "BOOST_LOG_WITHOUT_THREAD_ATTR", -+ "BOOST_LOG_DYN_LINK", - "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS", - "BOOST_SYSTEM_NO_DEPRECATED", - "BOOST_THREAD_USES_DATETIME", - ("BOOST_THREAD_VERSION", "5"), - ]) - -- if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk': -- conf.env.AppendUnique(CPPDEFINES=[ -- "BOOST_LOG_DYN_LINK", -- ]) -- - if use_system_version_of_library("boost"): - if not conf.CheckCXXHeader("boost/filesystem/operations.hpp"): - myenv.ConfError("can't find boost headers") -@@ -5327,6 +5252,9 @@ def doConfigure(myenv): - - mongoc_mode = get_option('use-system-mongo-c') - conf.env['MONGO_HAVE_LIBMONGOC'] = False -+ conf.env.ParseConfig('pkg-config libbson-1.0 libmongoc-1.0 --cflags') -+ conf.env['LIBDEPS_LIBBSON_SYSLIBDEP'] = 'bson-1.0' -+ - if mongoc_mode != 'off': - if conf.CheckLibWithHeader( - ["mongoc-1.0"],