8 #define _RPMBC_INTERNAL
13 #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 op = memset(
alloca(
sizeof(*op)), 0,
sizeof(*op));
121 mTemplate =
"%{__spec_prep_template}";
122 mPost =
"%{__spec_prep_post}";
123 mCmd =
"%{__spec_prep_cmd}";
128 op = memset(
alloca(
sizeof(*op)), 0,
sizeof(*op));
130 mTemplate =
"%{__spec_build_template}";
131 mPost =
"%{__spec_build_post}";
132 mCmd =
"%{__spec_build_cmd}";
137 op = memset(
alloca(
sizeof(*op)), 0,
sizeof(*op));
139 mTemplate =
"%{__spec_install_template}";
140 mPost =
"%{__spec_install_post}";
141 mCmd =
"%{__spec_install_cmd}";
146 op = memset(
alloca(
sizeof(*op)), 0,
sizeof(*op));
148 mTemplate =
"%{__spec_check_template}";
149 mPost =
"%{__spec_check_post}";
150 mCmd =
"%{__spec_check_cmd}";
155 mTemplate =
"%{__spec_clean_template}";
156 mPost =
"%{__spec_clean_post}";
157 mCmd =
"%{__spec_clean_cmd}";
161 mTemplate =
"%{__spec_clean_template}";
162 mPost =
"%{__spec_clean_post}";
163 mCmd =
"%{__spec_clean_cmd}";
170 for (i = 0; i < spec->
nfoo; i++) {
171 if (spec->
foo[i].str == NULL || spec->
foo[i].iob == NULL)
175 iob = spec->
foo[i].iob;
178 mTemplate =
"%{__spec_track_template}";
179 mPost =
"%{__spec_track_post}";
180 mCmd =
"%{__spec_track_cmd}";
184 mTemplate =
"%{___build_template}";
185 mPost =
"%{___build_post}";
186 mCmd =
"%{___build_cmd}";
190 assert(name != NULL);
204 xfd =
Fdopen(fd,
"w.fpio");
209 if ((fp =
fdGetFp(xfd)) == NULL) {
215 (void)
urlPath(rootURL, &rootDir);
216 if (*rootDir ==
'\0') rootDir =
"/";
218 (void)
urlPath(scriptName, &buildScript);
220 buildTemplate =
rpmExpand(mTemplate, NULL);
223 (void) fputs(buildTemplate, fp);
232 }
else if (iob != NULL)
235 (void) fputs(buildPost, fp);
244 if (buildDirURL && buildDirURL[0] !=
'/' &&
256 if (strcmp(rootDir,
"/"))
268 buildCmd =
rpmExpand(mCmd,
" ", buildScript, NULL);
269 (void) poptParseArgvString(buildCmd, &argc, &argv);
283 if (!WIFEXITED(status) || WEXITSTATUS(status)) {
291 static unsigned int scale = 1000;
299 #if defined(RPM_VENDOR_OPENPKG)
308 (void)
Unlink(scriptName);
309 scriptName =
_free(scriptName);
318 if (strcmp(rootDir,
"/"))
331 buildCmd =
_free(buildCmd);
332 buildTemplate =
_free(buildTemplate);
333 buildPost =
_free(buildPost);
334 buildDirURL =
_free(buildDirURL);
343 if (spec->
dig == NULL)
351 for (x = 0; x < spec->
BACount; x++) {
362 (rc =
doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
366 (rc =
doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
370 (rc =
doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
374 (rc =
doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
378 (rc =
doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
390 if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
394 if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
399 (rc =
doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
403 (rc =
doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
413 #if defined(RPM_VENDOR_OPENPKG)
421 if (what & RPMBUILD_RMSOURCE) {
427 if (what & RPMBUILD_RMSPEC) {