Well, I’m here again.
I’m trying to make a package. My workflow is trial and error.
Every time I issue rpmbuild -ba ~/rpmbuild/SPECS/file.spec
make is invoked. Let’s suppose there is an error in the compilation process, or somewhere else (i.e. in a section of the spec file). So I correct the problem, then I relaunch rpmbuild
and the compilation process start over. Since compiling such software takes a lot of time, there is a way to keep the already compiled stuff in place (like the make command does when it is launched out of the rpmbuild process)?
You can use --short-circuit -bc
to run just %build or --short-circuit -bi
to run just %install, which is pretty useful for quick testing. However, afaik in order to actually build a full RPM, you have to start from the top.
Unfortunately, --short-circuit
is completely useless for dependency testing because of the fake dependency it automatically adds. See this discussion about a patch I submitted.
Oof, that sucks. I do think it’ll work for OP though, since they seem to have mentioned compile errors, which I’d hope aren’t related to missing deps or similar.
Same, if they’re getting to the point of make
being run, then they’re past all that.
@alciregi, I would switch from rpmbuild -ba
to rpmbuild -bc --short-circuit
until the compile (-bc
) step completes successfully, then you can either run an rpmbuild -bi --short-circuit
to debug the install part, or go for the -ba
at that point. But as refi said, at some point to actually create the packages you’ll need to let it start over and run through the whole process in one go.
Debugging the process “by hand” in the build dir (which it sounds like you’ve been doing) shouldn’t be overlooked as a problem-solving method, though. I find that the more I structure my efforts to match the “real” build process, the more likely a working manual compilation will translate into a successful rpmbuild
run.
In fact, sometimes I’ll set up an ad hoc git repo right inside a package builddir* & check in all the files (git init; git add -A; git commit -m "Baseline"
), then check in whatever modifications I subsequently make as additional commits. That lets me export patches ready for insertion into my spec file with git format-patch
. (I even have a script, rpmdev-configure
, that I use to debug the configure step — especially helpful for assembling the list of BuildRequires
. It invokes ./configure
with all of rpmbuild
’s default flags, along with any I add on the command line. So I can just keep repeatedly installing -devel
packages and trying again, without having to involve rpmbuild
.)
* – One caveat: Keep in mind that having a .git
dir in a directory will prevent you from deleting it with rm -r
, unless you also -f
/--force
the rm
. Of course, gio trash
still works fine, and as a bonus it’s also safer.