move doRmSource() here
authorroot <devnull@localhost>
Fri, 7 Jun 1996 18:27:56 +0000 (18:27 +0000)
committerroot <devnull@localhost>
Fri, 7 Jun 1996 18:27:56 +0000 (18:27 +0000)
CVS patchset: 615
CVS date: 1996/06/07 18:27:56

build/build.c

index 4bf6162..7f98086 100644 (file)
@@ -23,6 +23,8 @@
 #include "misc.h"
 #include "pack.h"
 
+#include "names.h"
+
 struct Script {
     char *name;
     FILE *file;
@@ -39,6 +41,7 @@ static char *do_untar(Spec spec, int c);
 static char *do_patch(Spec spec, int c, int strip, char *dashb);
 int isCompressed(char *file);
 static void doSweep(Spec s);
+static int doRmSource(Spec s);
 
 char build_subdir[1024];
 
@@ -162,6 +165,39 @@ static void doSweep(Spec s)
     }
 }
 
+static 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;
+    }
+    
+    return 0;
+}
+
 static int doSetupMacro(Spec spec, StringBuf sb, char *line)
 {
     char *s, *s1, *version;