add RPMBUILD_CLEAN support
authormarc <devnull@localhost>
Mon, 29 Jan 1996 19:14:54 +0000 (19:14 +0000)
committermarc <devnull@localhost>
Mon, 29 Jan 1996 19:14:54 +0000 (19:14 +0000)
CVS patchset: 231
CVS date: 1996/01/29 19:14:54

build/build.c

index f959d68..c545641 100644 (file)
@@ -39,6 +39,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line);
 static char *do_untar(Spec spec, int c);
 static char *do_patch(Spec spec, int c, int strip, char *dashb);
 int isCompressed(char *file);
+void doSweep(Spec s);
 
 static char build_subdir[1024];
 
@@ -139,6 +140,18 @@ int execPart(Spec s, char *sb, char *name, int builddir)
     return 0;
 }
 
+static void doSweep(Spec s)
+{
+    char buf[1024];
+    
+    struct Script *script;
+    script = openScript(s, 0);
+    sprintf(buf, "rm -rf %s\n", build_subdir);
+    writeScript(script, buf);
+    execScript(script);
+    freeScript(script);
+}
+
 static int doSetupMacro(Spec spec, StringBuf sb, char *line)
 {
     char *s, *s1, *version;
@@ -607,6 +620,9 @@ int doBuild(Spec s, int flags)
        if (packageBinaries(s)) {
            return 1;
        }
+       if (execClean(s)) {
+           return 1;
+       }
     }
 
     if (flags & RPMBUILD_SOURCE) {
@@ -615,10 +631,8 @@ int doBuild(Spec s, int flags)
        }
     }
 
-    if (flags & RPMBUILD_CLEAN) {
-       if (execClean(s)) {
-           return 1;
-       }
+    if (flags & RPMBUILD_SWEEP) {
+       doSweep(s);
     }
 
     return 0;