70 fd =
Fopen(specfile,
"r");
71 if (fd == NULL ||
Ferror(fd)) {
76 count =
Fread(buf,
sizeof(buf[0]),
sizeof(buf), fd);
80 for (s = buf; count--; s++) {
91 if (checking && !(isprint(*s) || isspace(*s)))
return 0;
107 const char * cookie = ba->
cookie;
109 const char * specFile = NULL;
110 const char * specURL = NULL;
114 size_t nb = strlen(arg) + BUFSIZ;
122 static const char * sfpats[] = {
"Specfile",
"\\*.spec", NULL };
123 static const char _specfn[] =
"%{mkstemp:%{_specdir}/rpm-spec.XXXXXX}";
124 char * tmpSpecFile = (
char *)
rpmGetPath(_specfn, NULL);
129 for (i = 0; sfpats[i]; i++) {
130 se =
rpmExpand(
"%{uncompress: %{u2p:", arg,
"}}",
131 " | %{__tar} -xOvf - %{?__tar_wildcards} ", sfpats[i],
132 " 2>&1 > '", tmpSpecFile,
"'", NULL);
137 s = fgets(buf, nb - 1, fp);
139 if (!s || !*s || strstr(s,
": Not found in archive"))
147 tmpSpecFile =
_free(tmpSpecFile);
151 s = se = basename(buf);
153 while (--se > s && strchr(
"\r\n", *se) != NULL)
155 specURL =
rpmGetPath(
"%{_specdir}/", s, NULL);
156 specut =
urlPath(specURL, &specFile);
157 xx =
Rename(tmpSpecFile, specFile);
161 (void)
Unlink(tmpSpecFile);
163 tmpSpecFile =
_free(tmpSpecFile);
167 se = buf; *se =
'\0';
168 se =
stpcpy(se,
"_sourcedir ");
171 if (getcwd(se, nb -
sizeof(
"_sourcedir ")) != NULL)
176 se =
stpcpy(se, dirname(strcpy(se, s)));
177 while (se > buf && se[-1] ==
'/')
183 se = buf; *se =
'\0';
185 if (getcwd(se, nb -
sizeof(
"_sourcedir ")) != NULL)
190 se += strlen(strcpy(se,strcpy(se, s)));
194 specut =
urlPath(specURL, &specFile);
199 if (
Stat(specURL, &sb) < 0) {
204 if (! S_ISREG(sb.st_mode)) {
214 _(
"File %s does not appear to be a specfile.\n"), specURL);
221 #define _anyarch(_f) \
222 (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
224 cookie,
_anyarch(buildAmount), 0, verify))
255 specURL =
_free(specURL);
266 #define buildCleanMask (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)
280 if (targets == NULL) {
288 printf(
_(
"Building target platforms: %s\n"), targets);
291 for (t = targets; *t !=
'\0'; t = te) {
293 if ((te = strchr(t,
',')) == NULL)
296 strncpy(target, t, (te-t));
321 if ((te = strchr(t,
',')) == NULL)
324 strncpy(target, t, (te-t));