From 147fbaf1fda2a9fd8c6dede8e8dc61406d7a20c9 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 2 Feb 2020 12:18:23 -0500 Subject: [PATCH] platform: Ensure empty buildroot for %install This change ensures that any existing buildroot contents are wiped and a fresh empty one is created for usage in %install. Variations of this exist in virtually every RPM-based Linux distribution for more than a decade. At this point, it is expected behavior everywhere and it is amazing that it has not yet been put in RPM itself until now... Credit goes to Michael Schroeder from openSUSE for the original work and Tom Calloway for the variant adapted for Fedora that is the basis for this change. --- platform.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform.in b/platform.in index 61f5e18a07..604f0c3465 100644 --- a/platform.in +++ b/platform.in @@ -67,6 +67,16 @@ #============================================================================== # ---- Build policy macros. # +#--------------------------------------------------------------------- +# Expanded at beginning of %install scriptlet. +# + +%__spec_install_pre %{___build_pre}\ + %{__rm} -rf "%{buildroot}"\ + %{__mkdir_p} "%{dirname:%{buildroot}}"\ + %{__mkdir} "%{buildroot}"\ +%{nil} + #--------------------------------------------------------------------- # Expanded at end of %install scriptlet. #