11 #define _MIRE_INTERNAL
15 #define _RPMEVR_INTERNAL
18 #define _RPMNS_INTERNAL
21 #define _RPMFC_INTERNAL
24 #define _RPMDS_INTERNAL
56 for (i = 0; i < ac; i++)
58 argv[argc + ac] = NULL;
64 #if defined(HAVE_SIG_T) && !defined(SIGHANDLER_T)
65 typedef sig_t sighandler_t;
80 const char * writePtr,
size_t writeBytesLeft,
89 sighandler_t oldhandler = signal(SIGPIPE, SIG_IGN);
93 toProg[0] = toProg[1] = 0;
94 fromProg[0] = fromProg[1] = 0;
95 if (pipe(toProg) < 0 || pipe(fromProg) < 0) {
100 if (!(child = fork())) {
101 (void) close(toProg[1]);
102 (void) close(fromProg[0]);
104 (void) dup2(toProg[0], STDIN_FILENO);
105 (void) dup2(fromProg[1], STDOUT_FILENO);
107 (void) close(toProg[0]);
108 (void) close(fromProg[1]);
115 argv[0], (
unsigned)getpid());
118 (void) execvp(argv[0], (
char *
const *)argv);
121 argv[0], strerror(
errno));
126 argv[0], strerror(
errno));
130 (void) close(toProg[0]);
131 (void) close(fromProg[1]);
134 (void) fcntl(fromProg[0], F_SETFL, O_NONBLOCK);
135 (void) fcntl(toProg[1], F_SETFL, O_NONBLOCK);
151 if (fromProg[0] >= 0) {
152 FD_SET(fromProg[0], &ibits);
154 if (toProg[1] >= 0) {
155 FD_SET(toProg[1], &obits);
160 nfd = ((fromProg[0] > toProg[1]) ? fromProg[0] : toProg[1]);
161 if ((rc = select(nfd, &ibits, &obits, NULL, &tv)) < 0) {
168 if (toProg[1] >= 0 && FD_ISSET(toProg[1], &obits)) {
169 if (writePtr && writeBytesLeft > 0) {
170 if ((nbw = write(toProg[1], writePtr,
171 ((
size_t)1024<writeBytesLeft) ? (
size_t)1024 : writeBytesLeft)) < 0)
173 if (
errno != EAGAIN) {
174 perror(
"getOutputFrom()");
179 writeBytesLeft -= nbw;
181 }
else if (toProg[1] >= 0) {
182 (void) close(toProg[1]);
188 {
char buf[BUFSIZ+1];
189 while ((nbr = read(fromProg[0], buf,
sizeof(buf)-1)) > 0) {
196 done = (nbr == 0 || (nbr < 0 &&
errno != EAGAIN));
202 (void) close(toProg[1]);
203 if (fromProg[0] >= 0)
204 (void) close(fromProg[0]);
205 (void) signal(SIGPIPE, oldhandler);
208 reaped = waitpid(child, &status, 0);
210 (
unsigned)child, (
unsigned)reaped, status);
212 if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) {
214 int rc = (WIFEXITED(status) ? WEXITSTATUS(status) : -1);
221 if (writeBytesLeft) {
232 const char * s = NULL;
238 const char * buf_stdin = NULL;
239 size_t buf_stdin_len = 0;
254 xx = poptParseArgvString(s, &pac, (
const char ***)&pav);
255 if (!(xx == 0 && pac > 0 && pav != NULL))
264 if (iob_stdin != NULL) {
270 iob =
getOutputFrom(NULL, xav, buf_stdin, buf_stdin_len, failnonzero);
272 if (iob_stdoutp != NULL) {
327 sprintf(buf,
"%08u%c %s %s 0x%08x", (
unsigned)ix, deptype,
348 xx = poptParseArgvString(s, &ac, (
const char ***)&av);
351 if (ac == 0 || av == NULL || *av == NULL) {
356 for (i = 0; i < ac; i++) {
361 _(
"Compilation of pattern '%s'"
362 " (expanded from '%s') failed. Skipping ...\n"),
378 const char *
str,
char deptype)
385 for (i = 0; i < nmire; i++) {
420 const char * fn = fc->fn[fc->ix];
444 xx =
snprintf(buf,
sizeof(buf),
"%%{?__%s_provides}", nsdep);
445 depsp = &fc->provides;
446 dsContext = RPMSENSE_FIND_PROVIDES;
448 mire = (
miRE) fc->Pmires;
454 xx =
snprintf(buf,
sizeof(buf),
"%%{?__%s_requires}", nsdep);
455 depsp = &fc->requires;
456 dsContext = RPMSENSE_FIND_REQUIRES;
458 mire = (
miRE) fc->Rmires;
462 buf[
sizeof(buf)-1] =
'\0';
469 xx =
rpmfcExec(av, iob_stdin, &iob_stdout, 0);
472 if (xx == 0 && iob_stdout != NULL) {
477 for (i = 0; i < pac; i++) {
481 if (pav[i+1] && strchr(
"=<>", *pav[i+1])) {
483 for (s = pav[i]; *s; s++) {
502 rpmlog(
RPMLOG_ERR,
_(
"%s helper returned empty version info for %s, omitting\n"), nsdep, N);
511 if (!fc->tracked && deptype ==
'P' && *EVR !=
'\0') {
515 "rpmlib(VersionedDependencies)",
"3.0.3-1",
525 #if defined(RPM_VENDOR_MANDRIVA)
541 (*depsp)->EVR[(*depsp)->i] = EVR;
542 (*depsp)->Flags[(*depsp)->i] = Flags;
685 for (fct = rpmfcTokens; fct->token != NULL; fct++) {
686 if (strstr(fmstr, fct->token) == NULL)
688 fcolor |= fct->colors;
706 if (fp == NULL) fp = stderr;
709 fprintf(fp,
"===================================== %s\n", msg);
715 for (fx = 0; fx < fc->nfiles; fx++) {
716 assert(fx < fc->fcdictx->nvals);
717 cx = fc->fcdictx->vals[fx];
718 assert(fx < fc->fcolor->nvals);
719 fcolor = fc->fcolor->vals[fx];
721 fprintf(fp,
"%3d %s", (
int)fx, fc->fn[fx]);
723 fprintf(fp,
"\t0x%x", fc->fcolor->vals[fx]);
725 fprintf(fp,
"\t%s", fc->cdict[cx]);
728 if (fc->fddictx == NULL || fc->fddictn == NULL)
731 assert(fx < fc->fddictx->nvals);
732 dx = fc->fddictx->vals[fx];
733 assert(fx < fc->fddictn->nvals);
734 ndx = fc->fddictn->vals[fx];
738 unsigned char deptype;
741 ix = fc->ddictx->vals[dx++];
742 deptype = ((ix >> 24) & 0xff);
747 assert(depval != NULL);
751 assert(ix < nprovides);
759 assert(ix < nrequires);
767 fprintf(fp,
"\t%s\n", depval);
781 const char * fn = fc->fn[fc->ix];
793 const char * defaultdocdir =
rpmExpand(
"%{?_defaultdocdir}", NULL);
794 if (defaultdocdir == NULL || *defaultdocdir ==
'\0')
795 defaultdocdir = strdup(
"/usr/share/doc");
796 xx = !strncmp(fn+fc->brlen, defaultdocdir, strlen(defaultdocdir));
797 defaultdocdir =
_free(defaultdocdir) ;
803 {
struct stat sb, * st = &sb;
804 if (stat(fn, st) != 0)
806 is_executable = (int)(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
810 if (fp == NULL || ferror(fp)) {
811 if (fp) (void) fclose(fp);
816 for (i = 0; i < 10; i++) {
818 s = fgets(buf,
sizeof(buf) - 1, fp);
819 if (s == NULL || ferror(fp) || feof(fp))
821 s[
sizeof(buf)-1] =
'\0';
822 if (!(s[0] ==
'#' && s[1] ==
'!'))
826 while (*s && strchr(
" \t\n\r", *s) != NULL)
833 for (se = s+1; *se; se++) {
834 if (strchr(
" \t\n\r", *se) != NULL)
860 if (!strcmp(bn,
"perl"))
862 else if (!strncmp(bn,
"python",
sizeof(
"python")-1))
864 else if (!strncmp(bn,
"php",
sizeof(
"php")-1))
866 else if (!strncmp(bn,
"ruby",
sizeof(
"ruby")-1))
877 if (is_executable || (fc->fcolor->vals[fc->ix] &
RPMFC_MODULE))
908 if (fc->fcolor->vals[fc->ix] &
RPMFC_PHP) {
942 strstr(fn,
"/gstreamer")) {
946 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
950 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
951 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0) {
987 fprintf(stderr,
"*** rpmfcMergePR(%p, %p) %s\n", context, ds,
tagName(
rpmdsTagN(ds)));
1031 const char * fn = fc->fn[fc->ix];
1042 #if defined(RPM_VENDOR_MANDRIVA)
1052 extern int rpmdsSymlink(
const char * fn,
int flags,
1053 int (*add) (
void * context,
rpmds ds),
void * context)
1057 static int rpmfcSYMLINK(
rpmfc fc)
1061 const char * fn = fc->fn[fc->ix];
1086 #
if defined(RPM_VENDOR_MANDRIVA)
1103 unsigned char deptype;
1114 int skipProv = fc->skipProv;
1115 int skipReq = fc->skipReq;
1118 if (_filter_execs) {
1121 if (fc->PFnmire > 0)
1126 if (fc->RFnmire > 0)
1142 assert(fc->fn != NULL);
1144 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
1148 { fn = strstr(fc->fn[fc->ix],
"/usr/lib");
1150 fn +=
sizeof(
"/usr/lib")-1;
1151 if ((fn[0] ==
'3' && fn[1] ==
'2') ||
1152 (fn[0] ==
'6' && fn[1] ==
'4'))
1154 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1))
1156 else if (!strncmp(fn,
"/ruby",
sizeof(
"/ruby")-1)) {
1158 if ((strstr(fn,
".gemspec") || strstr(fn,
"rbconfig.rb"))) {
1160 if (!
mireRegcomp(mire,
".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
1161 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1167 else if (!strncmp(fn,
"/gstreamer",
sizeof(
"/gstreamer")-1) &&
1170 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
1173 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
1174 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1179 fn = strstr(fc->fn[fc->ix],
"/usr/share");
1181 fn +=
sizeof(
"/usr/share")-1;
1182 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1))
1184 else if (!strncmp(fn,
"/ruby",
sizeof(
"/ruby")-1)) {
1186 if ((strstr(fn,
".gemspec") || strstr(fn,
"rbconfig.rb"))) {
1188 if (!
mireRegcomp(mire,
".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
1189 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1198 { fn = strstr(fc->fn[fc->ix],
"/usr/share/haskell-deps");
1203 if (fc->fcolor->vals[fc->ix])
1204 for (fcat = rpmfcApplyTable; fcat->
func != NULL; fcat++) {
1205 if (!(fc->fcolor->vals[fc->ix] & fcat->
colormask))
1208 if (_filter_execs) {
1209 fc->skipProv = skipProv;
1210 fc->skipReq = skipReq;
1211 if ((mire = (
miRE)fc->PFmires) != NULL)
1212 for (j = 0; j < fc->PFnmire; j++, mire++) {
1213 fn = fc->fn[fc->ix] + fc->brlen;
1221 if ((mire = (
miRE)fc->RFmires) != NULL)
1222 for (j = 0; j < fc->RFnmire; j++, mire++) {
1223 fn = fc->fn[fc->ix] + fc->brlen;
1233 struct stat sb, * st = &sb;
1234 if (stat(fc->fn[fc->ix], st) == 0 && !(st->st_mode & (S_IFBLK|S_IFCHR)))
1235 xx = (*fcat->
func) (fc);
1239 if (_filter_execs) {
1245 fc->skipProv = skipProv;
1246 fc->skipReq = skipReq;
1251 for (i = 0; i < nddict; i++) {
1255 ix = strtol(s, &se, 10);
1260 while (*se && *se !=
' ')
1264 while (*se && *se !=
' ')
1267 Flags = (
evrFlags) strtol(se, NULL, 16);
1275 skipping = fc->skipProv;
1282 skipping = fc->skipReq;
1298 val = (deptype << 24) | (dix & 0x00ffffff);
1299 xx =
argiAdd(&fc->ddictx, -1, val);
1305 if (fc->fddictn && fc->fddictn->vals && !skipping)
1306 fc->fddictn->vals[ix]++;
1317 const char * s, * se;
1321 const char * magicfile = NULL;
1323 if (fc == NULL || argv == NULL)
1326 magicfile =
rpmExpand(
"%{?_rpmfc_magic_path}", NULL);
1327 if (magicfile == NULL || *magicfile ==
'\0')
1328 magicfile =
_free(magicfile);
1336 xx =
argiAdd(&fc->fddictx, fc->nfiles-1, 0);
1337 xx =
argiAdd(&fc->fddictn, fc->nfiles-1, 0);
1341 xx =
argvAdd(&fc->cdict,
"directory");
1343 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1349 ftype =
""; freeftype = 0;
1350 urltype =
urlPath(argv[fc->ix], &s);
1351 assert(s != NULL && *s ==
'/');
1354 switch (mode & S_IFMT) {
1355 case S_IFCHR: ftype =
"character special";
break;
1356 case S_IFBLK: ftype =
"block special";
break;
1357 #if defined(S_IFIFO)
1358 case S_IFIFO: ftype =
"fifo (named pipe)";
break;
1360 #if defined(S_IFSOCK)
1362 case S_IFSOCK: ftype =
"socket";
break;
1370 #define _suffix(_s, _x) \
1371 (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))
1375 ftype =
"Perl5 module source text";
1379 ftype =
"Java archive file";
1382 else if (
_suffix(s,
".class"))
1383 ftype =
"Java class file";
1387 ftype =
"libtool library file";
1391 ftype =
"pkgconfig file";
1395 ftype =
"PHP script text";
1397 else if (
_suffix(s,
".desktop"))
1398 ftype =
"Desktop Entry";
1401 else if (
_suffix(s,
".typelib"))
1402 ftype =
"G-IR binary database";
1406 ftype =
"G-IR binary database";
1409 else if (slen >= fc->brlen+
sizeof(
"/dev/") && !strncmp(s+fc->brlen,
"/dev/",
sizeof(
"/dev/")-1))
1411 else if (magicfile) {
1413 assert(ftype != NULL);
1432 xx =
argiAdd(&fc->fcolor, (
int)fc->ix, fcolor);
1439 ftype =
_free(ftype);
1445 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1451 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, (dav - fc->cdict));
1454 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, 0);
1463 D_(
"categorized %d files into %u classes (using %s).\n"),
1464 (
unsigned)fc->nfiles,
argvCount(fc->cdict), magicfile);
1465 magicfile =
_free(magicfile);
1493 {
"Provides", {
"%{?__find_provides}", NULL, NULL, NULL },
1496 {
"Requires(interp)", { NULL,
"interp", NULL, NULL },
1498 _notpre(RPMSENSE_INTERP), 0 },
1499 {
"Requires(rpmlib)", { NULL,
"rpmlib", NULL, NULL },
1501 _notpre(RPMSENSE_RPMLIB), 0 },
1502 {
"Requires(verify)", { NULL,
"verify", NULL, NULL },
1504 RPMSENSE_SCRIPT_VERIFY, 0 },
1505 {
"Requires(pre)", { NULL,
"pre", NULL, NULL },
1507 _notpre(RPMSENSE_SCRIPT_PRE), 0 },
1508 {
"Requires(post)", { NULL,
"post", NULL, NULL },
1510 _notpre(RPMSENSE_SCRIPT_POST), 0 },
1511 {
"Requires(preun)", { NULL,
"preun", NULL, NULL },
1513 _notpre(RPMSENSE_SCRIPT_PREUN), 0 },
1514 {
"Requires(postun)", { NULL,
"postun", NULL, NULL },
1516 _notpre(RPMSENSE_SCRIPT_POSTUN), 0 },
1517 {
"Requires", {
"%{?__find_requires}", NULL, NULL, NULL },
1519 RPMSENSE_FIND_REQUIRES|RPMSENSE_TRIGGERIN|RPMSENSE_TRIGGERUN|RPMSENSE_TRIGGERPOSTUN|RPMSENSE_TRIGGERPREIN, 0 },
1520 {
"Conflicts", {
"%{?__find_conflicts}", NULL, NULL, NULL },
1523 {
"Obsoletes", {
"%{?__find_obsoletes}", NULL, NULL, NULL },
1548 for (dm = DepMsgs; dm->
msg != NULL; dm++) {
1549 if ((
int)dm->
ntag != -1) {
1592 int failnonzero = 0;
1604 for (dm = DepMsgs; dm->
msg != NULL; dm++) {
1619 tagflags = RPMSENSE_FIND_PROVIDES;
1625 tagflags = RPMSENSE_FIND_REQUIRES;
1632 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1641 if (iob_stdout == NULL) {
1669 {
"Requires(pre)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1671 RPMSENSE_SCRIPT_PRE, 0 },
1672 {
"Requires(post)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1674 RPMSENSE_SCRIPT_POST, 0 },
1675 {
"Requires(preun)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1677 RPMSENSE_SCRIPT_PREUN, 0 },
1678 {
"Requires(postun)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1680 RPMSENSE_SCRIPT_POSTUN, 0 },
1696 rpmiob iob_stdout = NULL;
1698 int failnonzero = 0;
1702 for (dm = ScriptMsgs; dm->
msg != NULL; dm++) {
1713 if (!xx || he->
p.
str == NULL)
1715 xx = strcmp(he->
p.
str,
"/bin/sh") && strcmp(he->
p.
str,
"/bin/bash");
1723 if (!xx || he->
p.
str == NULL)
1730 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1736 if (s != NULL && *s !=
'\0') {
1739 while ((se = strstr(se,
"executable(/")) != NULL) {
1744 se = strchr(se,
')');
1750 rc = spec->
_parseRCPOT(spec, pkg, s, tag, 0, tagflags);
1762 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1764 unsigned i, rnum, removed = 0;
1765 const char **deps = NULL;
1766 const char **versions = NULL;
1768 int *newpos = NULL, *ddictxPos = NULL;
1777 versions = he->
p.
argv;
1783 if (fc && fc->requires != NULL && fc->ddictx != NULL) {
1784 newpos =
alloca(he->
c*
sizeof(newpos[0]));
1786 ddictxPos =
alloca(fc->ddictx->nvals*
sizeof(ddictxPos[0]));
1788 for (i = 0; i < rnum-removed; i++) {
1790 deps[
i] = deps[i+removed];
1791 versions[
i] = versions[i+removed];
1792 flags[
i] = flags[i+removed];
1794 fc->requires->N[
i] = fc->requires->N[i+removed];
1795 fc->requires->EVR[
i] = fc->requires->EVR[i+removed];
1796 fc->requires->Flags[
i] = fc->requires->Flags[i+removed];
1799 if (fc && fc->requires != NULL && fc->ddictx != NULL)
1800 newpos[i+removed] =
i;
1804 if (flags[i] & RPMSENSE_SCRIPT_PRE)
1807 if (fc && fc->requires != NULL && fc->ddictx != NULL)
1808 newpos[i+removed] = -1;
1817 if (fc && fc->requires != NULL && fc->ddictx != NULL && removed) {
1818 fc->requires->Count -= removed;
1820 for (i = 0; i < fc->ddictx->nvals-rx; i++) {
1822 unsigned char deptype;
1824 ix = fc->ddictx->vals[i+rx];
1825 deptype = ((ix >> 24) & 0xff);
1828 if (deptype ==
'P') {
1829 ddictxPos[i+rx] =
i;
1830 fc->ddictx->vals[
i] = fc->ddictx->vals[i+rx];
1833 if (newpos[ix] == -1) {
1834 ddictxPos[i+rx] = -1;
1839 ddictxPos[i+rx] =
i;
1840 fc->ddictx->vals[
i] = (deptype << 24) | (newpos[ix] & 0x00ffffff);
1843 fc->ddictx->nvals -= rx;
1845 for (i = 0; i < fc->fddictn->nvals; i++) {
1847 if (fc->fddictn->vals[i]) {
1848 unsigned j, ix = fc->fddictx->vals[
i];
1849 for (j = 0, rx = 0; j < fc->fddictn->vals[
i]; j++, ix++) {
1850 if (ddictxPos[ix] == -1)
1852 if (j == 0 || fc->fddictx->vals[i] == -1)
1853 fc->fddictx->vals[
i] = ddictxPos[ix];
1857 fc->fddictn->vals[
i] -= rx;
1858 if (fc->fddictn->vals[i] == 0)
1859 fc->fddictx->vals[
i] = 0;
1871 he->
p.
argv = versions;
1876 he->
p.
ui32p = (uint32_t*)flags;
1898 int genConfigDeps, internaldeps;
1913 if (internaldeps == 0) {
1922 if (internaldeps > 1)
1950 {
const char * buildRootURL;
1951 const char * buildRoot;
1953 (void)
urlPath(buildRootURL, &buildRoot);
1954 if (buildRoot && !strcmp(buildRoot,
"/")) buildRoot = NULL;
1955 fc->brlen = (buildRoot ? strlen(buildRoot) : 0);
1956 buildRootURL =
_free(buildRootURL);
1960 if (!fc->skipProv) {
1973 if (genConfigDeps) {
1978 assert(EVR != NULL);
1979 sprintf(buf,
"config(%s)", N);
2000 if (genConfigDeps) {
2005 assert(EVR != NULL);
2006 sprintf(buf,
"config(%s)", N);
2025 assert(ac == (
int)he->
c);
2026 if (he->
p.
ptr != NULL && he->
c > 0) {
2030 for (i = 0; i < (int)he->
c; i++)
2041 if (he->
p.
ptr != NULL && he->
c > 0) {
2050 assert(ac == (
int)he->
c);
2051 if (he->
p.
ptr != NULL && he->
c > 0) {
2056 if (fc->provides != NULL && (he->
c =
rpmdsCount(fc->provides)) > 0
2061 he->
p.
argv = fc->provides->N;
2068 he->
p.
argv = fc->provides->EVR;
2069 assert(he->
p.
ptr != NULL);
2075 assert(he->
p.
ptr != NULL);
2081 if (fc->requires != NULL && (he->
c =
rpmdsCount(fc->requires)) > 0
2086 he->
p.
argv = fc->requires->N;
2087 assert(he->
p.
ptr != NULL);
2094 he->
p.
argv = fc->requires->EVR;
2095 assert(he->
p.
ptr != NULL);
2101 assert(he->
p.
ptr != NULL);
2113 if (he->
p.
ptr != NULL) {
2122 assert(ac == (
int)he->
c);
2123 if (he->
p.
ptr != NULL) {
2131 assert(ac == (
int)he->
c);
2132 if (he->
p.
ptr != NULL) {
2140 sprintf(msg,
"final: files %u cdict[%d] %u%% ddictx[%d]", (
unsigned int)fc->nfiles,
argvCount(fc->cdict), (
unsigned int)((100 * fc->fknown)/fc->nfiles),
argiCount(fc->ddictx));
2145 fmode =
_free(fmode);
2160 fc->fcdictx =
argiFree(fc->fcdictx);
2161 fc->fddictx =
argiFree(fc->fddictx);
2162 fc->fddictn =
argiFree(fc->fddictn);
2168 fc->provides = NULL;
2170 fc->requires = NULL;
2188 if (_rpmfcPool == NULL) {
2194 memset(((
char *)fc)+
sizeof(fc->_item), 0,
sizeof(*fc)-
sizeof(fc->_item));
rpmuint32_t rpmfiFFlags(rpmfi fi)
Return current file flags from file info set.
rpmds rpmdsSingle(rpmTag tagN, const char *N, const char *EVR, evrFlags Flags)
Create, load and initialize a dependency set of size 1.
evrFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
rpmiob rpmiobRTrim(rpmiob iob)
Trim trailing white space.
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
miRE mireNew(rpmMireMode mode, int tag)
Create pattern container.
const char * rpmmgFile(rpmmg mg, const char *fn)
Return magic string for a file.
static struct rpmfcApplyTbl_s rpmfcApplyTable[]
XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication.
#define RPMELF_FLAG_SKIPREQUIRES
static DepMsg_t ScriptMsgs
ARGI_t argiFree(ARGI_t argi)
Destroy an argi array.
void * mireFreeAll(miRE mire, int nmire)
Destroy compiled patterns.
enum urltype_e urltype
Supported URL types.
static void rpmfcFini(void *_fc)
static int rpmfcMatchRegexps(void *_mire, int nmire, const char *str, char deptype)
const char const char * cmd
struct DepMsg_s * DepMsg_t
static void printDeps(Header h)
Print dependencies in a header.
char * xstrdup(const char *str)
size_t rpmiobLen(rpmiob iob)
Return I/O buffer len.
static int rpmfcExpandAppend(ARGV_t *argvp, const ARGV_t av)
Structure(s) used for file info tag sets.
int mireRegcomp(miRE mire, const char *pattern)
Compile pattern match.
int argvAppend(ARGV_t *argvp, ARGV_t av)
Append one argv array to another.
Structure(s) and routine(s) used for classifying and parsing names.
static int rpmfcELF(rpmfc fc)
Extract Elf dependencies.
rpmTag rpmdsTagN(const rpmds ds)
Return current dependency type.
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
unsigned short rpmuint16_t
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
int rpmEVRparse(const char *evrstr, EVR_t evr)
Split EVR string into epoch, version, and release components.
static void rpmlog(int code, const char *fmt,...)
rpmRC rpmfcApply(rpmfc fc)
Build file/package dependency dictionary and mappings.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
static int rpmfcSaveArg(ARGV_t *argvp, const char *key)
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
static rpmiob getOutputFrom(const char *dir, ARGV_t argv, const char *writePtr, size_t writeBytesLeft, int failNonZero)
Return output from helper script.
int argiCount(ARGI_t argi)
Return no.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
int rpmEVRcompare(const EVR_t a, const EVR_t b)
Compare EVR containers for equality.
char * argvJoin(ARGV_t argv, char sep)
Concatenate an argv array into a string.
enum evrFlags_e evrFlags
Dependency Attributes.
Yet Another syslog(3) API clone.
static struct rpmfcTokens_s rpmfcTokens[]
static rpmfc rpmfcGetPool(rpmioPool pool)
miRE mireFree(miRE mire)
Free pattern container.
void * xcalloc(size_t nmemb, size_t size)
rpmfc rpmfcLink(rpmfc fc)
Reference a file classifier instance.
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
rpmfc rpmfcFree(rpmfc fc)
Destroy a file classifier.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
int argvCount(const ARGV_t argv)
Return no.
rpmuint16_t rpmfiFMode(rpmfi fi)
Return current file mode from file info set.
ARGV_t argvData(ARGV_t argv)
Return data from argv array.
int rpmdsFind(rpmds ds, const rpmds ods)
Find a dependency set element using binary search.
enum evrFlags_e rpmsenseFlags
static int rpmfcMergePR(void *context, rpmds ds)
Merge provides/requires dependencies into a rpmfc container.
static unsigned removeSillyDeps(Header h, rpmfc fc)
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
int rpmfcExec(ARGV_t av, rpmiob iob_stdin, rpmiob *iob_stdoutp, int failnonzero)
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
const char * tagName(rpmTag tag)
Return tag name from value.
static int _filter_values
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
Structure(s) used for dependency tag sets.
static const char * ftype(unsigned type)
rpmRC(* _parseRCPOT)(Spec spec, Package pkg, const char *field, rpmTag tagN, rpmuint32_t index, rpmsenseFlags tagflags)
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.
int argvAdd(ARGV_t *argvp, ARGstr_t val)
Add a string to an argv array.
int mireRegexec(miRE mire, const char *val, size_t vallen)
Execute pattern match.
rpmmg rpmmgNew(const char *fn, int flags)
Create and load a magic wrapper.
The structure used to store values parsed from a spec file.
static char * rpmfcFileDep(char *buf, size_t ix, rpmds ds)
struct rpmfcApplyTbl_s * rpmfcApplyTbl
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
static struct DepMsg_s scriptMsgs[]
int Chdir(const char *path)
chdir(2) clone.
int rpmdsCount(const rpmds ds)
Return dependency set count.
void rpmfcPrint(const char *msg, rpmfc fc, FILE *fp)
Print results of file classification.
struct Package_s * Package
void unsetenv(const char *name)
static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char *nsdep)
Run per-interpreter dependency helper.
static struct DepMsg_s depMsgs[]
const char * rpmdsN(const rpmds ds)
Return current dependency name.
static int rpmfcSCRIPT(rpmfc fc)
Extract script dependencies.
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
const char const bson int mongo_write_concern int flags
enum rpmfileAttrs_e rpmfileAttrs
File Attributes.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
EVR_t rpmEVRnew(uint32_t Flags, int initialize)
Create a new EVR container.
enum rpmRC_e rpmRC
RPM return codes.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
EVR_t rpmEVRfree(EVR_t evr)
Destroy an EVR container.
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
int rpmfcColoring(const char *fmstr)
Return file color given file(1) string.
static int snprintf(char *buf, int nb, const char *fmt,...)
const char const bson * key
This is the only module users of librpmbuild should need to include.
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpmuint16_t *fmode)
int rpmdsMerge(rpmds *dsp, rpmds ods)
Merge a dependency set maintaining (N,EVR,Flags) sorted order.
char * stpcpy(char *dest, const char *src)
static rpmRC rpmfcGenerateDependsHelper(const Spec spec, Package pkg, rpmfi fi)
static int rpmfcGenerateScriptletDeps(const Spec spec, Package pkg)
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int argiAdd(ARGI_t *argip, int ix, int val)
Add an int to an argi array.
int rpmdsSearch(rpmds ds, rpmds ods)
Search a sorted dependency set for an element that overlaps.
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
ARGV_t argvSearch(ARGV_t argv, ARGstr_t val, int(*compar)(ARGstr_t *, ARGstr_t *))
Find an element in an argv array.
rpmiob rpmiobEmpty(rpmiob iob)
Empty an I/O buffer.
int rpmdsMatch(const rpmds A, rpmds B)
Compare A against every member of B, looking for 1st match.
struct rpmfcTokens_s * rpmfcToken
static void * rpmfcFreeRegexps(void *_mire, int nmire)
int argvSort(ARGV_t argv, int(*compar)(ARGstr_t *, ARGstr_t *))
Sort an argv array.
int rpmdsELF(const char *fn, int flags, int(*add)(void *context, rpmds ds), void *context)
Return a soname dependency constructed from an elf string.
int mireAppend(rpmMireMode mode, int tag, const char *pattern, const unsigned char *table, miRE *mirep, int *nmirep)
Append pattern to array.
The structure used to store values for a package.
#define RPMELF_FLAG_SKIPPROVIDES
rpmRC rpmfcGenerateDepends(void *_spec, void *_pkg)
Generate package dependencies.
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
Create and load a dependency set.
int rpmdsSetIx(rpmds ds, int ix)
Set dependency set index.
ARGint_t argiData(ARGI_t argi)
Return data from argi array.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmmg rpmmgFree(rpmmg mg)
Destroy a magic wrapper.
rpmfc rpmfcNew(void)
Create a file classifier.
static void * rpmfcExpandRegexps(const char *str, int *nmirep)