maurorodrigues
maurorodrigues

Reputation: 329

how to build a rpm using just the sources instead of tarball

I have this build process that create rpms for a set of linux distributions.

This creation is taking so much time and for this I'm optimizing it. I've study rpmbuild and realize that rpmbuild takes a tarball and extract it to start the build process.

There is a way to avoid use tarball?? Cause I already begin the process with the sources, then I compress it in a tarball and this seems useless since rpmbuild works on sources, not tarballs

Upvotes: 3

Views: 2372

Answers (1)

Corey Henderson
Corey Henderson

Reputation: 7455

Three basic ways to go about this:

  1. Use the --short-circuit switch to rpmbuild to skip directly to the build step.
  2. List every file in your sources as a SourceXX: in the spec file, and place all those files in the rpmbuild/SOURCES/ directory
  3. Wrap the %setup macro with some intelligence

Option 1 lets you temporarily work around having to extract the tarball each time, which is ideal for development. Option 2 bypasses the notion of having a tarball to begin with, but becomes cumbersome when you have lots and lots of files. Option 3 is when regular builds of the package happen, and it's a large source file, such as the linux kernel. The EL6 kernel .spec file does this:

if [ ! -d kernel-%{kversion}/vanilla-%{kversion}/ ]; then
    %setup -q -n kernel-%{kversion} -c
    mv linux-2.6.32 vanilla-%{kversion};
else
    cd kernel-%{kversion}/;
fi

cp -rl vanilla-%{kversion} linux-%{KVERREL}

cd linux-%{KVERREL}

Basically, extract the kernel sources and name it something else. Upon next build, check for that. If it's there, don't extract the source, just make a copy.

Upvotes: 8

Related Questions