teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.6.0-anyarch-actions-fix.patch

Jindrich Novy 84fa91
diff -up rpm-4.6.0/build/build.c.anyarch-actions-fix rpm-4.6.0/build/build.c
Jindrich Novy 84fa91
--- rpm-4.6.0/build/build.c.anyarch-actions-fix	2008-12-05 12:49:22.000000000 +0100
Jindrich Novy 84fa91
+++ rpm-4.6.0/build/build.c	2009-02-16 13:19:43.000000000 +0100
Jindrich Novy 84fa91
@@ -15,21 +15,18 @@ static int _build_debug = 0;
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
 /**
Jindrich Novy 84fa91
  */
Jindrich Novy 84fa91
-static void doRmSource(rpmSpec spec)
Jindrich Novy 84fa91
+rpmRC doRmSource(rpmSpec spec)
Jindrich Novy 84fa91
 {
Jindrich Novy 84fa91
     struct Source *p;
Jindrich Novy 84fa91
     Package pkg;
Jindrich Novy 84fa91
-    int rc;
Jindrich Novy 84fa91
+    int rc = 0;
Jindrich Novy 84fa91
     
Jindrich Novy 84fa91
-#if 0
Jindrich Novy 84fa91
-    rc = unlink(spec->specFile);
Jindrich Novy 84fa91
-#endif
Jindrich Novy 84fa91
-
Jindrich Novy 84fa91
     for (p = spec->sources; p != NULL; p = p->next) {
Jindrich Novy 84fa91
 	if (! (p->flags & RPMBUILD_ISNO)) {
Jindrich Novy 84fa91
 	    char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
Jindrich Novy 84fa91
 	    rc = unlink(fn);
Jindrich Novy 84fa91
 	    fn = _free(fn);
Jindrich Novy 84fa91
+	    if (rc) goto exit;
Jindrich Novy 84fa91
 	}
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
@@ -39,9 +36,12 @@ static void doRmSource(rpmSpec spec)
Jindrich Novy 84fa91
 		char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
Jindrich Novy 84fa91
 		rc = unlink(fn);
Jindrich Novy 84fa91
 		fn = _free(fn);
Jindrich Novy 84fa91
+	        if (rc) goto exit;
Jindrich Novy 84fa91
 	    }
Jindrich Novy 84fa91
 	}
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
+exit:
Jindrich Novy 84fa91
+    return !rc ? RPMRC_OK : RPMRC_FAIL;
Jindrich Novy 84fa91
 }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
 /*
Jindrich Novy 84fa91
diff -up rpm-4.6.0/build.c.anyarch-actions-fix rpm-4.6.0/build.c
Jindrich Novy 84fa91
--- rpm-4.6.0/build.c.anyarch-actions-fix	2008-12-05 12:49:16.000000000 +0100
Jindrich Novy 84fa91
+++ rpm-4.6.0/build.c	2009-02-16 13:19:43.000000000 +0100
Jindrich Novy 84fa91
@@ -240,6 +240,12 @@ static int buildForTarget(rpmts ts, cons
Jindrich Novy 84fa91
 	goto exit;
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
     
Jindrich Novy 84fa91
+    /* Don't parse spec if only its removal is requested */
Jindrich Novy 84fa91
+    if (ba->buildAmount == RPMBUILD_RMSPEC) {
Jindrich Novy 84fa91
+	rc = unlink(specFile);
Jindrich Novy 84fa91
+	goto exit;
Jindrich Novy 84fa91
+    }
Jindrich Novy 84fa91
+
Jindrich Novy 84fa91
     /* Parse the spec file */
Jindrich Novy 84fa91
 #define	_anyarch(_f)	\
Jindrich Novy 84fa91
 (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
Jindrich Novy 84fa91
@@ -253,6 +259,13 @@ static int buildForTarget(rpmts ts, cons
Jindrich Novy 84fa91
 	goto exit;
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
+    if ( ba->buildAmount&RPMBUILD_RMSOURCE && !(ba->buildAmount&~(RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)) ) {
Jindrich Novy 84fa91
+	rc = doRmSource(spec);
Jindrich Novy 84fa91
+	if ( rc == RPMRC_OK && ba->buildAmount&RPMBUILD_RMSPEC )
Jindrich Novy 84fa91
+	    rc = unlink(specFile);
Jindrich Novy 84fa91
+	goto exit;
Jindrich Novy 84fa91
+    }
Jindrich Novy 84fa91
+
Jindrich Novy 84fa91
     /* Assemble source header from parsed components */
Jindrich Novy 84fa91
     initSourceHeader(spec);
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
diff -up rpm-4.6.0/build/rpmbuild.h.anyarch-actions-fix rpm-4.6.0/build/rpmbuild.h
Jindrich Novy 84fa91
--- rpm-4.6.0/build/rpmbuild.h.anyarch-actions-fix	2008-12-05 12:49:22.000000000 +0100
Jindrich Novy 84fa91
+++ rpm-4.6.0/build/rpmbuild.h	2009-02-16 13:19:43.000000000 +0100
Jindrich Novy 84fa91
@@ -273,6 +273,13 @@ int parseExpressionBoolean(rpmSpec spec,
Jindrich Novy 84fa91
 char * parseExpressionString(rpmSpec spec, const char * expr);
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
 /** \ingroup rpmbuild
Jindrich Novy 84fa91
+ * Remove all sources assigned to spec file.
Jindrich Novy 84fa91
+ *
Jindrich Novy 84fa91
+ * @param spec		spec file control structure
Jindrich Novy 84fa91
+ * @return		RPMRC_OK on success
Jindrich Novy 84fa91
+ */
Jindrich Novy 84fa91
+rpmRC doRmSource(rpmSpec spec);
Jindrich Novy 84fa91
+/** \ingroup rpmbuild
Jindrich Novy 84fa91
  * Run a build script, assembled from spec file scriptlet section.
Jindrich Novy 84fa91
  *
Jindrich Novy 84fa91
  * @param spec		spec file control structure