diff --git a/.github/workflows/build-ruby.yml b/.github/workflows/build-ruby.yml index 3a474a4..520efe3 100644 --- a/.github/workflows/build-ruby.yml +++ b/.github/workflows/build-ruby.yml @@ -145,6 +145,18 @@ jobs: libc: musl arch: ["x86_64", "aarch64"] # centos + - engine: ruby + version: "1.8" + libc: centos + arch: ["x86_64"] + - engine: ruby + version: "1.9" + libc: centos + arch: ["x86_64"] + - engine: ruby + version: "2.0" + libc: centos + arch: ["x86_64"] - engine: ruby version: "2.1" libc: centos diff --git a/Rakefile b/Rakefile index b9cd174..ff6dfcb 100644 --- a/Rakefile +++ b/Rakefile @@ -3,4 +3,4 @@ # @type self: Rake::TaskLib # load rake tasks from tasks directory -Dir.glob(File.join(__dir__ || Dir.pwd, "tasks", "**", "*.rake")) { |f| import f } +Dir.glob(File.join(File.dirname(__FILE__) || Dir.pwd, "tasks", "**", "*.rake")) { |f| import f } diff --git a/gemfiles/ruby-1.8.gemfile b/gemfiles/ruby-1.8.gemfile new file mode 100644 index 0000000..b3d4cd4 --- /dev/null +++ b/gemfiles/ruby-1.8.gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gem "rake" + +group :test do + gem "minitest" +end diff --git a/gemfiles/ruby-1.9.gemfile b/gemfiles/ruby-1.9.gemfile new file mode 100644 index 0000000..b3d4cd4 --- /dev/null +++ b/gemfiles/ruby-1.9.gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gem "rake" + +group :test do + gem "minitest" +end diff --git a/gemfiles/ruby-2.0.gemfile b/gemfiles/ruby-2.0.gemfile new file mode 100644 index 0000000..b3d4cd4 --- /dev/null +++ b/gemfiles/ruby-2.0.gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gem "rake" + +group :test do + gem "minitest" +end diff --git a/src/engines/ruby/1.8/Dockerfile.centos b/src/engines/ruby/1.8/Dockerfile.centos new file mode 100644 index 0000000..467fa57 --- /dev/null +++ b/src/engines/ruby/1.8/Dockerfile.centos @@ -0,0 +1,165 @@ +# platforms: linux/x86_64 + +# CentOS 7.9 has glibc 2.17 +FROM public.ecr.aws/docker/library/centos:centos7.9.2009 + +# Set yum vault +RUN < /etc/yum.repos.d/CentOS-Base.repo +[base] +name=CentOS-\$releasever - Base +baseurl=http://vault.centos.org/${repo_version}/os/\$basearch/ +gpgcheck=0 + +[updates] +name=CentOS-\$releasever - Updates +baseurl=http://vault.centos.org/${repo_version}/updates/\$basearch/ +gpgcheck=0 + +[extras] +name=CentOS-\$releasever - Extras +baseurl=http://vault.centos.org/${repo_version}/extras/\$basearch/ +gpgcheck=0 + +[centosplus] +name=CentOS-\$releasever - Plus +baseurl=http://vault.centos.org/${repo_version}/centosplus/\$basearch/ +gpgcheck=0 +enabled=0 +EOF +SHELL + +RUN yum makecache -y + +# localedef has been forcefully removed by: +# rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive} +# fun: CentOS 8 has `yum list glibc-langpack-\*` but not CentOS 7 :'( +RUN yum reinstall -y glibc-common + +RUN yum install -y curl gcc make + +# fun: this has to be after `yum install curl gcc make`... but only on aarch64; go figure +# extra fun: table is botched, localedef not happy, swallow result and test `locale` for errors +RUN <&1 | grep -e 'locale: Cannot set LC_.* to default locale: No such file or directory'; then exit 1; fi +SHELL + +# Skip installing gem documentation +COPY < file.c.new +mv file.c.new file.c + +autoconf + +gnuArch="$(uname -m)-linux-gnu" +./configure \ + --build="$gnuArch" \ + --disable-install-doc \ + --disable-shared +make -j "$(nproc)" +make install + +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r dpkg-query --search \ +# | cut -d: -f1 \ +# | sort -u \ +# | xargs -r apt-mark manual \ +# +# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ +# +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | grep -v '=>' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r rpm -qf \ +# | sort -u \ +# | xargs -r yum ?mark-manual? +# +# yum autoremove -y +# yum remove --setopt=clean_requirements_on_remove=1 +# package-cleanup --leaves && yum autoremove # yum-utils +# sudo yum history list pdftk +# sudo yum history undo 88 + +cd / +rm -r /usr/src/ruby +if yum list installed ruby; then exit 1; fi + +# update gem version +curl -o rubygems.tar.gz "https://rubygems.org/rubygems/rubygems-1.6.2.tgz" +echo "cb5261818b931b5ea2cb54bc1d583c47823543fcf9682f0d6298849091c1cea7 *rubygems.tar.gz" | sha256sum --check --strict +mkdir -p /usr/src/rubygems +tar -xzf rubygems.tar.gz -C /usr/src/rubygems --strip-components=1 +rm rubygems.tar.gz + +cd /usr/src/rubygems +make +make install +cd / +rm -r /usr/src/rubygems + +gem update --system 2.7.11 +gem install bundler --version 1.17.3 --force + +# rough smoke test +ruby --version +gem --version +bundle --version + +SHELL + +# don't create ".bundle" in all our apps +ENV GEM_HOME /usr/local/bundle +ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ + BUNDLE_APP_CONFIG="$GEM_HOME" +ENV PATH $GEM_HOME/bin:$PATH + +# adjust permissions of a few directories for running "gem install" as an arbitrary user +RUN mkdir -p "$GEM_HOME" && chmod 1777 "$GEM_HOME" + +CMD [ "irb" ] + diff --git a/src/engines/ruby/1.9/Dockerfile.centos b/src/engines/ruby/1.9/Dockerfile.centos new file mode 100644 index 0000000..fd3b565 --- /dev/null +++ b/src/engines/ruby/1.9/Dockerfile.centos @@ -0,0 +1,153 @@ +# platforms: linux/x86_64 + +# CentOS 7.9 has glibc 2.17 +FROM public.ecr.aws/docker/library/centos:centos7.9.2009 + +# Set yum vault +RUN < /etc/yum.repos.d/CentOS-Base.repo +[base] +name=CentOS-\$releasever - Base +baseurl=http://vault.centos.org/${repo_version}/os/\$basearch/ +gpgcheck=0 + +[updates] +name=CentOS-\$releasever - Updates +baseurl=http://vault.centos.org/${repo_version}/updates/\$basearch/ +gpgcheck=0 + +[extras] +name=CentOS-\$releasever - Extras +baseurl=http://vault.centos.org/${repo_version}/extras/\$basearch/ +gpgcheck=0 + +[centosplus] +name=CentOS-\$releasever - Plus +baseurl=http://vault.centos.org/${repo_version}/centosplus/\$basearch/ +gpgcheck=0 +enabled=0 +EOF +SHELL + +RUN yum makecache -y + +# localedef has been forcefully removed by: +# rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive} +# fun: CentOS 8 has `yum list glibc-langpack-\*` but not CentOS 7 :'( +RUN yum reinstall -y glibc-common + +RUN yum install -y curl gcc make + +# fun: this has to be after `yum install curl gcc make`... but only on aarch64; go figure +# extra fun: table is botched, localedef not happy, swallow result and test `locale` for errors +RUN <&1 | grep -e 'locale: Cannot set LC_.* to default locale: No such file or directory'; then exit 1; fi +SHELL + +# Skip installing gem documentation +COPY < file.c.new +mv file.c.new file.c + +autoconf + +gnuArch="$(uname -m)-linux-gnu" +./configure \ + --build="$gnuArch" \ + --disable-install-doc \ + --disable-shared +make -j "$(nproc)" +make install + +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r dpkg-query --search \ +# | cut -d: -f1 \ +# | sort -u \ +# | xargs -r apt-mark manual \ +# +# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ +# +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | grep -v '=>' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r rpm -qf \ +# | sort -u \ +# | xargs -r yum ?mark-manual? +# +# yum autoremove -y +# yum remove --setopt=clean_requirements_on_remove=1 +# package-cleanup --leaves && yum autoremove # yum-utils +# sudo yum history list pdftk +# sudo yum history undo 88 + +cd / +rm -r /usr/src/ruby +if yum list installed ruby; then exit 1; fi + +# update gem version +gem update --system 2.7.11 +gem install bundler --version 1.17.3 --force + +# rough smoke test +ruby --version +gem --version +bundle --version + +SHELL + +# don't create ".bundle" in all our apps +ENV GEM_HOME /usr/local/bundle +ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ + BUNDLE_APP_CONFIG="$GEM_HOME" +ENV PATH $GEM_HOME/bin:$PATH + +# adjust permissions of a few directories for running "gem install" as an arbitrary user +RUN mkdir -p "$GEM_HOME" && chmod 1777 "$GEM_HOME" + +CMD [ "irb" ] + diff --git a/src/engines/ruby/2.0/Dockerfile.centos b/src/engines/ruby/2.0/Dockerfile.centos new file mode 100644 index 0000000..224b58a --- /dev/null +++ b/src/engines/ruby/2.0/Dockerfile.centos @@ -0,0 +1,153 @@ +# platforms: linux/x86_64 + +# CentOS 7.9 has glibc 2.17 +FROM public.ecr.aws/docker/library/centos:centos7.9.2009 + +# Set yum vault +RUN < /etc/yum.repos.d/CentOS-Base.repo +[base] +name=CentOS-\$releasever - Base +baseurl=http://vault.centos.org/${repo_version}/os/\$basearch/ +gpgcheck=0 + +[updates] +name=CentOS-\$releasever - Updates +baseurl=http://vault.centos.org/${repo_version}/updates/\$basearch/ +gpgcheck=0 + +[extras] +name=CentOS-\$releasever - Extras +baseurl=http://vault.centos.org/${repo_version}/extras/\$basearch/ +gpgcheck=0 + +[centosplus] +name=CentOS-\$releasever - Plus +baseurl=http://vault.centos.org/${repo_version}/centosplus/\$basearch/ +gpgcheck=0 +enabled=0 +EOF +SHELL + +RUN yum makecache -y + +# localedef has been forcefully removed by: +# rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive} +# fun: CentOS 8 has `yum list glibc-langpack-\*` but not CentOS 7 :'( +RUN yum reinstall -y glibc-common + +RUN yum install -y curl gcc make + +# fun: this has to be after `yum install curl gcc make`... but only on aarch64; go figure +# extra fun: table is botched, localedef not happy, swallow result and test `locale` for errors +RUN <&1 | grep -e 'locale: Cannot set LC_.* to default locale: No such file or directory'; then exit 1; fi +SHELL + +# Skip installing gem documentation +COPY < file.c.new +mv file.c.new file.c + +autoconf + +gnuArch="$(uname -m)-linux-gnu" +./configure \ + --build="$gnuArch" \ + --disable-install-doc \ + --disable-shared +make -j "$(nproc)" +make install + +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r dpkg-query --search \ +# | cut -d: -f1 \ +# | sort -u \ +# | xargs -r apt-mark manual \ +# +# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ +# +# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ +# | awk '/=>/ { print $(NF-1) }' \ +# | grep -v '=>' \ +# | sort -u \ +# | grep -vE '^/usr/local/lib/' \ +# | xargs -r rpm -qf \ +# | sort -u \ +# | xargs -r yum ?mark-manual? +# +# yum autoremove -y +# yum remove --setopt=clean_requirements_on_remove=1 +# package-cleanup --leaves && yum autoremove # yum-utils +# sudo yum history list pdftk +# sudo yum history undo 88 + +cd / +rm -r /usr/src/ruby +if yum list installed ruby; then exit 1; fi + +# update gem version +gem update --system 2.7.11 +gem install bundler --version 1.17.3 --force + +# rough smoke test +ruby --version +gem --version +bundle --version + +SHELL + +# don't create ".bundle" in all our apps +ENV GEM_HOME /usr/local/bundle +ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ + BUNDLE_APP_CONFIG="$GEM_HOME" +ENV PATH $GEM_HOME/bin:$PATH + +# adjust permissions of a few directories for running "gem install" as an arbitrary user +RUN mkdir -p "$GEM_HOME" && chmod 1777 "$GEM_HOME" + +CMD [ "irb" ] + diff --git a/test/engines/test_encoding.rb b/test/engines/test_encoding.rb index 92ab0bf..aba2ded 100644 --- a/test/engines/test_encoding.rb +++ b/test/engines/test_encoding.rb @@ -2,7 +2,7 @@ # polyfill for Ruby 2.2 and down, used by minitest unless "".respond_to?(:match?) - String.instance_eval do + class String def match?(other) (Regexp === other) ? other.match?(self) : (self == other) end