From bf0151fe5a36faf06c55cbf0004267284f16d1bd Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 26 Feb 2025 13:58:53 +0900 Subject: [PATCH 01/12] centos7: fix mirror list Signed-off-by: Shizuo Fujita --- fluent-package/yum/centos-7/Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fluent-package/yum/centos-7/Dockerfile b/fluent-package/yum/centos-7/Dockerfile index 01f7e4fd7..fc093189f 100644 --- a/fluent-package/yum/centos-7/Dockerfile +++ b/fluent-package/yum/centos-7/Dockerfile @@ -22,10 +22,23 @@ COPY qemu-* /usr/bin/ ARG DEBUG +RUN sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ + -e 's/^#baseurl/baseurl/g' \ + -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/7.9.2009,g' \ + /etc/yum.repos.d/CentOS-Base.repo + RUN \ quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \ yum update -y ${quiet} && \ yum install -y ${quiet} centos-release-scl && \ + sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ + -e 's/^# baseurl/baseurl/g' \ + -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ + /etc/yum.repos.d/CentOS-SCLo-scl.repo && \ + sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ + -e 's/^#baseurl/baseurl/g' \ + -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ + /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo && \ yum install -y ${quiet} epel-release && \ yum groupinstall -y ${quiet} "Development Tools" && \ yum install -y ${quiet} \ From c22c34c1f6ffbbe80258b3e28ed51c07ede3b144 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 26 Feb 2025 14:01:39 +0900 Subject: [PATCH 02/12] centos7: remove unnecessary python file This will remove following files * /root/rpmbuild/BUILDROOT/fluent-package-5.2.0-1.el7.x86_64/opt/fluent/lib/ruby/gems/3.2.0/gems/ffi-1.17.0/ext/ffi_c/libffi/generate-darwin-source-and-headers.py * /root/rpmbuild/BUILDROOT/fluent-package-5.2.0-1.el7.x86_64/opt/fluent/lib/ruby/gems/3.2.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py * /root/rpmbuild/BUILDROOT/fluent-package-5.2.0-1.el7.x86_64/opt/fluent/lib/ruby/gems/3.2.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/emscripten/conftest.py Signed-off-by: Shizuo Fujita --- fluent-package/Rakefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fluent-package/Rakefile b/fluent-package/Rakefile index 8b908bbd5..e3909ea21 100755 --- a/fluent-package/Rakefile +++ b/fluent-package/Rakefile @@ -1164,6 +1164,10 @@ class BuildTask rm_f(static_library) end end + Dir.glob("#{fluent_package_staging_dir}/**/libffi/**/*.py").each do |python_file| + # Remove unnecessary python file to avoid error in brp-python-bytecompile on CentOS 7 + remove_files(python_file) + end Dir.glob("#{fluent_package_staging_dir}/**/.git").each do |git_dir| remove_files(git_dir, true) end From 8e3391aab959700a2bbf539ae6ab5c0d5870def4 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 27 Feb 2025 12:00:23 +0900 Subject: [PATCH 03/12] centos7: pull docker image from docker hub Signed-off-by: Shizuo Fujita --- lib/package-task.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/package-task.rb b/lib/package-task.rb index 0f8b24530..0f4b25746 100644 --- a/lib/package-task.rb +++ b/lib/package-task.rb @@ -114,6 +114,8 @@ def run_docker(os, architecture=nil) id = os id = "#{id}-#{architecture}" if architecture docker_tag = "#{@package}-#{id}" + # TODO: Fix docker tag name + docker_tag = "watson1978/#{docker_tag}" if os == "centos-7" build_command_line = [ "docker", "build", @@ -149,7 +151,14 @@ def run_docker(os, architecture=nil) build_command_line << docker_context run_command_line.concat([docker_tag, "/host/build.sh"]) - sh(*build_command_line) + if os == "centos-7" + if ENV["BUILD_DOCKER_IMAGE_ONLY"] + sh(*build_command_line) + exit + end + else + sh(*build_command_line) + end sh(*run_command_line) end From 57b818da0800917eac766435a3668a944a822fbc Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 27 Jun 2025 11:14:33 +0900 Subject: [PATCH 04/12] centos7: add support for Linux capability Signed-off-by: Shizuo Fujita --- fluent-package/yum/centos-7/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/fluent-package/yum/centos-7/Dockerfile b/fluent-package/yum/centos-7/Dockerfile index fc093189f..95ba7be7f 100644 --- a/fluent-package/yum/centos-7/Dockerfile +++ b/fluent-package/yum/centos-7/Dockerfile @@ -47,6 +47,7 @@ RUN \ rh-ruby26-rubygems \ rh-ruby26-rubygem-rake \ rh-ruby26-rubygem-bundler \ + libcap-ng-devel \ libedit-devel \ ncurses-devel \ libyaml-devel \ From 57c94dc80f5cb657dfa75e475a97d89037c79578 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 27 Jun 2025 14:36:15 +0900 Subject: [PATCH 05/12] centos7: stop to bundle rdkafka v0.21.0 Signed-off-by: Shizuo Fujita --- fluent-package/Gemfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fluent-package/Gemfile b/fluent-package/Gemfile index ad20c7fa0..f17223ce3 100644 --- a/fluent-package/Gemfile +++ b/fluent-package/Gemfile @@ -2,6 +2,12 @@ require File.expand_path('../config.rb', __FILE__) +def platform_centos7? + return false unless File.exist?("/etc/os-release") + os_info = File.read("/etc/os-release") + os_info.include?("CentOS Linux 7") ? true : false +end + source "https://rubygems.org" # core gems @@ -102,7 +108,10 @@ not_windows_platforms = [:ruby] gem "capng_c", "0.2.3", platforms: not_windows_platforms # Use newer bundled rdkafka with librdkafka 2.8.0 to support AlmaLinux 10 # (librdkafka 2.8.0 supports "OpenSSL without the ENGINE component") -gem "rdkafka", "0.21.0", platforms: not_windows_platforms +# librdkafka 2.8.0 can't be built on CentOS 7. +unless platform_centos7? + gem "rdkafka", "0.21.0", platforms: not_windows_platforms +end # Keep systemd-journal 2.0.0 and f-p-systemd 1.1.0 until regression issue is fixed # See https://github.com/ledbettj/systemd-journal/pull/109 gem "systemd-journal", "2.0.0", platforms: not_windows_platforms From 8049a71fecc1214af66ea67bd24dfc340440fe30 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Mon, 30 Jun 2025 12:03:48 +0900 Subject: [PATCH 06/12] Revert "centos7: pull docker image from docker hub" This reverts commit 8e3391aab959700a2bbf539ae6ab5c0d5870def4. Signed-off-by: Shizuo Fujita --- lib/package-task.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/package-task.rb b/lib/package-task.rb index 0f4b25746..0f8b24530 100644 --- a/lib/package-task.rb +++ b/lib/package-task.rb @@ -114,8 +114,6 @@ def run_docker(os, architecture=nil) id = os id = "#{id}-#{architecture}" if architecture docker_tag = "#{@package}-#{id}" - # TODO: Fix docker tag name - docker_tag = "watson1978/#{docker_tag}" if os == "centos-7" build_command_line = [ "docker", "build", @@ -151,14 +149,7 @@ def run_docker(os, architecture=nil) build_command_line << docker_context run_command_line.concat([docker_tag, "/host/build.sh"]) - if os == "centos-7" - if ENV["BUILD_DOCKER_IMAGE_ONLY"] - sh(*build_command_line) - exit - end - else - sh(*build_command_line) - end + sh(*build_command_line) sh(*run_command_line) end From ecdf14c94e60682945b44184f4b8b2f11197571f Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Mon, 30 Jun 2025 12:13:08 +0900 Subject: [PATCH 07/12] centos7: update Dockerfile Signed-off-by: Shizuo Fujita --- fluent-package/yum/centos-7/Dockerfile | 111 +++++++++++++------------ 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/fluent-package/yum/centos-7/Dockerfile b/fluent-package/yum/centos-7/Dockerfile index 95ba7be7f..491360183 100644 --- a/fluent-package/yum/centos-7/Dockerfile +++ b/fluent-package/yum/centos-7/Dockerfile @@ -15,59 +15,64 @@ # specific language governing permissions and limitations # under the License. -ARG FROM=centos:7 +ARG FROM=ghcr.io/fluent/fluent-package-centos-7 FROM ${FROM} -COPY qemu-* /usr/bin/ +## The following setting had used for initial building ghcr.io/fluent/fluent-package-centos-7. -ARG DEBUG - -RUN sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ - -e 's/^#baseurl/baseurl/g' \ - -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/7.9.2009,g' \ - /etc/yum.repos.d/CentOS-Base.repo - -RUN \ - quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \ - yum update -y ${quiet} && \ - yum install -y ${quiet} centos-release-scl && \ - sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ - -e 's/^# baseurl/baseurl/g' \ - -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ - /etc/yum.repos.d/CentOS-SCLo-scl.repo && \ - sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ - -e 's/^#baseurl/baseurl/g' \ - -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ - /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo && \ - yum install -y ${quiet} epel-release && \ - yum groupinstall -y ${quiet} "Development Tools" && \ - yum install -y ${quiet} \ - devtoolset-11 \ - rh-ruby26-ruby-devel \ - rh-ruby26-rubygems \ - rh-ruby26-rubygem-rake \ - rh-ruby26-rubygem-bundler \ - libcap-ng-devel \ - libedit-devel \ - ncurses-devel \ - libyaml-devel \ - libffi-devel \ - git \ - cyrus-sasl-devel \ - nss-softokn-freebl-devel \ - pkg-config \ - rpm-build \ - rpmdevtools \ - redhat-rpm-config \ - openssl-devel \ - tar \ - zlib-devel \ - rpmlint \ - cmake3 && \ - # raise IPv4 priority - echo "precedence ::ffff:0:0/96 100" > /etc/gai.conf && \ - # enable multiplatform feature (bundler 2.4.22 is the latest version which supports ruby 2.6) - source /opt/rh/rh-ruby26/enable && gem install --no-document --install-dir /opt/rh/rh-ruby26/root/usr/share/gems bundler:2.4.22 builder && \ - scl enable devtoolset-11 bash && \ - yum clean ${quiet} all && \ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +# ARG FROM=centos:7 +# FROM ${FROM} +# +# COPY qemu-* /usr/bin/ +# +# ARG DEBUG +# +# RUN sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ +# -e 's/^#baseurl/baseurl/g' \ +# -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/7.9.2009,g' \ +# /etc/yum.repos.d/CentOS-Base.repo +# +# RUN \ +# quiet=$([ "${DEBUG}" = "yes" ] || echo "--quiet") && \ +# yum update -y ${quiet} && \ +# yum install -y ${quiet} centos-release-scl && \ +# sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ +# -e 's/^# baseurl/baseurl/g' \ +# -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ +# /etc/yum.repos.d/CentOS-SCLo-scl.repo && \ +# sed -i'' -e 's/^mirrorlist/#mirrorlist/g' \ +# -e 's/^#baseurl/baseurl/g' \ +# -e 's,mirror.centos.org/centos/7,vault.centos.org/7.9.2009,g' \ +# /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo && \ +# yum install -y ${quiet} epel-release && \ +# yum groupinstall -y ${quiet} "Development Tools" && \ +# yum install -y ${quiet} \ +# devtoolset-11 \ +# rh-ruby26-ruby-devel \ +# rh-ruby26-rubygems \ +# rh-ruby26-rubygem-rake \ +# rh-ruby26-rubygem-bundler \ +# libcap-ng-devel \ +# libedit-devel \ +# ncurses-devel \ +# libyaml-devel \ +# libffi-devel \ +# git \ +# cyrus-sasl-devel \ +# nss-softokn-freebl-devel \ +# pkg-config \ +# rpm-build \ +# rpmdevtools \ +# redhat-rpm-config \ +# openssl-devel \ +# tar \ +# zlib-devel \ +# rpmlint \ +# cmake3 && \ +# # raise IPv4 priority +# echo "precedence ::ffff:0:0/96 100" > /etc/gai.conf && \ +# # enable multiplatform feature (bundler 2.4.22 is the latest version which supports ruby 2.6) +# source /opt/rh/rh-ruby26/enable && gem install --no-document --install-dir /opt/rh/rh-ruby26/root/usr/share/gems bundler:2.4.22 builder && \ +# scl enable devtoolset-11 bash && \ +# yum clean ${quiet} all && \ +# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y From d2d0ff1825eed2882d43a04e5aa7441eb0430728 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 2 Jul 2025 11:41:17 +0900 Subject: [PATCH 08/12] centos7: disable brp-python-bytecompile Signed-off-by: Shizuo Fujita --- fluent-package/Rakefile | 4 ---- fluent-package/yum/fluent-package.spec.in | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fluent-package/Rakefile b/fluent-package/Rakefile index e3909ea21..8b908bbd5 100755 --- a/fluent-package/Rakefile +++ b/fluent-package/Rakefile @@ -1164,10 +1164,6 @@ class BuildTask rm_f(static_library) end end - Dir.glob("#{fluent_package_staging_dir}/**/libffi/**/*.py").each do |python_file| - # Remove unnecessary python file to avoid error in brp-python-bytecompile on CentOS 7 - remove_files(python_file) - end Dir.glob("#{fluent_package_staging_dir}/**/.git").each do |git_dir| remove_files(git_dir, true) end diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index 45f0519ab..349d6e18c 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -36,8 +36,14 @@ %define install_plugins /tmp/@PACKAGE_DIR@/.install_plugins %define pid_for_auto_restart /tmp/@PACKAGE_DIR@/.pid_for_auto_restart -# Omit the brp-python-bytecompile automagic because post hook for ffi fails on AmazonLinux 2. -%if %{_amazon_ver} == 2 +# Disable to use old python on CentOS 7 because it causes error in brp-python-bytecompile. +# Only __brp_python_bytecompile disabled, it does not solve the error... +%if %{_centos_ver} == 7 +%global __python %{nil} +%endif + +# Omit the brp-python-bytecompile automagic because post hook for ffi fails on AmazonLinux 2 and CentOS 7. +%if %{_amazon_ver} == 2 || %{_centos_ver} == 7 %global __brp_python_bytecompile %{nil} %endif From cf286c00886079e8846e530824d23e6f6cec02f1 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 2 Jul 2025 17:33:55 +0900 Subject: [PATCH 09/12] centos7: remove overriding __brp_python_bytecompile macro because it is no effect Signed-off-by: Shizuo Fujita --- fluent-package/yum/fluent-package.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index 349d6e18c..d7093db8c 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -42,8 +42,8 @@ %global __python %{nil} %endif -# Omit the brp-python-bytecompile automagic because post hook for ffi fails on AmazonLinux 2 and CentOS 7. -%if %{_amazon_ver} == 2 || %{_centos_ver} == 7 +# Omit the brp-python-bytecompile automagic because post hook for ffi fails on AmazonLinux 2. +%if %{_amazon_ver} == 2 %global __brp_python_bytecompile %{nil} %endif From 9c408c0dd9b785aab681a150b76ba4bb8e818e51 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 3 Jul 2025 11:40:27 +0900 Subject: [PATCH 10/12] centos7: update comment for __brp_python_bytecompile Signed-off-by: Shizuo Fujita --- fluent-package/yum/fluent-package.spec.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index d7093db8c..83cb305f5 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -37,7 +37,8 @@ %define pid_for_auto_restart /tmp/@PACKAGE_DIR@/.pid_for_auto_restart # Disable to use old python on CentOS 7 because it causes error in brp-python-bytecompile. -# Only __brp_python_bytecompile disabled, it does not solve the error... +# We can use __brp_python_bytecompile to disable it with rpm 4.14.2+ environment, +# but CentOS 7 has rpm 4.11.3 which does not support it. %if %{_centos_ver} == 7 %global __python %{nil} %endif From 9846c05bd8c624a51293916a76cf261a7c1188ad Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 3 Jul 2025 16:32:31 +0900 Subject: [PATCH 11/12] centos: remove redundant code Co-authored-by: Daijiro Fukuda Signed-off-by: Shizuo Fujita --- fluent-package/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluent-package/Gemfile b/fluent-package/Gemfile index f17223ce3..35d8ad2ee 100644 --- a/fluent-package/Gemfile +++ b/fluent-package/Gemfile @@ -5,7 +5,7 @@ require File.expand_path('../config.rb', __FILE__) def platform_centos7? return false unless File.exist?("/etc/os-release") os_info = File.read("/etc/os-release") - os_info.include?("CentOS Linux 7") ? true : false + os_info.include?("CentOS Linux 7") end source "https://rubygems.org" From d217b712339bb4fed9c461bcbc0892c2a499023b Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 4 Jul 2025 10:40:21 +0900 Subject: [PATCH 12/12] centos7: use _python_bytecompile_errors_terminate_build for bytecompile error Signed-off-by: Shizuo Fujita --- fluent-package/yum/fluent-package.spec.in | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index 83cb305f5..8870285cf 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -36,17 +36,8 @@ %define install_plugins /tmp/@PACKAGE_DIR@/.install_plugins %define pid_for_auto_restart /tmp/@PACKAGE_DIR@/.pid_for_auto_restart -# Disable to use old python on CentOS 7 because it causes error in brp-python-bytecompile. -# We can use __brp_python_bytecompile to disable it with rpm 4.14.2+ environment, -# but CentOS 7 has rpm 4.11.3 which does not support it. -%if %{_centos_ver} == 7 -%global __python %{nil} -%endif - -# Omit the brp-python-bytecompile automagic because post hook for ffi fails on AmazonLinux 2. -%if %{_amazon_ver} == 2 -%global __brp_python_bytecompile %{nil} -%endif +# Stop interrupting by bytecopile errors. The errors are causes on Amazon Linux 2 and CentOS 7. +%global _python_bytecompile_errors_terminate_build 0 %global __provides_exclude_from ^/opt/%{name}/.*\\.so.* %global __requires_exclude libjemalloc.*|libruby.*|/opt/%{name}/.*