Discussion:
Python binding chicken and egg situation
Greg Freemyer
2014-09-24 18:38:08 UTC
Permalink
All,

I'm trying to package yara with sub-projects of libyara3 and python-yara.

https://build.opensuse.org/package/show/home:gregfreemyer:Tools-for-forensic-boot-cd/yara

I have the "python setup.py build" commented out for now because it
fails because libyara.so is not available.

libyara3 as a dependency doesn't make sense because it is a
sub-package of the same package (yara).

Not sure how to resolve this. Ideas welcome.

(One option is to just create an entire second package (python-yara)
that only addresses the python binding, then have that BuildRequire
libyara-devel.)

Thanks
Greg
--
Greg Freemyer
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Jan Engelhardt
2014-09-24 20:58:17 UTC
Permalink
Post by Greg Freemyer
All,
I'm trying to package yara with sub-projects of libyara3 and python-yara.
[...]
libyara3 as a dependency doesn't make sense because it is a
sub-package of the same package (yara).
If the just-built python interface requires a just-built libyara, then,
both ought to be produced in one go, from one specfile (and thus,
one build invocation).

Like... sssd.spec. This also produces a bunch of shared libs and
some python interfaces.
Post by Greg Freemyer
(One option is to just create an entire second package (python-yara)
that only addresses the python binding, then have that BuildRequire
libyara-devel.)
Such is only necessary in the bootstrap phase/when requirements shoot
through the roof (like with util-linux-systemd).
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Greg Freemyer
2014-09-24 22:33:28 UTC
Permalink
Post by Jan Engelhardt
Post by Greg Freemyer
All,
I'm trying to package yara with sub-projects of libyara3 and python-yara.
[...]
libyara3 as a dependency doesn't make sense because it is a
sub-package of the same package (yara).
If the just-built python interface requires a just-built libyara, then,
both ought to be produced in one go, from one specfile (and thus,
one build invocation).
Like... sssd.spec. This also produces a bunch of shared libs and
some python interfaces.
Post by Greg Freemyer
(One option is to just create an entire second package (python-yara)
that only addresses the python binding, then have that BuildRequire
libyara-devel.)
Such is only necessary in the bootstrap phase/when requirements shoot
through the roof (like with util-linux-systemd).
Jan,

That makes sense conceptually, but what;s the best way to fix it.

How's this prep section? It allows the python setup.py to find the
library after "make" creates it, but before it is installed:

============
%prep
%setup -q
cd yara-python
sed -i "/libraries=\['yara'\],/a
library_dirs=['%_builddir/%name-%version/libyara/.libs']," setup.py
============

That sed line is very dependent on "/libraries=\['yara'\]," being an
existing line in setup.py, but a patch would be equally dependant.

I think I have enough macros in the line I'm adding that it will work
for a reasonable period of time going forward. A patch would not let
me use macros as far as I know.

For clarity of what the sed statement is doing, this is the same thing
in a patch with no macros:
====
--- yara-3.1.0.orig/yara-python/setup.py
+++ yara-3.1.0/yara-python/setup.py
@@ -24,5 +24,6 @@ setup(name='yara-python',
name='yara',
sources=['yara-python.c'],
libraries=['yara'],
+ library_dirs=['/home/abuild/rpmbuild/BUILD/yara-3.1.0/libyara/.libs'],
include_dirs=['../windows/include', '../libyara/include'],
)])
====

Thanks
Greg
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Jan Engelhardt
2014-09-25 06:54:50 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...