SERVER-117754 Fix package task (#46922)

GitOrigin-RevId: 1a517eec36867b580df39f385686ce0aee90c586
This commit is contained in:
Daniel Moody 2026-01-24 12:10:34 -06:00 committed by MongoDB Bot
parent f7b3bf4bdf
commit 93efc87c78

View File

@ -943,6 +943,17 @@ def make_rpm(distro, build_os, arch, spec, srcdir):
f"dynamic_release {spec.prelease()}",
]
# Some build environments may not define a `pathfix` RPM macro even though our spec files
# reference it during %prep. Define it here (if available) so rpmbuild can always expand
# `%{pathfix}` to an actual file path.
pathfix = None
for candidate in ("/usr/bin/pathfix.py", "/usr/lib/rpm/redhat/pathfix.py"):
if os.path.exists(candidate):
pathfix = candidate
break
if pathfix:
flags.extend(["-D", f"pathfix {pathfix}"])
# Versions of RPM after 4.4 ignore our BuildRoot tag so we need to
# specify it on the command line args to rpmbuild
if (distro.name() == "suse" and distro.repo_os_version(build_os) == "15") or (