On Mon, Mar 06, 2023 at 01:27:18PM +0100, Jarek Prokop wrote:
Interesting situation.
On 3/6/23 12:49, Ewoud Kohl van Wijngaarden wrote:
While rubygem-openscap is retired in Fedora, the Foreman project
still packages it.
For context: rubygem-openscap can load libopenscap.so.8 and
libopenscap.so.25 through FFI. Today we depend on a specific
version, but every time it's bumped we go through a verification to
see if the SO version hasn't been bumped.
A bit of a tangent first.
This sounds like it could be checked via a "simple" FFI load check in
%check section, in ruby, something like:
~~~
require 'ffi'
module Check
extend FFI::Library
ffi_lib 'libopenscap.so.25'
end
~~~
This will throw an exception if the .so is not available.
This is indeed pretty much how the code looks:
https://github.com/OpenSCAP/ruby-openscap/blob/master/lib/openscap/openscap.rb
So adding a verification step in %check is actually a good idea, though
I'd also consider including the actual class rather than a mock.
At first I started with a trivial Requires: libopenscap.so.25 but
that pulls in both openscap for i686 and x86_64. Directly depending
on
libopenscap.so.25()(64bit) feels wrong, so what is the correct
approach here? Is there some helper macro here?
There are *some*, but nothing universal it seems. JFTR other packages
that require libs like this are (and make use of some _isa macros):
cross-gcc.spec
ghdl.spec
glib2.spec
julia.spec
libreoffice.spec
redhat-lsb.spec
systemd.spec
asahi-installer.spec
You can grep through all specfiles using this tar:
https://pkgs.fedoraproject.org/repo/rpm-specs-latest.tar.xz
I'd recommend reading the systemd and Julia files as inspiration,
those 2 seem to be doing what you are speaking of.
tl;dr those spec files indicate you need to conditionally depend on
both, depending on whether it is 32 or 64bit build.
Those look very useful. The __isa_bits part in systemd.spec looks like
what I've been looking for.
Technically speaking I think it should depend on what rubygem-ffi
can load, but on x86_64 that's probably 64 bit only. However, this
is a bit out of my knowledge area.
This could, in theory, be checked in the %check section of the package
as I indicated above, if you add the same to BuildRequires, even if it
won't help if openscap changes the .so version.
Will do, this has been very useful.
For completeness, the discussion started in a PR:
https://github.com/theforeman/foreman-packaging/pull/9051
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue