- export doRmSource() and make it more consistent with the API
goto exit;
}
+ if ( ba->buildAmount&RPMBUILD_RMSOURCE && !(ba->buildAmount&~(RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)) ) {
+ rc = doRmSource(spec);
+ if ( rc == RPMRC_OK && ba->buildAmount&RPMBUILD_RMSPEC )
+ rc = unlink(specFile);
+ goto exit;
+ }
+
/* Assemble source header from parsed components */
initSourceHeader(spec);
/**
*/
-static void doRmSource(rpmSpec spec)
+rpmRC doRmSource(rpmSpec spec)
{
struct Source *p;
Package pkg;
- int rc;
+ int rc = 0;
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
rc = unlink(fn);
fn = _free(fn);
+ if (rc) goto exit;
}
}
char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
rc = unlink(fn);
fn = _free(fn);
+ if (rc) goto exit;
}
}
}
+exit:
+ return !rc ? RPMRC_OK : RPMRC_FAIL;
}
/*
char * parseExpressionString(rpmSpec spec, const char * expr);
/** \ingroup rpmbuild
+ * Remove all sources assigned to spec file.
+ *
+ * @param spec spec file control structure
+ * @return RPMRC_OK on success
+ */
+rpmRC doRmSource(rpmSpec spec);
+/** \ingroup rpmbuild
* Run a build script, assembled from spec file scriptlet section.
*
* @param spec spec file control structure