#2025 Issue closed: rear.spec: Remove unneeded %clean section

Labels: cleanup, fixed / solved / done

gdha opened issue at 2019-01-29 07:44:

  • ReaR version ("/usr/sbin/rear -V"): 2.4

  • Description of the issue (ideally so that others can reproduce it):
    It is the behavior since EPEL5.

Signed-off-by: Igor Gnatenko ignatenkobrain@fedoraproject.org

diff --git a/rear.spec b/rear.spec
index 7ca476c..d669dd3 100644
--- a/rear.spec
+++ b/rear.spec
@@ -139,9 +139,6 @@ echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >re
 %{__make} install DESTDIR="%{buildroot}"
 %{__install} -Dp -m0644 rear.cron %{buildroot}%{_sysconfdir}/cron.d/rear

-%clean
-%{__rm} -rf %{buildroot}
-
 %files
 %doc MAINTAINERS COPYING README.adoc doc/*.txt
 %doc %{_mandir}/man8/rear.8*

https://src.fedoraproject.org/rpms/rear/c/dece4909abd71fb9ccaf0447d9fb169188e9c120?branch=master

Question for SuSe: does the same rules apply for SLES these days?

jsmeix commented at 2019-01-29 10:35:

I agree to remove the %clean section.

I have no %clean section in my rear.spec
https://build.opensuse.org/package/view_file/Archiving/rear/rear.spec?expand=1
that is used for the official rear RPM in openSUSE at
https://build.opensuse.org/package/show/Archiving/rear
cf. https://github.com/rear/rear/issues/1855#issuecomment-404100990

What
https://en.opensuse.org/openSUSE:Specfile_guidelines
reads about a %clean section:

The %clean section should not be included -- it is no longer
necessary.

The %clean section, if specified, will be run after the binary and
source RPMs have been generated. In the Open Build Service, this
section is not necessary because chroots and VM environments
used to build the package are generally torn down anyway.
Building packages in environments not started from scratch
is usually not supported for openSUSE packages
(https://bugzilla.opensuse.org/show_bug.cgi?id=176528#c4).

Starting from rpm 4.8 (openSUSE 11.2+), rpm defaults
to "%clean: rm -Rf %{buildroot}" if the %clean section
is completely absent from the spec file.

If a package contains a %clean section, it should be safe to remove.
Check with another maintainer first if you are not sure.

gdha commented at 2019-02-11 14:09:

The %clean section was already removed by 2819c071681a19fc3382aa84bfaf1654508a64aa


[Export of Github issue for rear/rear.]