10 #define _RPMTAG_INTERNAL
21 #if defined(RPM_VENDOR_OPENPKG)
27 const char * dir = NULL;
28 #if defined(RPM_VENDOR_OPENPKG)
36 fn =
rpmGetPath(
"%{_specdir}/", filename, NULL);
37 if (access(fn,
F_OK) == 0)
45 dir =
"%{_sourcedir}/";
47 dir =
"%{_patchdir}/";
70 for (sp = spec->
sources; sp != NULL; sp = sp->
next) {
74 #if defined(RPM_VENDOR_OPENPKG)
91 const char * rootURL = spec->
rootURL;
93 const char * scriptName = NULL;
94 const char * buildDirURL =
rpmGenPath(rootURL,
"%{_builddir}",
"");
95 const char * buildScript;
96 const char * buildCmd = NULL;
97 const char * buildTemplate = NULL;
98 const char * buildPost = NULL;
99 const char * mTemplate = NULL;
100 const char * mCmd = NULL;
101 const char * mPost = NULL;
103 const char **argv = NULL;
119 mTemplate =
"%{__spec_prep_template}";
120 mPost =
"%{__spec_prep_post}";
121 mCmd =
"%{__spec_prep_cmd}";
126 mTemplate =
"%{__spec_build_template}";
127 mPost =
"%{__spec_build_post}";
128 mCmd =
"%{__spec_build_cmd}";
133 mTemplate =
"%{__spec_install_template}";
134 mPost =
"%{__spec_install_post}";
135 mCmd =
"%{__spec_install_cmd}";
140 mTemplate =
"%{__spec_check_template}";
141 mPost =
"%{__spec_check_post}";
142 mCmd =
"%{__spec_check_cmd}";
147 mTemplate =
"%{__spec_clean_template}";
148 mPost =
"%{__spec_clean_post}";
149 mCmd =
"%{__spec_clean_cmd}";
153 mTemplate =
"%{__spec_clean_template}";
154 mPost =
"%{__spec_clean_post}";
155 mCmd =
"%{__spec_clean_cmd}";
162 for (i = 0; i < spec->
nfoo; i++) {
163 if (spec->
foo[i].str == NULL || spec->
foo[i].iob == NULL)
167 iob = spec->
foo[i].iob;
170 mTemplate =
"%{__spec_track_template}";
171 mPost =
"%{__spec_track_post}";
172 mCmd =
"%{__spec_track_cmd}";
176 mTemplate =
"%{___build_template}";
177 mPost =
"%{___build_post}";
178 mCmd =
"%{___build_cmd}";
196 xfd =
Fdopen(fd,
"w.fpio");
201 if ((fp =
fdGetFp(xfd)) == NULL) {
207 (void)
urlPath(rootURL, &rootDir);
208 if (*rootDir ==
'\0') rootDir =
"/";
210 (void)
urlPath(scriptName, &buildScript);
212 buildTemplate =
rpmExpand(mTemplate, NULL);
215 (void) fputs(buildTemplate, fp);
224 }
else if (iob != NULL)
227 (void) fputs(buildPost, fp);
237 fprintf(stderr,
"*** rootURL %s buildDirURL %s\n", rootURL, buildDirURL);
238 if (buildDirURL && buildDirURL[0] !=
'/' &&
249 fprintf(stderr,
"*** addMacros\n");
252 if (strcmp(rootDir,
"/"))
264 buildCmd =
rpmExpand(mCmd,
" ", buildScript, NULL);
265 (void) poptParseArgvString(buildCmd, &argc, &argv);
269 if (!(child = fork())) {
274 (void) execvp(argv[0], (
char *
const *)argv);
277 scriptName, name, strerror(errno));
282 pid = waitpid(child, &status, 0);
284 if (!WIFEXITED(status) || WEXITSTATUS(status)) {
293 #if defined(RPM_VENDOR_OPENPKG)
302 (void)
Unlink(scriptName);
303 scriptName =
_free(scriptName);
311 fprintf(stderr,
"*** delMacros\n");
314 if (strcmp(rootDir,
"/"))
326 buildCmd =
_free(buildCmd);
327 buildTemplate =
_free(buildTemplate);
328 buildPost =
_free(buildPost);
329 buildDirURL =
_free(buildDirURL);
343 for (x = 0; x < spec->
BACount; x++) {
354 (rc =
doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
358 (rc =
doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
362 (rc =
doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
366 (rc =
doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
370 (rc =
doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
382 if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
386 if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
391 (rc =
doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
395 (rc =
doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
405 #if defined(RPM_VENDOR_OPENPKG)
413 if (what & RPMBUILD_RMSOURCE) {
419 if (what & RPMBUILD_RMSPEC) {