Rpmbuild Question

Home » CentOS » Rpmbuild Question
CentOS 3 Comments

Hi, folks,

Trying to build a package from a gzipped tarball of a python package. I’m trying to build it in /root/rpmbuild. Python has a way to build it, but it creates its own tree, with a clone of the rpmbuild tree under
*that*.

So, from the specfile, I’m trying to understand, after much googling, what I need to change the Source and BuildRoot to. My latest try for the latter is BuildRoot: %{_builddir}/BUILD/%{name}-%{version}-%{release}
For Source0, I want to use the file in SOURCES.

Anyone got a better example than what I’ve been googling?

mark

3 thoughts on - Rpmbuild Question

  • Don’t do that. Install rpmdevtools so you build it under your home directory and avoid blowing up your system if there’s an error.

  • directory and avoid blowing up your system if there’s an error.

    First of all read up on how to properly build an RPM:

    https://www.hogarthuk.com/?q=node/11

    Since this is python look up the Fedora python guidelines and follow those.

    Here’s the spec for a recent python library I packaged:

    https://pkgs.fedoraproject.org/cgit/rpms/python-ntlm3.git/tree/python-ntlm3.spec

    If you don’t need python3 you can strip that stuff out …

    The Fedora python guidelines have a decent spec template you can crib, keep in mind the el6 caveats if you need to build for that with regards to macro definitions

  • To echo Frank’s advice: don’t do that. Build rpms as a non-root user.
    Consider using “mock”, especially if you intend to distribute your packages.

    It sounds like you’re using “setup.py bdist_rpm”. When you do that, python’s setuptools will create a temporary rpm build environment in
    ./build/. You should also get the src.rpm in ./dist/

    If you want to build the package in your own rpmroot, just take the src.rpm from ./dist/ and rebuild it.

LEAVE A COMMENT