33 for (sp = spec->
sources; sp != NULL; sp = sp->
next) {
38 dn =
"%{_sourcedir}/";
56 const char * rootURL = spec->
rootURL;
58 const char *scriptName = NULL;
59 const char * buildDirURL =
rpmGenPath(rootURL,
"%{_builddir}",
"");
60 const char * buildScript;
61 const char * buildCmd = NULL;
62 const char * buildTemplate = NULL;
63 const char * buildPost = NULL;
64 const char * mTemplate = NULL;
65 const char * mCmd = NULL;
66 const char * mPost = NULL;
68 const char **argv = NULL;
83 mTemplate =
"%{__spec_prep_template}";
84 mPost =
"%{__spec_prep_post}";
85 mCmd =
"%{__spec_prep_cmd}";
90 mTemplate =
"%{__spec_build_template}";
91 mPost =
"%{__spec_build_post}";
92 mCmd =
"%{__spec_build_cmd}";
97 mTemplate =
"%{__spec_install_template}";
98 mPost =
"%{__spec_install_post}";
99 mCmd =
"%{__spec_install_cmd}";
104 mTemplate =
"%{__spec_check_template}";
105 mPost =
"%{__spec_check_post}";
106 mCmd =
"%{__spec_check_cmd}";
111 mTemplate =
"%{__spec_clean_template}";
112 mPost =
"%{__spec_clean_post}";
113 mCmd =
"%{__spec_clean_cmd}";
117 mTemplate =
"%{__spec_clean_template}";
118 mPost =
"%{__spec_clean_post}";
119 mCmd =
"%{__spec_clean_cmd}";
123 mTemplate =
"%{___build_template}";
124 mPost =
"%{___build_post}";
125 mCmd =
"%{___build_cmd}";
147 (void)fchmod(
Fileno(fd), 0600);
156 xfd =
Fdopen(fd,
"w.fpio");
162 if ((fp =
fdGetFp(xfd)) == NULL) {
168 (void)
urlPath(rootURL, &rootDir);
170 if (*rootDir ==
'\0') rootDir =
"/";
173 (void)
urlPath(scriptName, &buildScript);
175 buildTemplate =
rpmExpand(mTemplate, NULL);
178 (void) fputs(buildTemplate, fp);
186 }
else if (sb != NULL)
189 (void) fputs(buildPost, fp);
199 fprintf(stderr,
"*** rootURL %s buildDirURL %s\n", rootURL, buildDirURL);
201 if (buildDirURL && buildDirURL[0] !=
'/' &&
213 fprintf(stderr,
"*** addMacros\n");
216 if (strcmp(rootDir,
"/"))
228 buildCmd =
rpmExpand(mCmd,
" ", buildScript, NULL);
229 (void) poptParseArgvString(buildCmd, &argc, &argv);
232 if (!(child = fork())) {
238 (void) execvp(argv[0], (
char *
const *)argv);
242 scriptName, name, strerror(errno));
247 rc = waitpid(child, &status, 0);
249 if (!WIFEXITED(status) || WEXITSTATUS(status)) {
259 (void)
Unlink(scriptName);
260 scriptName =
_free(scriptName);
268 fprintf(stderr,
"*** delMacros\n");
271 if (strcmp(rootDir,
"/"))
283 buildCmd =
_free(buildCmd);
284 buildTemplate =
_free(buildTemplate);
285 buildPost =
_free(buildPost);
286 buildDirURL =
_free(buildDirURL);
300 for (x = 0; x < spec->
BACount; x++) {
312 (rc =
doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
316 (rc =
doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
320 (rc =
doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
324 (rc =
doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
336 if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
340 if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
345 (rc =
doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
349 (rc =
doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))