From 5964c5d678a74bf47ea7fe7bfa055639b8e39ad8 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 23 Apr 2024 11:20:22 -0700 Subject: [PATCH 1/3] Future proof ruby-selinux Change conditional so that the swig generated interface is only patched on older Debian and Ubuntu. --- configs/components/_base-ruby-selinux.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/components/_base-ruby-selinux.rb b/configs/components/_base-ruby-selinux.rb index c542918b1..e6ac3ecd3 100644 --- a/configs/components/_base-ruby-selinux.rb +++ b/configs/components/_base-ruby-selinux.rb @@ -78,7 +78,8 @@ if ruby_version =~ /^3/ # swig 4.1 generated interface does not need patching - unless platform.name =~ /^(debian-12|ubuntu-24)/ + if (!platform.is_debian? || platform.os_version.to_i < 12) && + (!platform.is_ubuntu? || platform.os_version.to_i < 24) steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_wrap.patch" end end From b092e83e51ce8f9a027f71c745dbe84d0e022aee Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 2 Apr 2024 14:40:41 -0700 Subject: [PATCH 2/3] Add fedora 40 --- configs/components/_base-ruby-selinux.rb | 1 + configs/platforms/fedora-40-x86_64.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 configs/platforms/fedora-40-x86_64.rb diff --git a/configs/components/_base-ruby-selinux.rb b/configs/components/_base-ruby-selinux.rb index e6ac3ecd3..cb93f3335 100644 --- a/configs/components/_base-ruby-selinux.rb +++ b/configs/components/_base-ruby-selinux.rb @@ -79,6 +79,7 @@ if ruby_version =~ /^3/ # swig 4.1 generated interface does not need patching if (!platform.is_debian? || platform.os_version.to_i < 12) && + (!platform.is_fedora? || platform.os_version.to_i < 40) && (!platform.is_ubuntu? || platform.os_version.to_i < 24) steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_wrap.patch" end diff --git a/configs/platforms/fedora-40-x86_64.rb b/configs/platforms/fedora-40-x86_64.rb new file mode 100644 index 000000000..24e41f200 --- /dev/null +++ b/configs/platforms/fedora-40-x86_64.rb @@ -0,0 +1,20 @@ +platform 'fedora-40-x86_64' do |plat| + plat.servicedir '/usr/lib/systemd/system' + plat.defaultdir '/etc/sysconfig' + plat.servicetype 'systemd' + plat.dist 'fc40' + + packages = %w[ + autoconf automake bzip2-devel gcc gcc-c++ libselinux-devel + libsepol libsepol-devel make cmake pkgconfig readline-devel + rpmdevtools rsync swig zlib-devel systemtap-sdt-devel + perl-lib perl-FindBin + ] + plat.provision_with("/usr/bin/dnf install -y --best --allowerasing #{packages.join(' ')}") + + plat.install_build_dependencies_with '/usr/bin/dnf install -y --best --allowerasing' + + plat.docker_image 'fedora:40' + plat.docker_run_args ['--tty', '--entrypoint=/bin/sh'] + plat.use_docker_exec true +end From 79c00e1ad7c8c5203709a6310e879a8aae2aa907 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 23 Apr 2024 11:23:08 -0700 Subject: [PATCH 3/3] Apply upstream patch to remove sibling argument --- configs/components/_base-ruby-augeas.rb | 2 ++ ...augeas-0.5.0-remove-sibling-argument.patch | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 resources/patches/augeas/ruby-augeas-0.5.0-remove-sibling-argument.patch diff --git a/configs/components/_base-ruby-augeas.rb b/configs/components/_base-ruby-augeas.rb index 8a40798c5..03b73351f 100644 --- a/configs/components/_base-ruby-augeas.rb +++ b/configs/components/_base-ruby-augeas.rb @@ -4,6 +4,7 @@ # pkg.add_source("file://resources/patches/augeas/ruby-augeas-0.5.0-patch_c_extension.patch") +pkg.add_source("file://resources/patches/augeas/ruby-augeas-0.5.0-remove-sibling-argument.patch") # These can be overridden by the including component. ruby_version ||= settings[:ruby_version] @@ -75,6 +76,7 @@ if ruby_version =~ /^3/ build_commands << "#{platform.patch} --strip=2 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../ruby-augeas-0.5.0-patch_c_extension.patch" end + build_commands << "#{platform.patch} --strip=1 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../ruby-augeas-0.5.0-remove-sibling-argument.patch" build_commands << "#{ruby} ext/augeas/extconf.rb" build_commands << "#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1)" diff --git a/resources/patches/augeas/ruby-augeas-0.5.0-remove-sibling-argument.patch b/resources/patches/augeas/ruby-augeas-0.5.0-remove-sibling-argument.patch new file mode 100644 index 000000000..498ae9a99 --- /dev/null +++ b/resources/patches/augeas/ruby-augeas-0.5.0-remove-sibling-argument.patch @@ -0,0 +1,27 @@ +From 9f1f9df48ef8c6f62349eccb90dc54a3c3d75e3f Mon Sep 17 00:00:00 2001 +From: Ewoud Kohl van Wijngaarden +Date: Wed, 31 Jan 2024 12:52:45 +0100 +Subject: [PATCH] Remove unused sibling argument from augeas_rm + +This makes the function match the method definition. There was already a +warning about this, but Fedora 40 applies more hardening and it's a +fatal error. + +Fixes: e6b57c58d24b ("Initial ruby bindings, written by Bryan Kearney") +--- + ext/augeas/_augeas.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/augeas/_augeas.c b/ext/augeas/_augeas.c +index f9b49d1..7ef0d7d 100644 +--- a/ext/augeas/_augeas.c ++++ b/ext/augeas/_augeas.c +@@ -184,7 +184,7 @@ VALUE augeas_mv(VALUE s, VALUE src, VALUE dst) { + * + * Remove path and all its children. Returns the number of entries removed + */ +-VALUE augeas_rm(VALUE s, VALUE path, VALUE sibling) { ++VALUE augeas_rm(VALUE s, VALUE path) { + augeas *aug = aug_handle(s); + const char *cpath = StringValueCStr(path) ; +