[Fedora-packaging] packaging python applications

Michael Schwendt mschwendt at gmail.com
Fri May 4 09:36:52 UTC 2012


On Thu, 3 May 2012 15:01:09 -0700 (PDT), KA (Kamal) wrote:

> I apologize for the context. Here is what i am trying to do:
> 
> I have a Custom Application, that i managed to build RPM for.
> Now this application has some dependencies, like ZSI ( a Python Soap Framework ) 
> 
> what i am trying to do , is to package ZSI as part of the RPM.

Unusual, but doable. The superior and preferred way would be to put ZSI
in separate RPM packages and add proper RPM dependencies to your
application package.

> hence:
> 
> Source0: core-0.2.tar.gz
> Source1: ZSI-2.1-a1.tar.gz
> 
> 
> %prep
> %setup -qn core
> %setup -q -n ZSI-2.1-a1

Have you had a look at the rpmbuild output for this? That would be a good
exercise, because you would become more familiar with the %setup command
and the directory structure you will need to work with in the rest of your
spec file. As a hint, %setup can take options to extract multiple tarballs,
individuals tarballs, and it can also create a top-level directory (if you
need one, e.g. as a convenient root to include multiple extracted tarballs).

> %build
> #make core hnb_oct
> %{__make} core hnb_oct
> #%{__python} setup.py build
> %{__python} ZSI-2.1-a1/setup.py build
> 
> 
> But i get error:
> 
> + cd ZSI-2.1-a1
> /var/tmp/rpm-tmp.63811: line 47: cd: ZSI-2.1-a1: No such file or directory
> error: Bad exit status from /var/tmp/rpm-tmp.63811 (%prep)

This output is severely truncated and gives not enough context. One cannot
see the beginning of the %build section processing, for example.

As above, your %build section must do whatever is necessary to work within
the directory structure you created in the %prep section. Depending on
what directory structure you create, it may be necessary to "cd" into
individual directories in %build and %install, for example. It's just
a matter of paying attention to the rpmbuild output, then think about it
and adjust the spec file accordingly.
 
> 1. is it possible to to build ZSI as part of this RPM ? I see that openssh does it by packaging client and server in one RPM.
>

Yes, it is possible to define multiple packages (aka sub-packages) in a
spec file.

> 2. I could not find any example that is close to what i am trying to do.

Thousands of Fedora packages build multiple packages from a single spec
file. Hundreds (if not thousands as well) extract multiple %{SOURCEx}
archives and handle the extracted build directories in %build and %install
as necessary. The Maximum RPM book is one source that explains "subpackages".

-- 
Fedora release 17 (Beefy Miracle) - Linux 3.3.4-3.fc17.x86_64
loadavg: 0.81 0.65 0.27


More information about the packaging mailing list