summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2009-01-11 16:54:07 +0100
committerJindrich Novy <jnovy@redhat.com>2009-01-11 16:54:07 +0100
commite58db2eda1609a8b48d8248390a2d87ff99fdd6d (patch)
tree22c7c08417d63d66b072ce542ef46780e926ed09
parent1909784075c064ec8102b785415e6e7b832df3c3 (diff)
downloadrpm-e58db2eda1609a8b48d8248390a2d87ff99fdd6d.tar.gz
Don't check package BuildRequires when doing --rmsource (rhbz#452477)
- export doRmSource() and make it more consistent with the API
-rw-r--r--build.c7
-rw-r--r--build/build.c8
-rw-r--r--build/rpmbuild.h7
3 files changed, 20 insertions, 2 deletions
diff --git a/build.c b/build.c
index 3891b2a8d..48e579d61 100644
--- a/build.c
+++ b/build.c
@@ -259,6 +259,13 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
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);
diff --git a/build/build.c b/build/build.c
index 45e9b1038..a4a271a43 100644
--- a/build/build.c
+++ b/build/build.c
@@ -15,17 +15,18 @@ static int _build_debug = 0;
/**
*/
-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;
}
}
@@ -35,9 +36,12 @@ static void doRmSource(rpmSpec spec)
char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
rc = unlink(fn);
fn = _free(fn);
+ if (rc) goto exit;
}
}
}
+exit:
+ return !rc ? RPMRC_OK : RPMRC_FAIL;
}
/*
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 0ba3c7e05..acea095ca 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -273,6 +273,13 @@ int parseExpressionBoolean(rpmSpec spec, const char * expr);
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