Skip to content

Commit

Permalink
Define --build-in-place in more clear and actually supportable way
Browse files Browse the repository at this point in the history
Defining in-place builds to skip %prep suddenly makes this feature start
looking supportable, because it's no longer ambiguous every which way:
%setup is supposed to have all manner of side-effects that in-place
builds would skip, including cd'ing to %buildsubdir. It's not possible
for calling %setup to both have and not have side-effects.

Besides %setup ambiguity, %prep typically contains patch applications
and those cannot be meaningfully done on in-place build because then
the build is no longer repeatable.

Update the man page description to describe the new %buildsubdir
based behavior, and make %prep skipped on in-place builds no matter
what other options got passed. This WILL break some existing users
if they rely on %prep getting partially executed, but that's how
it is with ambiguity. If there's another non-ambiguous way to
solve this, I'm not seeing it.

Fixes: rpm-software-management#3208
  • Loading branch information
pmatilai committed Aug 26, 2024
1 parent e927be7 commit 84d356a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static int buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
"buildsubdir", NULL, "%{NAME}-%{VERSION}", RMIL_SPEC);
if (didBuild)
what |= RPMBUILD_MKBUILDDIR;
what &= ~(RPMBUILD_RMBUILD);
what &= ~(RPMBUILD_PREP|RPMBUILD_RMBUILD);
}

if ((what & RPMBUILD_CHECKBUILDREQUIRES) &&
Expand Down
4 changes: 0 additions & 4 deletions build/parsePrep.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ void doSetupMacro(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t margs, size_t *parsed
goto exit;
}

if (rpmExpandNumeric("%{_build_in_place}")) {
goto exit;
}

optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
while ((arg = poptGetNextOpt(optCon)) > 0) {
char *optArg = poptGetOptArg(optCon);
Expand Down
7 changes: 4 additions & 3 deletions docs/man/rpmbuild.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,10 @@ The following options may also be used:

**\--build-in-place**

: Build from locally checked out sources. Sets \_builddir to current
working directory. Skips handling of -n and untar in the %setup and
the deletion of the buildSubdir.
: Build from locally checked out sources in the current working
directory. The build tree is set up as if %setup was used,
but %builddir/%buildsubdir points back to the current working
directory. %prep is skipped entirely.

**\--target ***PLATFORM*

Expand Down

0 comments on commit 84d356a

Please sign in to comment.