From c4be21841fbdde56f647247758f54e31eb99fc31 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 11 Jan 2024 12:35:35 +0200 Subject: [PATCH] Define a global %clean default, reuse for the non-buildsystem, case too We've had this special case for %clean for ages, but this actually offers a nice opportunity to put it into a macro that allows customization and is used for more than one purpose. --- build/parseSpec.c | 2 +- macros.in | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/parseSpec.c b/build/parseSpec.c index 8ba0bd7c4b..9a0a1f8734 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -1214,7 +1214,7 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags, goto errxit; if (spec->sections[SECT_CLEAN] == NULL) { - char *body = rpmExpand("%{?buildroot: %{__rm} -rf %{buildroot}}", NULL); + char *body = rpmExpand("%{buildsystem_default_clean}", NULL); spec->sections[SECT_CLEAN] = newStringBuf(); appendLineStringBuf(spec->sections[SECT_CLEAN], body); free(body); diff --git a/macros.in b/macros.in index 88dbf109c0..7f3b06d1db 100644 --- a/macros.in +++ b/macros.in @@ -1354,6 +1354,7 @@ end # Global buildsystem defaults %buildsystem_default_prep() %autosetup -p1 %* +%buildsystem_default_clean() %{__rm} -rf %{buildroot} # Example buildsystem for autotools %buildsystem_autotools_conf() %configure %*