--- ./build/parseSpec.c.orig 2010-03-25 15:19:16.000000000 +0000 +++ ./build/parseSpec.c 2010-03-25 15:45:25.000000000 +0000 @@ -562,6 +562,13 @@ int parseSpec(rpmts ts, const char *spec free(body); } + 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);