Skip to content

Commit 6ecff8b

Browse files
committed
Future proof ruby-selinux
We only need to patch older Debian/Fedora/Ubuntu, but shouldn't need to for future additions.
1 parent a7fc904 commit 6ecff8b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: configs/components/_base-ruby-selinux.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@
7979
]
8080

8181
if ruby_version =~ /^3/
82-
# swig 4.1 generated interface does not need patching
83-
unless platform.name =~ /^(debian-12|ubuntu-24|fedora-40)/
82+
# swig 4.1 generated interface does not need patching, so skip
83+
# when running debian >= 12, fedora >= 40, etc
84+
unless (platform.is_debian? && platform.os_version.to_i >= 12) ||
85+
(platform.is_fedora? && platform.os_version.to_i >= 40) ||
86+
(platform.is_ubuntu? && platform.os_version.to_i >= 24)
8487
steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_wrap.patch"
8588
end
8689
# EL 7 uses an older version of swig (2.0) so a different patch is needed to
@@ -90,7 +93,8 @@
9093
else
9194
# Ubuntu 24 & Fedora 40 use a newer swig that already has the fix that's
9295
# being patched
93-
unless platform.name =~ /^(ubuntu-24|fedora-40)/
96+
unless (platform.is_fedora? && platform.os_version.to_i >= 40) ||
97+
(platform.is_ubuntu? && platform.os_version.to_i >= 24)
9498
steps << "#{platform.patch} --strip=0 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../selinuxswig_ruby_undefining_allocator.patch"
9599
end
96100
end

0 commit comments

Comments
 (0)