Skip to content

Commit

Permalink
Document %clean as obsolete and drop the unnecessary default %clean
Browse files Browse the repository at this point in the history
In rpm < 4.8, %clean was needed to clean up the build root for packages
that used one (it was optional before 4.6). Since the introduction of
the new %builddir in 9d35c8d,
everything the package produces is collected in that one directory
that we can and do centrally clean up, making the separate %clean
section even more useless.

Document %clean as obsolete and drop all the now unnecessary default
%clean sections we've been adding for the packages.
  • Loading branch information
pmatilai committed Mar 28, 2024
1 parent 9634fe8 commit b5f6c64
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
7 changes: 0 additions & 7 deletions build/parseSpec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1267,13 +1267,6 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
if (parseSpecSection(&spec, PARSE_SPECFILE) != RPMRC_OK)
goto errxit;

if (spec->sections[SECT_CLEAN] == NULL) {
char *body = rpmExpand("%{buildsystem_default_clean}", NULL);
spec->sections[SECT_CLEAN] = newStringBuf();
appendLineStringBuf(spec->sections[SECT_CLEAN], body);
free(body);
}

/* Assemble source header from parsed components */
initSourceHeader(spec);
return spec;
Expand Down
6 changes: 6 additions & 0 deletions docs/manual/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ places. For many simple packages this is just:
If the packaged software has accomppanying tests, this is where they
should be executed.

### %clean (OBSOLETE)

Packages should place all their temporaries inside their designated
`%builddir`, which rpm will automatically clean up. Needing a package
specific `%clean` section generally suggests flaws in the spec.

## Runtime scriptlets

Runtime scriptlets are executed at the time of install and erase of the
Expand Down
1 change: 0 additions & 1 deletion macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,6 @@ end

# Global buildsystem defaults
%buildsystem_default_prep() %autosetup -p1 %*
%buildsystem_default_clean() %{__rm} -rf %{buildroot}

# \endverbatim
#*/
Expand Down
2 changes: 0 additions & 2 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ Executing(%conf)
Executing(%build)
Executing(%install)
Executing(%check)
Executing(%clean)
Executing(rmbuild)
],
[])
Expand All @@ -199,7 +198,6 @@ Executing(%conf)
Executing(%build)
Executing(%install)
Executing(%check)
Executing(%clean)
Executing(rmbuild)
],
[])
Expand Down

0 comments on commit b5f6c64

Please sign in to comment.