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 assert(spec->
dig == NULL);
357 for (x = 0; x < spec->
BACount; x++) {
368 (rc =
doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
372 (rc =
doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
376 (rc =
doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
380 (rc =
doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
384 (rc =
doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
396 if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
400 if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
405 (rc =
doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
409 (rc =
doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
419 #if defined(RPM_VENDOR_OPENPKG)
427 if (what & RPMBUILD_RMSOURCE) {
433 if (what & RPMBUILD_RMSPEC) {
rpmtime_t rpmswExit(rpmop op, ssize_t rc)
Exit timed operation.
const char bson_timestamp_t * ts
static void * fdGetFp(FD_t fd)
rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test)
Post-build processing for binary package(s).
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
int pgpDigSetAlgos(pgpDig dig)
urltype urlType(void *_u)
void addMacro(MacroContext mc, const char *n, const char *o, const char *b, int level)
Add macro to context.
static int pgpImplGenerate(pgpDig dig)
static void rpmlog(int code, const char *fmt,...)
int pgpExportPubkey(pgpDig dig)
const char * getSourceDir(rpmfileAttrs attr)
Return the macro directory location from source file flags.
static void doRmSource(Spec spec)
void delMacro(MacroContext mc, const char *n)
Delete macro from context.
rpmRC packageSources(Spec spec)
Generate source package.
int Rmdir(const char *path)
rmdir(2) clone.
int rpmlogGetNrecs(void)
Return number of messages.
int rpmTempFile(const char *prefix, const char **fnptr, void *fdptr)
Return file handle for a temporaray file.
rpmuint32_t sstates[RPMSCRIPT_MAX]
rpmuint32_t smetrics[RPMSCRIPT_MAX]
The FD_t File Handle data structure.
const char * rpmGenPath(const char *urlroot, const char *urlmdir, const char *urlfile)
Merge 3 args into path, any or all of which may be a url.
Generate and verify rpm package signatures.
int xstrcasecmp(const char *s1, const char *s2)
Locale insensitive strcasecmp(3).
The structure used to store values parsed from a spec file.
int rpmswEnter(rpmop op, ssize_t rc)
Enter timed operation.
const char const bson const bson * op
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
int rpmsqExecve(const char **argv)
SIGCHLD cancellation handler.
int Fclose(FD_t fd)
fclose(3) clone.
Cumulative statistics for an operation.
enum rpmfileAttrs_e rpmfileAttrs
File Attributes.
int processSourceFiles(Spec spec)
Post-build processing for source package.
enum rpmRC_e rpmRC
RPM return codes.
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
int Ferror(FD_t fd)
ferror(3) clone.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
int urlSplit(const char *url, urlinfo *uret)
Parse URL string into a control structure.
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
This is the only module users of librpmbuild should need to include.
rpmRC packageBinaries(Spec spec)
Generate binary package(s).
rpmRC doScript(Spec spec, int what, const char *name, rpmiob iob, int test)
Run a build script, assembled from spec file scriptlet section.
struct rpmts_s * rpmts
The RPM Transaction Set.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
FD_t Fdopen(FD_t ofd, const char *fmode)
void rpmlogPrint(FILE *f)
Print all rpmError() messages.
rpmRC buildSpec(rpmts ts, Spec spec, int what, int test)
Build stages state machine driver.
int Unlink(const char *path)
unlink(2) clone.