/**
*/
-static void doRmSource(rpmSpec spec)
+rpmRC doRmSource(rpmSpec spec)
{
struct Source *p;
Package pkg;
- int rc;
+ int rc = 0;
-#if 0
- rc = unlink(spec->specFile);
-#endif
-
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;
}
/*
*/
rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb, int test)
{
- const char * rootURL = spec->rootURL;
- const char * rootDir;
- const char *scriptName = NULL;
- char * buildDirURL = rpmGenPath(rootURL, "%{_builddir}", "");
- const char * buildScript;
+ const char * rootDir = spec->rootDir;
+ char *scriptName = NULL;
+ char * buildDir = rpmGenPath(rootDir, "%{_builddir}", "");
char * buildCmd = NULL;
char * buildTemplate = NULL;
char * buildPost = NULL;
int argc = 0;
const char **argv = NULL;
FILE * fp = NULL;
- urlinfo u = NULL;
FD_t fd;
FD_t xfd;
goto exit;
}
- if (rpmMkTempFile(rootURL, &scriptName, &fd) || fd == NULL || Ferror(fd)) {
+ fd = rpmMkTempFile(rootDir, &scriptName);
+ if (fd == NULL || Ferror(fd)) {
rpmlog(RPMLOG_ERR, _("Unable to open temp file.\n"));
rc = RPMRC_FAIL;
goto exit;
goto exit;
}
- (void) urlPath(rootURL, &rootDir);
if (*rootDir == '\0') rootDir = "/";
- (void) urlPath(scriptName, &buildScript);
-
buildTemplate = rpmExpand(mTemplate, NULL);
buildPost = rpmExpand(mPost, NULL);
}
if (_build_debug)
-fprintf(stderr, "*** rootURL %s buildDirURL %s\n", rootURL, buildDirURL);
- if (buildDirURL && buildDirURL[0] != '/' &&
- (urlSplit(buildDirURL, &u) != 0)) {
+fprintf(stderr, "*** rootDir %s buildDir %s\n", rootDir, buildDir);
+ if (buildDir && buildDir[0] != '/') {
rc = RPMRC_FAIL;
goto exit;
}
- if (u != NULL) {
- switch (u->urltype) {
- case URL_IS_HTTPS:
- case URL_IS_HTTP:
- case URL_IS_FTP:
-if (_build_debug)
-fprintf(stderr, "*** addMacros\n");
- addMacro(spec->macros, "_remsh", NULL, "%{__remsh}", RMIL_SPEC);
- addMacro(spec->macros, "_remhost", NULL, u->host, RMIL_SPEC);
- if (strcmp(rootDir, "/"))
- addMacro(spec->macros, "_remroot", NULL, rootDir, RMIL_SPEC);
- break;
- case URL_IS_UNKNOWN:
- case URL_IS_DASH:
- case URL_IS_PATH:
- case URL_IS_HKP:
- default:
- break;
- }
- }
- buildCmd = rpmExpand(mCmd, " ", buildScript, NULL);
+ buildCmd = rpmExpand(mCmd, " ", scriptName, NULL);
(void) poptParseArgvString(buildCmd, &argc, &argv);
rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
rpmlog(RPMLOG_ERR, _("Exec of %s failed (%s): %s\n"),
scriptName, name, strerror(errno));
- _exit(-1);
+ _exit(127); /* exit 127 for compatibility with bash(1) */
}
pid = waitpid(child, &status, 0);
(void) unlink(scriptName);
scriptName = _free(scriptName);
}
- if (u != NULL) {
- switch (u->urltype) {
- case URL_IS_HTTPS:
- case URL_IS_HTTP:
- case URL_IS_FTP:
-if (_build_debug)
-fprintf(stderr, "*** delMacros\n");
- delMacro(spec->macros, "_remsh");
- delMacro(spec->macros, "_remhost");
- if (strcmp(rootDir, "/"))
- delMacro(spec->macros, "_remroot");
- break;
- case URL_IS_UNKNOWN:
- case URL_IS_DASH:
- case URL_IS_PATH:
- case URL_IS_HKP:
- default:
- break;
- }
- u = urlFree(u);
- }
argv = _free(argv);
buildCmd = _free(buildCmd);
buildTemplate = _free(buildTemplate);
buildPost = _free(buildPost);
- buildDirURL = _free(buildDirURL);
+ buildDir = _free(buildDir);
return rc;
}