Verify mandatory Ruby patches exist

This commit is contained in:
Matthias Käppler 2022-11-30 16:44:38 +00:00 committed by Stan Hu
parent 207a35971c
commit b9bddb9b12
4 changed files with 17 additions and 3 deletions

View file

@ -0,0 +1 @@
thread-memory-allocations

View file

@ -46,10 +46,23 @@ function build_common() {
rm ruby.tar.gz
cd /usr/src/ruby
# Process patch files
local ruby_version=$(cut -d '.' -f 1,2 <<< $RUBY_VERSION)
local patchdir="/patches/ruby/${ruby_version}"
# Verify mandatory patches
while read -r patchname; do
local patchfile="${patchdir}/${patchname}.patch"
if [[ ! -f "${patchfile}" ]]; then
echo "!! Missing mandatory patch ${patchname}"
echo "!! Make sure ${patchfile} exists before proceeding."
exit 1
fi
done < "/patches/ruby/mandatory_patches"
# Apply patches
ruby_version=`cut -d '.' -f 1,2 <<< $RUBY_VERSION`
if [[ -d "/patches/ruby/$ruby_version" ]]; then
for i in "/patches/ruby/$ruby_version"/*.patch; do
if [[ -d "${patchdir}" ]]; then
for i in "${patchdir}"/*.patch; do
echo "$i..."
patch -p1 -i "$i"
done