Merge branch 'mk-verify-mandatory-ruby-patches' into 'master'

Verify mandatory Ruby patches exist

See merge request https://gitlab.com/gitlab-org/gitlab-build-images/-/merge_requests/617

Merged-by: Stan Hu <stanhu@gmail.com>
Approved-by: Stan Hu <stanhu@gmail.com>
Co-authored-by: Matthias Kaeppler <mkaeppler@gitlab.com>
This commit is contained in:
Stan Hu 2022-11-30 16:44:38 +00:00
commit 632bca6084
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