diff --git a/.evergreen/generated_configs/legacy-config.yml b/.evergreen/generated_configs/legacy-config.yml index 9d6568952f..4d5004c001 100644 --- a/.evergreen/generated_configs/legacy-config.yml +++ b/.evergreen/generated_configs/legacy-config.yml @@ -879,6 +879,15 @@ tasks: content_type: ${content_type|application/x-gzip} - name: rpm-package-build commands: + - command: shell.exec + type: test + params: + working_dir: mongoc + shell: bash + script: |- + set -o errexit + export IS_PATCH="${is_patch}" + sh .evergreen/scripts/check_rpm_spec.sh - command: shell.exec type: test params: diff --git a/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py b/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py index 7f625fc3e0..c2f896a613 100644 --- a/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py +++ b/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py @@ -328,6 +328,7 @@ def __init__( NamedTask( "rpm-package-build", commands=[ + shell_mongoc('export IS_PATCH="${is_patch}"\n' "sh .evergreen/scripts/check_rpm_spec.sh"), shell_mongoc("sh .evergreen/scripts/build_snapshot_rpm.sh"), s3_put( local_file="rpm.tar.gz", diff --git a/.evergreen/scripts/check_rpm_spec.sh b/.evergreen/scripts/check_rpm_spec.sh new file mode 100644 index 0000000000..e5ce3c9eab --- /dev/null +++ b/.evergreen/scripts/check_rpm_spec.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# +# Copyright 2024 MongoDB, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -o errexit + +# +# check_rpm_spec.sh - Check if our RPM spec matches downstream's +# +# Supported/used environment variables: +# IS_PATCH If "true", this is an Evergreen patch build. + + +on_exit () { + if [ -n "${SPEC_FILE}" ]; then + rm -f "${SPEC_FILE}" + fi +} +trap on_exit EXIT + +if [ "${IS_PATCH}" = "true" ]; then + echo "This is a patch build...skipping RPM spec check" + exit +fi + +SPEC_FILE=$(mktemp --tmpdir -u mongo-c-driver.XXXXXXXX.spec) +curl --retry 5 https://src.fedoraproject.org/rpms/mongo-c-driver/raw/rawhide/f/mongo-c-driver.spec -sS --max-time 120 --fail --output "${SPEC_FILE}" + +diff -q .evergreen/etc/mongo-c-driver.spec "${SPEC_FILE}" || (echo "Synchronize RPM spec from downstream to fix this failure. See instructions here: https://docs.google.com/document/d/1ItyBC7VN383zNXu3oUOQJYR7adfYI8ECjLMJ5kqA9X8/edit#heading=h.ahdrr3b5xv3"; exit 1)