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;
684 for (fct = rpmfcTokens; fct->token != NULL; fct++) {
685 if (strstr(fmstr, fct->token) == NULL)
688 if ((fct->colors &
RPMFC_ELF32) && (strstr(fmstr,
"x86-64") != NULL))
691 fcolor |= fct->colors;
709 if (fp == NULL) fp = stderr;
712 fprintf(fp,
"===================================== %s\n", msg);
718 for (fx = 0; fx < fc->nfiles; fx++) {
719 assert(fx < fc->fcdictx->nvals);
720 cx = fc->fcdictx->vals[fx];
721 assert(fx < fc->fcolor->nvals);
722 fcolor = fc->fcolor->vals[fx];
724 fprintf(fp,
"%3d %s", (
int)fx, fc->fn[fx]);
726 fprintf(fp,
"\t0x%x", fc->fcolor->vals[fx]);
728 fprintf(fp,
"\t%s", fc->cdict[cx]);
731 if (fc->fddictx == NULL || fc->fddictn == NULL)
734 assert(fx < fc->fddictx->nvals);
735 dx = fc->fddictx->vals[fx];
736 assert(fx < fc->fddictn->nvals);
737 ndx = fc->fddictn->vals[fx];
741 unsigned char deptype;
744 ix = fc->ddictx->vals[dx++];
745 deptype = ((ix >> 24) & 0xff);
750 assert(depval != NULL);
754 assert(ix < nprovides);
762 assert(ix < nrequires);
770 fprintf(fp,
"\t%s\n", depval);
784 const char * fn = fc->fn[fc->ix];
796 const char * defaultdocdir =
rpmExpand(
"%{?_defaultdocdir}", NULL);
797 if (defaultdocdir == NULL || *defaultdocdir ==
'\0')
798 defaultdocdir = strdup(
"/usr/share/doc");
799 xx = !strncmp(fn+fc->brlen, defaultdocdir, strlen(defaultdocdir));
800 defaultdocdir =
_free(defaultdocdir) ;
806 {
struct stat sb, * st = &sb;
807 if (stat(fn, st) != 0)
809 is_executable = (int)(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
813 if (fp == NULL || ferror(fp)) {
814 if (fp) (void) fclose(fp);
819 for (i = 0; i < 10; i++) {
821 s = fgets(buf,
sizeof(buf) - 1, fp);
822 if (s == NULL || ferror(fp) || feof(fp))
824 s[
sizeof(buf)-1] =
'\0';
825 if (!(s[0] ==
'#' && s[1] ==
'!'))
829 while (*s && strchr(
" \t\n\r", *s) != NULL)
836 for (se = s+1; *se; se++) {
837 if (strchr(
" \t\n\r", *se) != NULL)
863 if (!strcmp(bn,
"perl"))
865 else if (!strncmp(bn,
"python",
sizeof(
"python")-1))
867 else if (!strncmp(bn,
"php",
sizeof(
"php")-1))
869 else if (!strncmp(bn,
"ruby",
sizeof(
"ruby")-1))
880 if (is_executable || (fc->fcolor->vals[fc->ix] &
RPMFC_MODULE))
911 if (fc->fcolor->vals[fc->ix] &
RPMFC_PHP) {
945 strstr(fn,
"/gstreamer")) {
949 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
953 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
954 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0) {
990 fprintf(stderr,
"*** rpmfcMergePR(%p, %p) %s\n", context, ds,
tagName(
rpmdsTagN(ds)));
1034 const char * fn = fc->fn[fc->ix];
1045 #if defined(RPM_VENDOR_MANDRIVA)
1055 extern int rpmdsSymlink(
const char * fn,
int flags,
1056 int (*add) (
void * context,
rpmds ds),
void * context)
1060 static int rpmfcSYMLINK(
rpmfc fc)
1064 const char * fn = fc->fn[fc->ix];
1089 #
if defined(RPM_VENDOR_MANDRIVA)
1106 unsigned char deptype;
1116 const char * lastPycDir = NULL;
1120 int skipProv = fc->skipProv;
1121 int skipReq = fc->skipReq;
1124 if (_filter_execs) {
1127 if (fc->PFnmire > 0)
1132 if (fc->RFnmire > 0)
1148 assert(fc->fn != NULL);
1150 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
1154 { fn = strstr(fc->fn[fc->ix],
"/usr/lib");
1156 fn +=
sizeof(
"/usr/lib")-1;
1157 if (fn[0] ==
'x') fn++;
1158 if ((fn[0] ==
'3' && fn[1] ==
'2') ||
1159 (fn[0] ==
'6' && fn[1] ==
'4'))
1161 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1)) {
1163 if (fn[l-4] ==
'.' && fn[l-3] ==
'p' && fn[l-2] ==
'y'
1164 && (fn[l-1] ==
'c' || fn[l-1] ==
'o')) {
1165 p = strchr(fn,
'/');
1167 l = p - fc->fn[fc->ix];
1168 if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
1171 lastPycDir = fc->fn[fc->ix];
1175 else if (l > 17 && !strcmp(fn + l - 17,
"egg-info/PKG-INFO")) {
1179 else if (l > 8 && !strcmp(fn + l - 8,
"egg-info")) {
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)
1195 else if (!strncmp(fn,
"/gstreamer",
sizeof(
"/gstreamer")-1) &&
1198 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
1201 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
1202 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1207 fn = strstr(fc->fn[fc->ix],
"/usr/share");
1209 fn +=
sizeof(
"/usr/share")-1;
1210 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1)) {
1212 if (fn[l-4] ==
'.' && fn[l-3] ==
'p' && fn[l-2] ==
'y'
1213 && (fn[l-1] ==
'c' || fn[l-1] ==
'o')) {
1214 p = strchr(fn,
'/');
1216 l = p - fc->fn[fc->ix];
1217 if (!lastPycDir || strncmp(lastPycDir, fc->fn[fc->ix], l)) {
1220 lastPycDir = fc->fn[fc->ix];
1224 else if (l > 17 && !strcmp(fn + l - 17,
"egg-info/PKG-INFO")) {
1228 else if (l > 8 && !strcmp(fn + l - 8,
"egg-info")) {
1233 else if (!strncmp(fn,
"/ruby",
sizeof(
"/ruby")-1) || !strncmp(fn,
"/gems/specifications",
sizeof(
"/gems/specifications")-1)) {
1235 if ((strstr(fn,
".gemspec") || strstr(fn,
"rbconfig.rb"))) {
1237 if (!
mireRegcomp(mire,
".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
1238 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1247 { fn = strstr(fc->fn[fc->ix],
"/usr/share/haskell-deps");
1252 if (fc->fcolor->vals[fc->ix])
1253 for (fcat = rpmfcApplyTable; fcat->
func != NULL; fcat++) {
1254 if (!(fc->fcolor->vals[fc->ix] & fcat->
colormask))
1257 if (_filter_execs) {
1258 fc->skipProv = skipProv;
1259 fc->skipReq = skipReq;
1260 if ((mire = (
miRE)fc->PFmires) != NULL)
1261 for (j = 0; j < fc->PFnmire; j++, mire++) {
1262 fn = fc->fn[fc->ix] + fc->brlen;
1270 if ((mire = (
miRE)fc->RFmires) != NULL)
1271 for (j = 0; j < fc->RFnmire; j++, mire++) {
1272 fn = fc->fn[fc->ix] + fc->brlen;
1282 struct stat sb, * st = &sb;
1283 if (stat(fc->fn[fc->ix], st) == 0 && !(st->st_mode & (S_IFBLK|S_IFCHR)))
1284 xx = (*fcat->
func) (fc);
1288 if (_filter_execs) {
1294 fc->skipProv = skipProv;
1295 fc->skipReq = skipReq;
1300 for (i = 0; i < nddict; i++) {
1304 ix = strtol(s, &se, 10);
1309 while (*se && *se !=
' ')
1313 while (*se && *se !=
' ')
1316 Flags = (
evrFlags) strtol(se, NULL, 16);
1324 skipping = fc->skipProv;
1331 skipping = fc->skipReq;
1347 val = (deptype << 24) | (dix & 0x00ffffff);
1348 xx =
argiAdd(&fc->ddictx, -1, val);
1354 if (fc->fddictn && fc->fddictn->vals && !skipping)
1355 fc->fddictn->vals[ix]++;
1366 const char * s, * se;
1370 const char * magicfile = NULL;
1372 if (fc == NULL || argv == NULL)
1375 magicfile =
rpmExpand(
"%{?_rpmfc_magic_path}", NULL);
1376 if (magicfile == NULL || *magicfile ==
'\0')
1377 magicfile =
_free(magicfile);
1385 xx =
argiAdd(&fc->fddictx, fc->nfiles-1, 0);
1386 xx =
argiAdd(&fc->fddictn, fc->nfiles-1, 0);
1390 xx =
argvAdd(&fc->cdict,
"directory");
1392 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1398 ftype =
""; freeftype = 0;
1399 urltype =
urlPath(argv[fc->ix], &s);
1400 assert(s != NULL && *s ==
'/');
1403 switch (mode & S_IFMT) {
1404 case S_IFCHR: ftype =
"character special";
break;
1405 case S_IFBLK: ftype =
"block special";
break;
1406 #if defined(S_IFIFO)
1407 case S_IFIFO: ftype =
"fifo (named pipe)";
break;
1409 #if defined(S_IFSOCK)
1411 case S_IFSOCK: ftype =
"socket";
break;
1419 #define _suffix(_s, _x) \
1420 (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))
1424 ftype =
"Perl5 module source text";
1428 ftype =
"Java archive file";
1431 else if (
_suffix(s,
".class"))
1432 ftype =
"Java class file";
1436 ftype =
"libtool library file";
1440 ftype =
"pkgconfig file";
1444 ftype =
"PHP script text";
1446 else if (
_suffix(s,
".desktop"))
1447 ftype =
"Desktop Entry";
1450 else if (
_suffix(s,
".typelib"))
1451 ftype =
"G-IR binary database";
1455 ftype =
"G-IR binary database";
1458 else if (slen >= fc->brlen+
sizeof(
"/dev/") && !strncmp(s+fc->brlen,
"/dev/",
sizeof(
"/dev/")-1))
1460 else if (magicfile) {
1462 assert(ftype != NULL);
1481 xx =
argiAdd(&fc->fcolor, (
int)fc->ix, fcolor);
1488 ftype =
_free(ftype);
1494 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1500 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, (dav - fc->cdict));
1503 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, 0);
1512 D_(
"categorized %d files into %u classes (using %s).\n"),
1513 (
unsigned)fc->nfiles,
argvCount(fc->cdict), magicfile);
1514 magicfile =
_free(magicfile);
1542 {
"Provides", {
"%{?__find_provides}", NULL, NULL, NULL },
1545 {
"Requires(interp)", { NULL,
"interp", NULL, NULL },
1547 _notpre(RPMSENSE_INTERP), 0 },
1548 {
"Requires(rpmlib)", { NULL,
"rpmlib", NULL, NULL },
1550 _notpre(RPMSENSE_RPMLIB), 0 },
1551 {
"Requires(verify)", { NULL,
"verify", NULL, NULL },
1553 RPMSENSE_SCRIPT_VERIFY, 0 },
1554 {
"Requires(pre)", { NULL,
"pre", NULL, NULL },
1556 _notpre(RPMSENSE_SCRIPT_PRE), 0 },
1557 {
"Requires(post)", { NULL,
"post", NULL, NULL },
1559 _notpre(RPMSENSE_SCRIPT_POST), 0 },
1560 {
"Requires(preun)", { NULL,
"preun", NULL, NULL },
1562 _notpre(RPMSENSE_SCRIPT_PREUN), 0 },
1563 {
"Requires(postun)", { NULL,
"postun", NULL, NULL },
1565 _notpre(RPMSENSE_SCRIPT_POSTUN), 0 },
1566 {
"Requires", {
"%{?__find_requires}", NULL, NULL, NULL },
1568 RPMSENSE_FIND_REQUIRES|RPMSENSE_TRIGGERIN|RPMSENSE_TRIGGERUN|RPMSENSE_TRIGGERPOSTUN|RPMSENSE_TRIGGERPREIN, 0 },
1569 {
"Conflicts", {
"%{?__find_conflicts}", NULL, NULL, NULL },
1572 {
"Obsoletes", {
"%{?__find_obsoletes}", NULL, NULL, NULL },
1597 for (dm = DepMsgs; dm->
msg != NULL; dm++) {
1598 if ((
int)dm->
ntag != -1) {
1641 int failnonzero = 0;
1653 for (dm = DepMsgs; dm->
msg != NULL; dm++) {
1668 tagflags = RPMSENSE_FIND_PROVIDES;
1674 tagflags = RPMSENSE_FIND_REQUIRES;
1681 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1690 if (iob_stdout == NULL) {
1718 {
"Requires(pre)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1720 RPMSENSE_SCRIPT_PRE, 0 },
1721 {
"Requires(post)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1723 RPMSENSE_SCRIPT_POST, 0 },
1724 {
"Requires(preun)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1726 RPMSENSE_SCRIPT_PREUN, 0 },
1727 {
"Requires(postun)", {
"%{?__scriptlet_requires}", NULL, NULL, NULL },
1729 RPMSENSE_SCRIPT_POSTUN, 0 },
1745 rpmiob iob_stdout = NULL;
1747 int failnonzero = 0;
1751 for (dm = ScriptMsgs; dm->
msg != NULL; dm++) {
1762 if (!xx || he->
p.
str == NULL)
1764 xx = strcmp(he->
p.
str,
"/bin/sh") && strcmp(he->
p.
str,
"/bin/bash");
1772 if (!xx || he->
p.
str == NULL)
1779 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1785 if (s != NULL && *s !=
'\0') {
1788 while ((se = strstr(se,
"executable(/")) != NULL) {
1793 se = strchr(se,
')');
1799 rc = spec->
_parseRCPOT(spec, pkg, s, tag, 0, tagflags);
1811 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1813 unsigned i, rnum, removed = 0;
1814 const char **deps = NULL;
1815 const char **versions = NULL;
1817 int *newpos = NULL, *ddictxPos = NULL;
1826 versions = he->
p.
argv;
1832 if (fc && fc->requires != NULL && fc->ddictx != NULL) {
1833 newpos =
alloca(he->
c*
sizeof(newpos[0]));
1835 ddictxPos =
alloca(fc->ddictx->nvals*
sizeof(ddictxPos[0]));
1837 for (i = 0; i < rnum-removed; i++) {
1839 deps[
i] = deps[i+removed];
1840 versions[
i] = versions[i+removed];
1841 flags[
i] = flags[i+removed];
1843 fc->requires->N[
i] = fc->requires->N[i+removed];
1844 fc->requires->EVR[
i] = fc->requires->EVR[i+removed];
1845 fc->requires->Flags[
i] = fc->requires->Flags[i+removed];
1848 if (fc && fc->requires != NULL && fc->ddictx != NULL)
1849 newpos[i+removed] =
i;
1853 if (flags[i] & RPMSENSE_SCRIPT_PRE)
1856 if (fc && fc->requires != NULL && fc->ddictx != NULL)
1857 newpos[i+removed] = -1;
1866 if (fc && fc->requires != NULL && fc->ddictx != NULL && removed) {
1867 fc->requires->Count -= removed;
1869 for (i = 0; i < fc->ddictx->nvals-rx; i++) {
1871 unsigned char deptype;
1873 ix = fc->ddictx->vals[i+rx];
1874 deptype = ((ix >> 24) & 0xff);
1877 if (deptype ==
'P') {
1878 ddictxPos[i+rx] =
i;
1879 fc->ddictx->vals[
i] = fc->ddictx->vals[i+rx];
1882 if (newpos[ix] == -1) {
1883 ddictxPos[i+rx] = -1;
1888 ddictxPos[i+rx] =
i;
1889 fc->ddictx->vals[
i] = (deptype << 24) | (newpos[ix] & 0x00ffffff);
1892 fc->ddictx->nvals -= rx;
1894 for (i = 0; i < fc->fddictn->nvals; i++) {
1896 if (fc->fddictn->vals[i]) {
1897 unsigned j, ix = fc->fddictx->vals[
i];
1898 for (j = 0, rx = 0; j < fc->fddictn->vals[
i]; j++, ix++) {
1899 if (ddictxPos[ix] == -1)
1901 if (j == 0 || fc->fddictx->vals[i] == -1)
1902 fc->fddictx->vals[
i] = ddictxPos[ix];
1906 fc->fddictn->vals[
i] -= rx;
1907 if (fc->fddictn->vals[i] == 0)
1908 fc->fddictx->vals[
i] = 0;
1920 he->
p.
argv = versions;
1925 he->
p.
ui32p = (uint32_t*)flags;
1947 int genConfigDeps, internaldeps;
1962 if (internaldeps == 0) {
1971 if (internaldeps > 1)
1999 {
const char * buildRootURL;
2000 const char * buildRoot;
2002 (void)
urlPath(buildRootURL, &buildRoot);
2003 if (buildRoot && !strcmp(buildRoot,
"/")) buildRoot = NULL;
2004 fc->brlen = (buildRoot ? strlen(buildRoot) : 0);
2005 buildRootURL =
_free(buildRootURL);
2009 if (!fc->skipProv) {
2022 if (genConfigDeps) {
2027 assert(EVR != NULL);
2028 sprintf(buf,
"config(%s)", N);
2049 if (genConfigDeps) {
2054 assert(EVR != NULL);
2055 sprintf(buf,
"config(%s)", N);
2074 assert(ac == (
int)he->
c);
2075 if (he->
p.
ptr != NULL && he->
c > 0) {
2079 for (i = 0; i < (int)he->
c; i++)
2090 if (he->
p.
ptr != NULL && he->
c > 0) {
2099 assert(ac == (
int)he->
c);
2100 if (he->
p.
ptr != NULL && he->
c > 0) {
2105 if (fc->provides != NULL && (he->
c =
rpmdsCount(fc->provides)) > 0
2110 he->
p.
argv = fc->provides->N;
2117 he->
p.
argv = fc->provides->EVR;
2118 assert(he->
p.
ptr != NULL);
2124 assert(he->
p.
ptr != NULL);
2130 if (fc->requires != NULL && (he->
c =
rpmdsCount(fc->requires)) > 0
2135 he->
p.
argv = fc->requires->N;
2136 assert(he->
p.
ptr != NULL);
2143 he->
p.
argv = fc->requires->EVR;
2144 assert(he->
p.
ptr != NULL);
2150 assert(he->
p.
ptr != NULL);
2162 if (he->
p.
ptr != NULL) {
2171 assert(ac == (
int)he->
c);
2172 if (he->
p.
ptr != NULL) {
2180 assert(ac == (
int)he->
c);
2181 if (he->
p.
ptr != NULL) {
2189 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));
2194 fmode =
_free(fmode);
2209 fc->fcdictx =
argiFree(fc->fcdictx);
2210 fc->fddictx =
argiFree(fc->fddictx);
2211 fc->fddictn =
argiFree(fc->fddictn);
2217 fc->provides = NULL;
2219 fc->requires = NULL;
2237 if (_rpmfcPool == NULL) {
2243 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)