Skip to content

Commit 373e6ba

Browse files
CDRIVER-5497 implement downstream RPM spec check (#1551)
Co-authored-by: Kevin Albertson <[email protected]>
1 parent 563ffb5 commit 373e6ba

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

.evergreen/generated_configs/legacy-config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,15 @@ tasks:
879879
content_type: ${content_type|application/x-gzip}
880880
- name: rpm-package-build
881881
commands:
882+
- command: shell.exec
883+
type: test
884+
params:
885+
working_dir: mongoc
886+
shell: bash
887+
script: |-
888+
set -o errexit
889+
export IS_PATCH="${is_patch}"
890+
sh .evergreen/scripts/check_rpm_spec.sh
882891
- command: shell.exec
883892
type: test
884893
params:

.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def __init__(
328328
NamedTask(
329329
"rpm-package-build",
330330
commands=[
331+
shell_mongoc('export IS_PATCH="${is_patch}"\n' "sh .evergreen/scripts/check_rpm_spec.sh"),
331332
shell_mongoc("sh .evergreen/scripts/build_snapshot_rpm.sh"),
332333
s3_put(
333334
local_file="rpm.tar.gz",

.evergreen/scripts/check_rpm_spec.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright 2024 MongoDB, Inc.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
set -o errexit
20+
21+
#
22+
# check_rpm_spec.sh - Check if our RPM spec matches downstream's
23+
#
24+
# Supported/used environment variables:
25+
# IS_PATCH If "true", this is an Evergreen patch build.
26+
27+
28+
on_exit () {
29+
if [ -n "${SPEC_FILE}" ]; then
30+
rm -f "${SPEC_FILE}"
31+
fi
32+
}
33+
trap on_exit EXIT
34+
35+
if [ "${IS_PATCH}" = "true" ]; then
36+
echo "This is a patch build...skipping RPM spec check"
37+
exit
38+
fi
39+
40+
SPEC_FILE=$(mktemp --tmpdir -u mongo-c-driver.XXXXXXXX.spec)
41+
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}"
42+
43+
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)

0 commit comments

Comments
 (0)