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++)
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))) {
213 const char *cmd =
argvJoin(argv,
' ');
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) {
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)
687 fcolor |= fct->colors;
705 if (fp ==
NULL) fp = stderr;
708 fprintf(fp,
"===================================== %s\n", msg);
714 for (fx = 0; fx < fc->nfiles; fx++) {
715 assert(fx < fc->fcdictx->nvals);
716 cx = fc->fcdictx->vals[fx];
717 assert(fx < fc->fcolor->nvals);
718 fcolor = fc->fcolor->vals[fx];
720 fprintf(fp,
"%3d %s", (
int)fx, fc->fn[fx]);
722 fprintf(fp,
"\t0x%x", fc->fcolor->vals[fx]);
724 fprintf(fp,
"\t%s", fc->cdict[cx]);
727 if (fc->fddictx ==
NULL || fc->fddictn ==
NULL)
730 assert(fx < fc->fddictx->nvals);
731 dx = fc->fddictx->vals[fx];
732 assert(fx < fc->fddictn->nvals);
733 ndx = fc->fddictn->vals[fx];
737 unsigned char deptype;
740 ix = fc->ddictx->vals[dx++];
741 deptype = ((ix >> 24) & 0xff);
780 const char *
fn = fc->fn[fc->ix];
792 const char * defaultdocdir =
rpmExpand(
"%{?_defaultdocdir}",
NULL);
793 if (defaultdocdir ==
NULL || *defaultdocdir ==
'\0')
794 defaultdocdir = strdup(
"/usr/share/doc");
795 xx = !strncmp(fn+fc->brlen, defaultdocdir, strlen(defaultdocdir));
796 defaultdocdir =
_free(defaultdocdir) ;
802 {
struct stat sb, *
st = &sb;
803 if (stat(fn, st) != 0)
805 is_executable = (
int)(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
809 if (fp ==
NULL || ferror(fp)) {
810 if (fp) (
void) fclose(fp);
815 for (i = 0; i < 10; i++) {
817 s = fgets(buf,
sizeof(buf) - 1, fp);
818 if (s ==
NULL || ferror(fp) || feof(fp))
820 s[
sizeof(
buf)-1] =
'\0';
821 if (!(s[0] ==
'#' && s[1] ==
'!'))
825 while (*s && strchr(
" \t\n\r", *s) !=
NULL)
832 for (se = s+1; *
se; se++) {
833 if (strchr(
" \t\n\r", *se) !=
NULL)
861 else if (!strncmp(bn,
"python",
sizeof(
"python")-1))
863 else if (!strncmp(bn,
"php",
sizeof(
"php")-1))
865 else if (!strncmp(bn,
"ruby",
sizeof(
"ruby")-1))
876 if (is_executable || (fc->fcolor->vals[fc->ix] &
RPMFC_MODULE))
907 if (fc->fcolor->vals[fc->ix] &
RPMFC_PHP) {
941 strstr(fn,
"/gstreamer")) {
945 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
949 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
950 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0) {
1030 const char *
fn = fc->fn[fc->ix];
1041 #if defined(RPM_VENDOR_MANDRIVA)
1051 extern int rpmdsSymlink(
const char *
fn,
int flags,
1052 int (*add) (
void * context,
rpmds ds),
void * context)
1056 static int rpmfcSYMLINK(
rpmfc fc)
1060 const char * fn = fc->fn[fc->ix];
1085 #
if defined(RPM_VENDOR_MANDRIVA)
1102 unsigned char deptype;
1113 int skipProv = fc->skipProv;
1114 int skipReq = fc->skipReq;
1117 if (_filter_execs) {
1120 if (fc->PFnmire > 0)
1125 if (fc->RFnmire > 0)
1143 for (fc->ix = 0; fc->fn[fc->ix] !=
NULL; fc->ix++) {
1147 { fn = strstr(fc->fn[fc->ix],
"/usr/lib");
1149 fn +=
sizeof(
"/usr/lib")-1;
1150 if ((fn[0] ==
'3' && fn[1] ==
'2') ||
1151 (fn[0] ==
'6' && fn[1] ==
'4'))
1153 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1))
1155 else if (!strncmp(fn,
"/ruby",
sizeof(
"/ruby")-1)) {
1157 if ((strstr(fn,
".gemspec") || strstr(fn,
"rbconfig.rb"))) {
1159 if (!
mireRegcomp(mire,
".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
1160 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1166 else if (!strncmp(fn,
"/gstreamer",
sizeof(
"/gstreamer")-1) &&
1169 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_PLD)
1172 if (!
mireRegcomp(mire,
"^.*((/lib/modules/|/var/lib/dkms/).*\\.ko(\\.gz|\\.xz)?|(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf)$"))
1173 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1178 fn = strstr(fc->fn[fc->ix],
"/usr/share");
1180 fn +=
sizeof(
"/usr/share")-1;
1181 if (!strncmp(fn,
"/python",
sizeof(
"/python")-1))
1183 else if (!strncmp(fn,
"/ruby",
sizeof(
"/ruby")-1)) {
1185 if ((strstr(fn,
".gemspec") || strstr(fn,
"rbconfig.rb"))) {
1187 if (!
mireRegcomp(mire,
".*/(specifications/.*\\.gemspec|rbconfig\\.rb)$"))
1188 if (
mireRegexec(mire, fc->fn[fc->ix], (
size_t) 0) >= 0)
1197 { fn = strstr(fc->fn[fc->ix],
"/usr/share/haskell-deps");
1202 if (fc->fcolor->vals[fc->ix])
1203 for (fcat = rpmfcApplyTable; fcat->
func !=
NULL; fcat++) {
1204 if (!(fc->fcolor->vals[fc->ix] & fcat->
colormask))
1207 if (_filter_execs) {
1208 fc->skipProv = skipProv;
1209 fc->skipReq = skipReq;
1210 if ((mire = (
miRE)fc->PFmires) !=
NULL)
1211 for (j = 0; j < fc->PFnmire; j++, mire++) {
1212 fn = fc->fn[fc->ix] + fc->brlen;
1220 if ((mire = (
miRE)fc->RFmires) !=
NULL)
1221 for (j = 0; j < fc->RFnmire; j++, mire++) {
1222 fn = fc->fn[fc->ix] + fc->brlen;
1232 struct stat sb, *
st = &sb;
1233 if (stat(fc->fn[fc->ix], st) == 0 && !(st->st_mode & (S_IFBLK|S_IFCHR)))
1234 xx = (*fcat->
func) (fc);
1238 if (_filter_execs) {
1244 fc->skipProv = skipProv;
1245 fc->skipReq = skipReq;
1250 for (i = 0; i < nddict; i++) {
1254 ix = strtol(s, &se, 10);
1259 while (*se && *se !=
' ')
1263 while (*se && *se !=
' ')
1274 skipping = fc->skipProv;
1281 skipping = fc->skipReq;
1297 val = (deptype << 24) | (dix & 0x00ffffff);
1298 xx =
argiAdd(&fc->ddictx, -1, val);
1304 if (fc->fddictn && fc->fddictn->vals && !skipping)
1305 fc->fddictn->vals[
ix]++;
1316 const char *
s, *
se;
1320 const char * magicfile =
NULL;
1326 if (magicfile ==
NULL || *magicfile ==
'\0')
1327 magicfile =
_free(magicfile);
1335 xx =
argiAdd(&fc->fddictx, fc->nfiles-1, 0);
1336 xx =
argiAdd(&fc->fddictn, fc->nfiles-1, 0);
1340 xx =
argvAdd(&fc->cdict,
"directory");
1342 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1348 ftype =
""; freeftype = 0;
1349 urltype =
urlPath(argv[fc->ix], &s);
1353 switch (mode & S_IFMT) {
1354 case S_IFCHR: ftype =
"character special";
break;
1355 case S_IFBLK: ftype =
"block special";
break;
1356 #if defined(S_IFIFO)
1357 case S_IFIFO: ftype =
"fifo (named pipe)";
break;
1359 #if defined(S_IFSOCK)
1361 case S_IFSOCK: ftype =
"socket";
break;
1369 #define _suffix(_s, _x) \
1370 (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))
1374 ftype =
"Perl5 module source text";
1378 ftype =
"Java archive file";
1381 else if (
_suffix(s,
".class"))
1382 ftype =
"Java class file";
1386 ftype =
"libtool library file";
1390 ftype =
"pkgconfig file";
1394 ftype =
"PHP script text";
1396 else if (
_suffix(s,
".desktop"))
1397 ftype =
"Desktop Entry";
1400 else if (
_suffix(s,
".typelib"))
1401 ftype =
"G-IR binary database";
1405 ftype =
"G-IR binary database";
1408 else if (slen >= fc->brlen+
sizeof(
"/dev/") && !strncmp(s+fc->brlen,
"/dev/",
sizeof(
"/dev/")-1))
1410 else if (magicfile) {
1431 xx =
argiAdd(&fc->fcolor, (
int)fc->ix, fcolor);
1438 ftype =
_free(ftype);
1444 for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
1450 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, (dav - fc->cdict));
1453 xx =
argiAdd(&fc->fcdictx, (
int)fc->ix, 0);
1462 D_(
"categorized %d files into %u classes (using %s).\n"),
1463 (
unsigned)fc->nfiles,
argvCount(fc->cdict), magicfile);
1464 magicfile =
_free(magicfile);
1492 {
"Provides", {
"%{?__find_provides}",
NULL,
NULL, NULL },
1495 {
"Requires(interp)", {
NULL,
"interp",
NULL, NULL },
1497 _notpre(RPMSENSE_INTERP), 0 },
1498 {
"Requires(rpmlib)", {
NULL,
"rpmlib",
NULL, NULL },
1500 _notpre(RPMSENSE_RPMLIB), 0 },
1501 {
"Requires(verify)", {
NULL,
"verify",
NULL, NULL },
1503 RPMSENSE_SCRIPT_VERIFY, 0 },
1504 {
"Requires(pre)", {
NULL,
"pre",
NULL, NULL },
1506 _notpre(RPMSENSE_SCRIPT_PRE), 0 },
1507 {
"Requires(post)", {
NULL,
"post",
NULL, NULL },
1509 _notpre(RPMSENSE_SCRIPT_POST), 0 },
1510 {
"Requires(preun)", {
NULL,
"preun",
NULL, NULL },
1512 _notpre(RPMSENSE_SCRIPT_PREUN), 0 },
1513 {
"Requires(postun)", {
NULL,
"postun",
NULL, NULL },
1515 _notpre(RPMSENSE_SCRIPT_POSTUN), 0 },
1516 {
"Requires", {
"%{?__find_requires}",
NULL,
NULL, NULL },
1518 RPMSENSE_FIND_REQUIRES|RPMSENSE_TRIGGERIN|RPMSENSE_TRIGGERUN|RPMSENSE_TRIGGERPOSTUN|RPMSENSE_TRIGGERPREIN, 0 },
1519 {
"Conflicts", {
"%{?__find_conflicts}",
NULL,
NULL, NULL },
1522 {
"Obsoletes", {
"%{?__find_obsoletes}",
NULL,
NULL, NULL },
1547 for (dm = DepMsgs; dm->
msg !=
NULL; dm++) {
1548 if ((
int)dm->
ntag != -1) {
1591 int failnonzero = 0;
1603 for (dm = DepMsgs; dm->
msg !=
NULL; dm++) {
1618 tagflags = RPMSENSE_FIND_PROVIDES;
1624 tagflags = RPMSENSE_FIND_REQUIRES;
1631 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1640 if (iob_stdout ==
NULL) {
1668 {
"Requires(pre)", {
"%{?__scriptlet_requires}",
NULL,
NULL, NULL },
1670 RPMSENSE_SCRIPT_PRE, 0 },
1671 {
"Requires(post)", {
"%{?__scriptlet_requires}",
NULL,
NULL, NULL },
1673 RPMSENSE_SCRIPT_POST, 0 },
1674 {
"Requires(preun)", {
"%{?__scriptlet_requires}",
NULL,
NULL, NULL },
1676 RPMSENSE_SCRIPT_PREUN, 0 },
1677 {
"Requires(postun)", {
"%{?__scriptlet_requires}",
NULL,
NULL, NULL },
1679 RPMSENSE_SCRIPT_POSTUN, 0 },
1697 int failnonzero = 0;
1701 for (dm = ScriptMsgs; dm->
msg !=
NULL; dm++) {
1729 xx =
rpmfcExec(dm->
argv, iob_stdin, &iob_stdout, failnonzero);
1735 if (s !=
NULL && *s !=
'\0') {
1738 while ((se = strstr(se,
"executable(/")) !=
NULL) {
1743 se = strchr(se,
')');
1749 rc = spec->
_parseRCPOT(spec, pkg, s, tag, 0, tagflags);
1763 unsigned i, rnum, removed = 0;
1764 const char **deps =
NULL;
1765 const char **versions =
NULL;
1767 int *newpos =
NULL, *ddictxPos =
NULL;
1776 versions = he->
p.
argv;
1782 if (fc && fc->requires !=
NULL && fc->ddictx !=
NULL) {
1783 newpos =
alloca(he->
c*
sizeof(newpos[0]));
1785 ddictxPos =
alloca(fc->ddictx->nvals*
sizeof(ddictxPos[0]));
1787 for (i = 0; i < rnum-removed; i++) {
1789 deps[
i] = deps[i+removed];
1790 versions[
i] = versions[i+removed];
1791 flags[
i] = flags[i+removed];
1793 fc->requires->N[
i] = fc->requires->N[i+removed];
1794 fc->requires->EVR[
i] = fc->requires->EVR[i+removed];
1795 fc->requires->Flags[
i] = fc->requires->Flags[i+removed];
1798 if (fc && fc->requires !=
NULL && fc->ddictx !=
NULL)
1799 newpos[i+removed] =
i;
1803 if (flags[i] & RPMSENSE_SCRIPT_PRE)
1806 if (fc && fc->requires !=
NULL && fc->ddictx !=
NULL)
1807 newpos[i+removed] = -1;
1816 if (fc && fc->requires !=
NULL && fc->ddictx !=
NULL && removed) {
1817 fc->requires->Count -= removed;
1819 for (i = 0; i < fc->ddictx->nvals-rx; i++) {
1821 unsigned char deptype;
1823 ix = fc->ddictx->vals[i+rx];
1824 deptype = ((ix >> 24) & 0xff);
1827 if (deptype ==
'P') {
1828 ddictxPos[i+rx] =
i;
1829 fc->ddictx->vals[
i] = fc->ddictx->vals[i+rx];
1832 if (newpos[ix] == -1) {
1833 ddictxPos[i+rx] = -1;
1838 ddictxPos[i+rx] =
i;
1839 fc->ddictx->vals[
i] = (deptype << 24) | (newpos[ix] & 0x00ffffff);
1842 fc->ddictx->nvals -= rx;
1844 for (i = 0; i < fc->fddictn->nvals; i++) {
1846 if (fc->fddictn->vals[i]) {
1847 unsigned j,
ix = fc->fddictx->vals[
i];
1848 for (j = 0, rx = 0; j < fc->fddictn->vals[
i]; j++, ix++) {
1849 if (ddictxPos[ix] == -1)
1851 if (j == 0 || fc->fddictx->vals[i] == -1)
1852 fc->fddictx->vals[
i] = ddictxPos[
ix];
1856 fc->fddictn->vals[
i] -= rx;
1857 if (fc->fddictn->vals[i] == 0)
1858 fc->fddictx->vals[
i] = 0;
1870 he->
p.
argv = versions;
1875 he->
p.
ui32p = (uint32_t*)flags;
1897 int genConfigDeps, internaldeps;
1912 if (internaldeps == 0) {
1921 if (internaldeps > 1)
1950 const char * buildRoot;
1953 if (buildRoot && !
strcmp(buildRoot,
"/")) buildRoot =
NULL;
1954 fc->brlen = (buildRoot ? strlen(buildRoot) : 0);
1955 buildRootURL =
_free(buildRootURL);
1959 if (!fc->skipProv) {
1972 if (genConfigDeps) {
1978 sprintf(buf,
"config(%s)", N);
1999 if (genConfigDeps) {
2005 sprintf(buf,
"config(%s)", N);
2029 for (i = 0; i < (
int)he->
c; i++)
2060 he->
p.
argv = fc->provides->N;
2067 he->
p.
argv = fc->provides->EVR;
2085 he->
p.
argv = fc->requires->N;
2093 he->
p.
argv = fc->requires->EVR;
2139 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));
2144 fmode =
_free(fmode);
2159 fc->fcdictx =
argiFree(fc->fcdictx);
2160 fc->fddictx =
argiFree(fc->fddictx);
2161 fc->fddictn =
argiFree(fc->fddictn);
2167 fc->provides =
NULL;
2169 fc->requires =
NULL;
2187 if (_rpmfcPool ==
NULL) {
2193 memset(((
char *)fc)+
sizeof(fc->_item), 0,
sizeof(*fc)-
sizeof(fc->_item));
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
rpmuint32_t rpmfiFFlags(rpmfi fi)
Return current file flags from file info set.
int rpmEVRcompare(const EVR_t a, const EVR_t b)
Compare EVR containers for equality.
rpmiob rpmiobRTrim(rpmiob iob)
Trim trailing white space.
miRE mireNew(rpmMireMode mode, int tag)
Create pattern container.
const char * rpmmgFile(rpmmg mg, const char *fn)
Return magic string for a file.
rpmlog(RPMLOG_ERR,"%s\n", buf)
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)
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)
int rpmdsFind(rpmds ds, const rpmds ods)
Find a dependency set element using binary search.
Structure(s) used for file info tag sets.
evrFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
int mireRegcomp(miRE mire, const char *pattern)
Compile pattern match.
int argvAppend(ARGV_t *argvp, ARGV_t av)
Append one argv array to another.
int rpmdsMerge(rpmds *dsp, rpmds ods)
Merge a dependency set maintaining (N,EVR,Flags) sorted order.
static int rpmfcELF(rpmfc fc)
Extract Elf dependencies.
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.
rpmRC rpmfcApply(rpmfc fc)
Build file/package dependency dictionary and mappings.
EVR_t rpmEVRnew(uint32_t Flags, int initialize)
Create a new EVR container.
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)
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
Create and load a dependency set.
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.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
static PyObject *char * mode
int rpmEVRparse(const char *evrstr, EVR_t evr)
Split EVR string into epoch, version, and release components.
char * argvJoin(ARGV_t argv, char sep)
Concatenate an argv array into a string.
sprintf(t," (%u)",(unsigned) dig->nbytes)
enum evrFlags_e evrFlags
Dependency Attributes.
enum rpmRC_e rpmRC
RPM return codes.
Yet Another syslog(3) API clone.
memset(_r, 0, sizeof(*_r))
static struct rpmfcTokens_s rpmfcTokens[]
static rpmfc rpmfcGetPool(rpmioPool pool)
miRE mireFree(miRE mire)
Free pattern container.
struct Package_s * Package
rpmds rpmdsSingle(rpmTag tagN, const char *N, const char *EVR, evrFlags Flags)
Create, load and initialize a dependency set of size 1.
void * xcalloc(size_t nmemb, size_t size)
assert(key->size==sizeof(hdrNum))
int rpmdsSetIx(rpmds ds, int ix)
Set dependency set index.
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.
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
int rpmdsSearch(rpmds ds, rpmds ods)
Search a sorted dependency set for an element that overlaps.
rpmfc rpmfcFree(rpmfc fc)
Destroy a file classifier.
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.
rpmTag rpmdsTagN(const rpmds ds)
Return current dependency type.
enum evrFlags_e rpmsenseFlags
int rpmdsMatch(const rpmds A, rpmds B)
Compare A against every member of B, looking for 1st match.
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 * tagName(rpmTag tag)
Return tag name from value.
static int _filter_values
Structure(s) used for dependency tag sets.
rpmRC(* _parseRCPOT)(Spec spec, Package pkg, const char *field, rpmTag tagN, rpmuint32_t index, rpmsenseFlags tagflags)
int rpmdsCount(const rpmds ds)
Return dependency set count.
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.
void rpmfcPrint(const char *msg, rpmfc fc, FILE *fp)
Print results of file classification.
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[]
static int rpmfcSCRIPT(rpmfc fc)
Extract script dependencies.
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
enum rpmfileAttrs_e rpmfileAttrs
File Attributes.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
const char * buildRootURL
EVR_t rpmEVRfree(EVR_t evr)
Destroy an EVR container.
return strcmp(ame->name, bme->name)
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,...)
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)
char * stpcpy(char *dest, const char *src)
static rpmRC rpmfcGenerateDependsHelper(const Spec spec, Package pkg, rpmfi fi)
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
static int rpmfcGenerateScriptletDeps(const Spec spec, Package pkg)
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
int argiAdd(ARGI_t *argip, int ix, int val)
Add an int to an argi array.
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.
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.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
char * buf
Parse (and execute) macro undefinition.
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.
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
Save source and expand field into target.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
const char * rpmdsN(const rpmds ds)
Return current dependency name.
#define RPMELF_FLAG_SKIPPROVIDES
rpmRC rpmfcGenerateDepends(void *_spec, void *_pkg)
Generate package dependencies.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
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 PyObject *rpmds ds
static void * rpmfcExpandRegexps(const char *str, int *nmirep)