From 4e85ef055e85ab2bb9ce0e63f51c3c5379a40988 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 14 Feb 1996 20:07:09 +0000 Subject: [PATCH] added doRmSource() CVS patchset: 267 CVS date: 1996/02/14 20:07:09 --- build/build.c | 4 ++++ build/pack.c | 34 ++++++++++++++++++++++++++++++++++ build/pack.h | 1 + 3 files changed, 39 insertions(+) diff --git a/build/build.c b/build/build.c index 5613ad1..71ea5c0 100644 --- a/build/build.c +++ b/build/build.c @@ -633,5 +633,9 @@ int doBuild(Spec s, int flags) doSweep(s); } + if (flags & RPMBUILD_RMSOURCE) { + doRmSource(s); + } + return 0; } diff --git a/build/pack.c b/build/pack.c index f1daccb..0f85c7e 100644 --- a/build/pack.c +++ b/build/pack.c @@ -945,3 +945,37 @@ int packageSource(Spec s) return 0; } + +/****************** Source Removal ********************/ + +int doRmSource(Spec s) +{ + char filename[1024]; + struct sources *source; + struct PackageRec *package; + + /* spec file */ + sprintf(filename, "%s%s", getVar(RPMVAR_SPECDIR), + strrchr(s->specfile, '/')); + unlink(filename); + + /* sources and patches */ + source = s->sources; + while (source) { + sprintf(filename, "%s/%s", getVar(RPMVAR_SOURCEDIR), source->source); + unlink(filename); + source = source->next; + } + + /* icons */ + package = s->packages; + while (package) { + if (package->icon) { + sprintf(filename, "%s/%s", getVar(RPMVAR_SOURCEDIR), + package->icon); + unlink(filename); + } + package = package->next; + } + +} diff --git a/build/pack.h b/build/pack.h index 1117827..53857a2 100644 --- a/build/pack.h +++ b/build/pack.h @@ -6,5 +6,6 @@ void markBuildTime(void); int packageBinaries(Spec s); int packageSource(Spec s); +int doRmSource(Spec s); #endif _PACK_H_ -- 2.7.4