summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-08-17 11:22:16 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-08-17 11:22:16 +0300
commit3fc58248d23d6f720942e5cbf4f92db246a802f0 (patch)
treefee6263e6cd79c4603263a1617eb10c9687487ac /build
parent859dd6d4d248a8277aad1bc72d1ab6b6fefa8e0d (diff)
downloadlibrpm-tizen-3fc58248d23d6f720942e5cbf4f92db246a802f0.tar.gz
librpm-tizen-3fc58248d23d6f720942e5cbf4f92db246a802f0.tar.bz2
librpm-tizen-3fc58248d23d6f720942e5cbf4f92db246a802f0.zip
Add default %clean section unless overridden in spec (ticket #81)
- avoids silly clutter in every specfile in the regular case but permits overriding if needed for whatever reason - it's a spec behavior change but mostly backwards compatible: existing specs will do whatever the %clean does, and if you need to avoid calling %clean for whatever reason just keep an empty %clean in the spec
Diffstat (limited to 'build')
-rw-r--r--build/parseSpec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 8eca50254..996c4d1ca 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -555,6 +555,13 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
}
}
+ if (spec->clean == NULL) {
+ char *body = rpmExpand("%{?buildroot: %{__rm} -rf %{buildroot}}", NULL);
+ spec->clean = newStringBuf();
+ appendLineStringBuf(spec->clean, body);
+ free(body);
+ }
+
/* Check for description in each package and add arch and os */
{
char *platform = rpmExpand("%{_target_platform}", NULL);