33 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG)) 35 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG)) 36 #define VSF_SET(_vsflags, _FLAG) \ 37 (*((unsigned *)&(_vsflags)) |= (RPMVSF_##_FLAG)) 38 #define VSF_CLR(_vsflags, _FLAG) \ 39 (*((unsigned *)&(_vsflags)) &= ~(RPMVSF_##_FLAG)) 43 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG)) 45 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG)) 46 #define VSF_SET(_vsflags, _FLAG) (_vsflags) |= (RPMVSF_##_FLAG) 47 #define VSF_CLR(_vsflags, _FLAG) (_vsflags) &= ~(RPMVSF_##_FLAG) 90 fd =
Fopen(specfile,
"r");
91 if (fd == NULL ||
Ferror(fd)) {
96 count =
Fread(buf,
sizeof(buf[0]),
sizeof(buf), fd);
100 for (s = buf; count--; s++) {
111 if (checking && !(isprint(*s) || isspace(*s)))
return 0;
127 const char * cookie = ba->
cookie;
129 const char * specFile = NULL;
130 const char * specURL = NULL;
135 size_t nb = strlen(arg) + BUFSIZ;
136 char * buf = (
char *)
alloca(nb);
143 static const char * sfpats[] = {
"Specfile",
"\\*.spec", NULL };
144 static const char _specfn[] =
"%{mkstemp:%{_specdir}/rpm-spec.XXXXXX}";
145 char * tmpSpecFile = (
char *)
rpmGetPath(_specfn, NULL);
150 for (i = 0; sfpats[i]; i++) {
151 se =
rpmExpand(
"%{uncompress: %{u2p:", arg,
"}}",
152 " | %{__tar} -xOvf - %{?__tar_wildcards} ", sfpats[i],
153 " 2>&1 > '", tmpSpecFile,
"'", NULL);
158 s = fgets(buf, nb - 1, fp);
160 if (!s || !*s || strstr(s,
": Not found in archive"))
168 tmpSpecFile =
_free(tmpSpecFile);
172 s = se = basename(buf);
174 while (--se > s && strchr(
"\r\n", *se) != NULL)
176 specURL =
rpmGetPath(
"%{_specdir}/", s, NULL);
177 specut =
urlPath(specURL, &specFile);
178 xx =
Rename(tmpSpecFile, specFile);
182 (void)
Unlink(tmpSpecFile);
184 tmpSpecFile =
_free(tmpSpecFile);
188 se = buf; *se =
'\0';
189 se =
stpcpy(se,
"_sourcedir ");
192 if (getcwd(se, nb -
sizeof(
"_sourcedir ")) != NULL)
197 se =
stpcpy(se, dirname(strcpy(se, s)));
198 while (se > buf && se[-1] ==
'/')
204 se = buf; *se =
'\0';
206 if (getcwd(se, nb -
sizeof(
"_sourcedir ")) != NULL)
211 se += strlen(strcpy(se,strcpy(se, s)));
215 specut =
urlPath(specURL, &specFile);
220 if (
Stat(specURL, &sb) < 0) {
225 if (! S_ISREG(sb.st_mode)) {
235 _(
"File %s does not appear to be a specfile.\n"), specURL);
242 #define _anyarch(_f) \ 243 (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0) 245 cookie,
_anyarch(buildAmount), 0, verify))
276 specURL =
_free(specURL);
287 #define buildCleanMask (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC) 294 #if defined(SUPPORT_NOSIGNATURES) 296 VSF_SET(vsflags, NOSHA1HEADER);
314 if (targets == NULL) {
322 printf(
_(
"Building target platforms: %s\n"), targets);
325 for (t = targets; *t !=
'\0'; t = te) {
327 if ((te = strchr(t,
',')) == NULL)
329 target = (
char *)
alloca(te-t+1);
330 strncpy(target, t, (te-t));
355 if ((te = strchr(t,
',')) == NULL)
357 target = (
char *)
alloca(te-t+1);
358 strncpy(target, t, (te-t));
void rpmFreeMacros(MacroContext mc)
Destroy macro context.
int build(rpmts ts, BTA_t ba, const char *rcfile)
static int buildForTarget(rpmts ts, BTA_t ba)
#define QVA_ISSET(_qvaflags, _FLAG)
Structures used for an "rpmte" transaction element.
char * rpmCleanPath(char *path)
Canonicalize file path.
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation relocs)
Add package to be installed to transaction set.
int rpmReadConfigFiles(const char *file, const char *target)
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
int Stat(const char *path, struct stat *st)
stat(2) clone.
static rpmVSFlags vsflags
static void rpmlog(int code, const char *fmt,...)
int parseSpec(rpmts ts, const char *specFile, const char *rootURL, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force, int verify)
Parse spec file into spec control structure.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
Structures and prototypes used for an "rpmps" problem set.
int rpmcliInstallProblems(rpmts ts, const char *msg, int rc)
Report package problems (if any).
int Rename(const char *oldpath, const char *newpath)
rename(2) clone.
int(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
int rpmDefineMacro(MacroContext mc, const char *macro, int level)
Define macro in context.
const char * rpmcliTargets
The FD_t File Handle data structure.
The structure used to store values parsed from a spec file.
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
Spec freeSpec(Spec spec)
Destroy a spec file control structure.
size_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd)
fread(3) clone.
int Fclose(FD_t fd)
fclose(3) clone.
#define VSF_SET(_vsflags, _FLAG)
Spec rpmtsSetSpec(rpmts ts, Spec spec)
Set a spec control structure in transaction set.
static int checkSpec(rpmts ts, Header h)
int Ferror(FD_t fd)
ferror(3) clone.
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.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
char * stpcpy(char *dest, const char *src)
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.
Structures and prototypes used for an "rpmts" transaction set.
static int isSpecFile(const char *specfile)
int initSourceHeader(Spec spec, rpmiob *sfp)
Create and initialize header for source package.
Describe build command line request.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmRC buildSpec(rpmts ts, Spec spec, int what, int test)
Build stages state machine driver.
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
#define VSF_CLR(_vsflags, _FLAG)
int Unlink(const char *path)
unlink(2) clone.