16 #define _RPMDB_INTERNAL
19 #define _RPMDS_INTERNAL
20 #define _RPMEVR_INTERNAL
24 #define _RPMTE_INTERNAL
26 #define _RPMTS_INTERNAL
36 #define CACHE_DEPENDENCY_RESULT 1
37 #if defined(CACHE_DEPENDENCY_RESULT)
57 static int uintcmp(
const void * a,
const void *
b)
60 const uint32_t * aptr = (
const uint32_t *) a;
61 const uint32_t * bptr = (
const uint32_t *) b;
62 int rc = (*aptr - *bptr);
85 if (ts->numRemovedPackages > 0 && ts->removedPackages != NULL) {
86 uint32_t * needle = NULL;
87 needle = (uint32_t *) bsearch(&hdrNum,
88 ts->removedPackages, ts->numRemovedPackages,
89 sizeof(*ts->removedPackages),
uintcmp);
93 *indexp = needle - ts->removedPackages;
98 if (ts->rbf == NULL) {
99 static size_t n = 10000;
100 static double e = 1.0e-4;
107 if (ts->numRemovedPackages == ts->allocedRemovedPackages) {
108 ts->allocedRemovedPackages += ts->delta;
110 ts->removedPackages = (uint32_t *)
xrealloc(ts->removedPackages,
111 sizeof(*ts->removedPackages) * ts->allocedRemovedPackages);
114 assert(ts->removedPackages != NULL);
115 xx =
rpmbfAdd(ts->rbf, &hdrNum,
sizeof(hdrNum));
117 ts->removedPackages[ts->numRemovedPackages] = hdrNum;
118 ts->numRemovedPackages++;
119 if (ts->numRemovedPackages > 1)
120 qsort(ts->removedPackages, ts->numRemovedPackages,
121 sizeof(*ts->removedPackages),
uintcmp);
123 if (ts->orderCount >= ts->orderAlloced) {
124 ts->orderAlloced += (ts->orderCount - ts->orderAlloced) + ts->delta;
126 ts->order = (
rpmte *)
xrealloc(ts->order,
sizeof(*ts->order) * ts->orderAlloced);
131 ts->order[ts->orderCount] = p;
134 *indexp = ts->orderCount;
153 const char *
one, * two;
165 rc = ((strcmp(one, two) == 0) ? 1 : 0);
166 else if (one && !two)
168 else if (!one && two)
213 const char * t =
rpmExpand(
"%{?_upgrade_tag}", NULL);
227 if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
233 if (xx && he->
p.
ui32p != NULL) {
234 if (p->originTid[0] == 0 || p->originTid[0] > he->
p.
ui32p[0]
235 || (he->
c > 1 && p->originTid[0] == he->
p.
ui32p[0] && p->originTid[1] > he->
p.
ui32p[1]))
237 p->originTid[0] = he->
p.
ui32p[0];
238 p->originTid[1] = (he->
c > 1 ? he->
p.
ui32p[1] : 0);
244 if (xx && he->
p.
ui32p != NULL) {
245 if (p->originTime[0] == 0 || p->originTime[0] > he->
p.
ui32p[0]
246 || (he->
c > 1 && p->originTime[0] == he->
p.
ui32p[0] && p->originTime[1] > he->
p.
ui32p[1]))
248 p->originTime[0] = he->
p.
ui32p[0];
249 p->originTime[1] = (he->
c > 1 ? he->
p.
ui32p[1] : 0);
254 #if defined(RPM_VENDOR_WINDRIVER)
261 if (tscolor && (!hcolor || !ohcolor)) {
266 arch = (xx && he->
p.
str != NULL ? he->
p.
str : NULL);
269 oharch = (xx && he->
p.
str != NULL ? he->
p.
str : NULL);
270 if (arch != NULL && oharch != NULL) {
271 if (strcmp(
"noarch", arch) || strcmp(
"noarch", oharch)) {
272 if (!_isCompatibleArch(arch, oharch)) {
274 oharch =
_free(oharch);
280 oharch =
_free(oharch);
291 assert(lastx >= 0 && lastx < ts->orderCount);
292 q = ts->order[lastx];
316 size_t flen = strlen(fn);
317 size_t slen = strlen(suffix);
318 return (flen > slen && !strcmp(fn + flen - slen, suffix));
335 const void *keyval = NULL;
339 Header debuginfoHeader = NULL;
346 const char * t =
rpmExpand(
"%{?_debuginfo_tag}", NULL);
356 default:
return 0;
break;
362 xx =
rpmmiPrune(mi, ts->removedPackages, ts->numRemovedPackages, 1);
370 if (!xx || he->
p.
str == NULL)
383 if (nrefs == 0 && debuginfoInstance > 0 && debuginfoHeader != NULL) {
391 assert(lastx >= 0 && lastx < ts->orderCount);
392 q = ts->order[lastx];
405 debuginfoHeader = NULL;
431 const char *t =
rpmExpand(
"%{?_obsolete_tag}", NULL);
440 if (obsoletes != NULL)
444 if ((Name =
rpmdsN(obsoletes)) == NULL)
454 if (tscolor && dscolor && !(tscolor & dscolor))
458 if (!strcmp(
rpmteN(p), Name))
467 xx =
rpmmiPrune(mi, ts->removedPackages, ts->numRemovedPackages, 1);
478 if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
492 assert(lastx >= 0 && lastx < ts->orderCount);
493 q = ts->order[lastx];
511 #if defined(RPM_VENDOR_WINDRIVER)
513 int _isCompatibleArch(
const char * arch,
const char * compat)
515 const char * compatArch =
rpmExpand(compat,
" %{?_", compat,
"_compat_arch}", NULL);
516 const char * p, * pe, * t;
520 if (arch[0] ==
'i' && arch[2] ==
'8' && arch[3] ==
'6') {
521 if ((arch[0] == compat[0]) &&
522 (arch[2] == compat[2]) &&
523 (arch[3] == compat[3]))
526 if (!strcmp(compat,
"x86_32"))
530 for ( p = pe = compatArch ; *pe && match == 0 ; ) {
532 pe = p ;
while (*pe && !
xisspace(*pe)) pe++;
535 t = strndup(p, (pe - p));
538 if (!strcmp(arch, t))
542 compatArch =
_free(compatArch);
557 const char * arch = NULL;
558 const char * os = NULL;
559 rpmds oldChk, newChk;
606 platform = he->
p.
str;
607 if (!xx || platform == NULL)
608 platform =
rpmExpand(arch,
"-unknown-", os, NULL);
612 #if defined(RPM_VENDOR_MANDRIVA)
619 platform =
_free(platform);
620 platform =
rpmExpand(arch,
"-unknown-", os, NULL);
628 assert(he->
p.
str != NULL);
631 platform, NULL, NULL, 0);
644 platform =
_free(platform);
678 if (arch == NULL || (parch =
rpmteA(p)) == NULL)
680 #if defined(RPM_VENDOR_WINDRIVER)
682 if (!_isCompatibleArch(arch, parch))
686 if (arch[0] ==
'i' && arch[2] ==
'8' && arch[3] ==
'6') {
687 if (arch[0] != parch[0])
continue;
688 if (arch[2] != parch[2])
continue;
689 if (arch[3] != parch[3])
continue;
692 else if (strcmp(arch, parch))
694 if (os == NULL || (pos =
rpmteO(p)) == NULL)
712 _(
"package %s was already added, skipping %s\n"),
713 (pkgNEVR ? pkgNEVR + 2 :
"?pkgNEVR?"),
714 (addNEVR ? addNEVR + 2 :
"?addNEVR?"));
726 _(
"package %s was already added, replacing with %s\n"),
727 (pkgNEVR ? pkgNEVR + 2 :
"?pkgNEVR?"),
728 (addNEVR ? addNEVR + 2 :
"?addNEVR?"));
745 if (oc >= ts->orderAlloced) {
746 ts->orderAlloced += (oc - ts->orderAlloced) + ts->delta;
748 ts->order = (
rpmte *)
xrealloc(ts->order, ts->orderAlloced *
sizeof(*ts->order));
755 if (duplicate && oc < ts->orderCount) {
758 ts->order[oc] =
rpmteFree(ts->order[oc]);
773 ts->order[oc] =
rpmteFree(ts->order[oc]);
774 ts->teInstall = NULL;
781 ts->numAddedPackages++;
784 ts->teInstall = ts->order[oc];
791 if (!(upgrade & 0x1))
838 if (rc == 0 && oc >= 0 && oc < ts->orderCount) {
840 ts->teErase = ts->order[oc];
873 sysinfo_path =
_free(sysinfo_path);
896 #if defined(CACHE_DEPENDENCY_RESULT)
897 int _cacheThisRC = 1;
903 if ((Name =
rpmdsN(dep)) == NULL)
908 #if defined(CACHE_DEPENDENCY_RESULT)
922 DBC * dbcursor = NULL;
925 size_t DNEVRlen = strlen(DNEVR);
927 xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, 0);
929 memset(key, 0,
sizeof(*key));
930 key->
data = (
void *) DNEVR;
931 key->
size = DNEVRlen;
932 memset(data, 0,
sizeof(*data));
934 data->
size = datalen;
936 xx = dbiGet(dbi, dbcursor, key, data,
DB_SET);
938 DNEVR = (
char *) key->
data;
939 DNEVRlen = key->
size;
941 datalen = data->
size;
943 if (xx == 0 && datap && datalen == 4)
944 memcpy(&rc, datap, datalen);
945 xx = dbiCclose(dbi, dbcursor, 0);
963 if (Flags & RPMSENSE_MISSINGOK)
973 s = Name;
while (*s &&
xisdigit(*s)) s++;
978 uid = strtol(Name, NULL, 10);
981 rc = (xx >= 0 ? 0 : 1);
982 if (Flags & RPMSENSE_MISSINGOK)
990 s = Name;
while (*s &&
xisdigit(*s)) s++;
995 gid = strtol(Name, NULL, 10);
998 rc = (xx >= 0 ? 0 : 1);
999 if (Flags & RPMSENSE_MISSINGOK)
1008 if (Flags & RPMSENSE_MISSINGOK)
1016 const char ** fs = NULL;
1021 fs = ts->filesystems;
1022 nfs = ts->filesystemCount;
1025 for (i = 0; i < nfs; i++) {
1026 if (!strcmp(fs[i], Name))
1029 rc = (i < nfs ? 0 : 1);
1030 if (Flags & RPMSENSE_MISSINGOK)
1037 size_t nb = strlen(Name);
1038 rpmDiskSpaceInfo dsi = NULL;
1039 const char ** fs = NULL;
1040 size_t fslen = 0, longest = 0;
1045 fs = ts->filesystems;
1046 nfs = ts->filesystemCount;
1049 for (i = 0; i < nfs; i++) {
1050 fslen = strlen(fs[i]);
1053 if (strncmp(fs[i], Name, fslen))
1055 if (fslen > 1 && Name[fslen] !=
'/' && Name[fslen] !=
'\0')
1057 if (fslen < longest)
1071 if (strchr(
"Gg", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1072 needed *= 1024 * 1024 * 1024;
1073 if (strchr(
"Mm", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1074 needed *= 1024 * 1024;
1075 if (strchr(
"Kk", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1078 needed *= 1024 * 1024;
1080 needed = BLOCK_ROUND(needed, dsi->f_bsize);
1081 xx = (dsi->f_bavail - needed);
1087 if (Flags & RPMSENSE_MISSINGOK)
1095 const char *filename;
1103 if ((cp = (
char *) strchr(filename,
':')) != NULL) {
1105 digestHashAlgo = algo;
1110 fd =
Fopen(filename,
"r.fdio");
1113 const char * digest = NULL;
1114 size_t digestlen = 0;
1116 size_t nbuf = 8 * BUFSIZ;
1117 char * buf = (
char *)
alloca(nbuf);
1120 while ((nb =
Fread(buf,
sizeof(buf[0]), nbuf, fd)) > 0)
1122 xx =
Fclose(fd); fd = NULL;
1125 xx = (EVR && *EVR && digest && *digest) ? strcasecmp(EVR, digest) : -1;
1129 if (Flags & RPMSENSE_MISSINGOK)
1153 if (Flags & RPMSENSE_MISSINGOK)
1167 if (!strcmp(Name,
"*"))
1169 else if (Name[0] ==
'/')
1174 if (!(Name[0] ==
'/' || !strcmp(Name,
"*")))
1184 if (Flags & RPMSENSE_MISSINGOK)
1192 if (!(EVR && *EVR)) {
1193 static const char gnupg_pre[] =
"%(%{__gpg} --batch --no-tty --quiet --verify ";
1194 static const char gnupg_post[] =
" 2>/dev/null; echo $?)";
1195 const char * t =
rpmExpand(gnupg_pre, Name, gnupg_post, NULL);
1196 rc = (t && t[0] ==
'0') ? 0 : 1;
1200 static const char gnupg_pre[] =
"%(%{__gpg} --batch --no-tty --quiet --verify ";
1201 static const char gnupg_post[] =
" 2>&1 | grep '^Primary key fingerprint:' | sed -e 's;^.*: *;;' -e 's; *;;g')";
1202 const char * t =
rpmExpand(gnupg_pre, Name, gnupg_post, NULL);
1203 rc = ((Flags &
RPMSENSE_EQUAL) && strcasecmp(EVR, t) == 0) ? 0 : 1;
1206 if (Flags & RPMSENSE_MISSINGOK)
1213 static const char macro_pre[] =
"%{?";
1214 static const char macro_post[] =
":0}";
1215 const char * a =
rpmExpand(macro_pre, Name, macro_post, NULL);
1217 rc = (a && a[0] ==
'0') ? 0 : 1;
1219 if (Flags & RPMSENSE_MISSINGOK)
1226 const char * a =
envGet(Name);
1233 int sense = (a && *a) ? strcmp(a, b) : -1;
1247 if (Flags & RPMSENSE_MISSINGOK)
1255 pid_t pid = strtol(Name, &t, 10);
1257 if (t == NULL || *t !=
'\0') {
1258 const char * fn =
rpmGetPath(
"%{_varrun}/", Name,
".pid", NULL);
1261 if (fn && *fn !=
'%' && (fd =
Fopen(fn,
"r.fdio")) && !
Ferror(fd)) {
1263 size_t nb =
Fread(buf,
sizeof(buf[0]),
sizeof(buf), fd);
1266 pid = strtol(buf, &t, 10);
1273 rc = (pid > 0 ? (kill(pid, 0) < 0 &&
errno == ESRCH) : 1);
1274 if (Flags & RPMSENSE_MISSINGOK)
1296 if (Flags & RPMSENSE_MISSINGOK)
1317 if (Flags & RPMSENSE_MISSINGOK)
1324 if (sysinfo_path == NULL) {
1325 sysinfo_path =
rpmExpand(
"%{?_rpmds_sysinfo_path}", NULL);
1326 if (!(sysinfo_path != NULL && *sysinfo_path ==
'/')) {
1327 sysinfo_path =
_free(sysinfo_path);
1351 static int oneshot = -1;
1355 if (rpmlibP == NULL)
1366 static int oneshot = -1;
1368 if (oneshot && cpuinfoP == NULL)
1370 if (cpuinfoP == NULL)
1381 static int oneshot = -1;
1385 if (getconfP == NULL)
1396 static int oneshot = -1;
1411 rpmds sonameP = NULL;
1413 char * fn = strcpy((
char *)
alloca(strlen(Name)+1), Name);
1420 fn[strlen(fn)-1] =
'\0';
1425 if (!(xx == 0 && sonameP != NULL))
1445 #if defined(CACHE_DEPENDENCY_RESULT)
1459 if (Name[0] ==
'/' && Name[1] ==
'\0') {
1463 if (Name[0] ==
'/') {
1466 ts->removedPackages, ts->numRemovedPackages, 1);
1477 ts->removedPackages, ts->numRemovedPackages, 1);
1492 if (ts->solve != NULL) {
1493 xx = (*ts->solve) (ts, dep, ts->solveData);
1505 if (Flags & RPMSENSE_MISSINGOK) {
1507 #if defined(CACHE_DEPENDENCY_RESULT)
1520 #if defined(CACHE_DEPENDENCY_RESULT)
1530 DBC * dbcursor = NULL;
1531 size_t DNEVRlen = strlen(DNEVR);
1535 memset(key, 0,
sizeof(*key));
1536 key->
data = (
void *) DNEVR;
1537 key->
size = DNEVRlen;
1538 memset(data, 0,
sizeof(*data));
1540 data->
size =
sizeof(rc);
1543 xx = dbiPut(dbi, dbcursor, key, data, 0);
1574 const char * depName,
1589 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_VENDOR_PLD) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS)
1595 if (requires != NULL)
1596 while (ourrc < terminate &&
rpmdsNext(requires) >= 0) {
1598 if ((Name =
rpmdsN(requires)) == NULL)
1602 if (depName != NULL && strcmp(depName, Name))
1612 if (tscolor && dscolor && !(tscolor & dscolor))
1621 {
fnpyKey * suggestedKeys = NULL;
1623 if (ts->availablePackages != NULL) {
1628 rpmdsProblem(ps, pkgNEVRA, requires, suggestedKeys, adding);
1641 if (conflicts != NULL)
1642 while (ourrc < terminate &&
rpmdsNext(conflicts) >= 0) {
1644 if ((Name =
rpmdsN(conflicts)) == NULL)
1648 if (depName != NULL && strcmp(depName, Name))
1658 if (tscolor && dscolor && !(tscolor & dscolor))
1678 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_VENDOR_PLD) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS)
1679 dirname_deps =
rpmExpandNumeric(
"%{?_check_dirname_deps}%{?!_check_dirname_deps:1}");
1683 if (dirnames != NULL)
1684 while (ourrc < terminate &&
rpmdsNext(dirnames) >= 0) {
1686 if ((Name =
rpmdsN(dirnames)) == NULL)
1690 if (depName != NULL && strcmp(depName, Name))
1700 if (tscolor && dscolor && !(tscolor & dscolor))
1709 {
fnpyKey * suggestedKeys = NULL;
1711 if (ts->availablePackages != NULL) {
1716 rpmdsProblem(ps, pkgNEVRA, dirnames, suggestedKeys, adding);
1727 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_VENDOR_PLD) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS)
1730 symlink_deps =
rpmExpandNumeric(
"%{?_check_symlink_deps}%{?!_check_symlink_deps:1}");
1734 if (linktos != NULL)
1735 while (ourrc < terminate &&
rpmdsNext(linktos) >= 0) {
1737 if ((Name =
rpmdsN(linktos)) == NULL)
1743 if (depName != NULL && strcmp(depName, Name))
1753 if (tscolor && dscolor && !(tscolor & dscolor))
1762 {
fnpyKey * suggestedKeys = NULL;
1764 if (ts->availablePackages != NULL) {
1769 rpmdsProblem(ps, pkgNEVRA, linktos, suggestedKeys, adding);
1780 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_VENDOR_PLD) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS)
1799 rpmmi mi,
int adding)
1812 ts->removedPackages, ts->numRemovedPackages, 1);
1813 while (ourrc < terminate && (h =
rpmmiNext(mi)) != NULL) {
1814 rpmds requires = NULL;
1815 rpmds conflicts = NULL;
1816 rpmds dirnames = NULL;
1817 rpmds linktos = NULL;
1824 if (ourrc >= terminate) {
1844 requires, conflicts, dirnames, linktos,
1845 depName, depNS, tscolor, adding);
1910 const char * depName = NULL;
1915 int closeatexit = 0;
1922 fprintf(stderr,
"--> %s(%p) tsFlags 0x%x\n", __FUNCTION__, ts,
rpmtsFlags(ts));
1929 closeatexit = (rc == 0);
1931 if (rc && (ourrc = rc) >= terminate)
1944 rpmds provides, requires, conflicts, dirnames, linktos;
1967 requires, conflicts, dirnames, linktos,
1969 if (rc && (ourrc = rc) >= terminate)
1974 if (provides != NULL)
1975 while (ourrc < terminate &&
rpmdsNext(provides) >= 0) {
1976 depName =
_free(depName);
1981 const char * EVR =
rpmdsEVR(provides);
1984 if (
envPut(depName, EVR));
1993 if (rc && (ourrc = rc) >= terminate)
1998 while (ourrc < terminate &&
rpmfiNext(fi) >= 0) {
1999 depName =
_free(depName);
2005 if (rc && (ourrc = rc) >= terminate)
2009 if (rc && (ourrc = rc) >= terminate)
2027 if (provides != NULL)
2028 while (ourrc < terminate &&
rpmdsNext(provides) >= 0) {
2029 depName =
_free(depName);
2036 if (rc && (ourrc = rc) >= terminate)
2041 while (ourrc < terminate &&
rpmfiNext(fi) >= 0) {
2042 depName =
_free(depName);
2048 if (rc && (ourrc = rc) >= terminate)
2052 if (rc && (ourrc = rc) >= terminate)
2058 {
const char * tsNEVRA =
"transaction dependencies";
2063 const char * dep = NULL;
2068 if (rc && (ourrc = rc) >= terminate)
2074 depName =
_free(depName);
2080 #if defined(CACHE_DEPENDENCY_RESULT)
rpmds rpmdsSingle(rpmTag tagN, const char *N, const char *EVR, evrFlags Flags)
Create, load and initialize a dependency set of size 1.
static const char * suffix[]
int rpmmiPrune(rpmmi mi, uint32_t *hdrNums, int nHdrNums, int sorted)
Remove items from set of package instances to iterate.
evrFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
int rpmteChain(rpmte p, rpmte q, Header oh, const char *msg)
Chain p <-> q forward/backward transaction element links.
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
enum rpmQueryFlags_e rpmQueryFlags
Bit(s) to control rpmQuery() operation, stored in qva_flags.
rpmuint32_t rpmteColor(rpmte te)
Retrieve color bits of transaction element.
rpmPRCO rpmdsFreePRCO(rpmPRCO PRCO)
Free dependency set(s) container.
rpmtime_t rpmswExit(rpmop op, ssize_t rc)
Exit timed operation.
nsType rpmdsNSType(const rpmds ds)
Return dependency class type.
enum nsType_e nsType
Dependency types.
const char * rpmProblemString(const rpmProblem prob)
Return formatted string representation of a problem.
const char bson_timestamp_t * ts
void rpmdsProblem(rpmps ps, const char *pkgNEVR, const rpmds ds, const fnpyKey *suggestedKeys, int adding)
Report a Requires: or Conflicts: dependency problem.
rpmProblem rpmpsGetProblem(rpmps ps, int num)
Return a problem from problem set.
rpmte rpmteFree(rpmte te)
Destroy a transaction element.
#define RPMSENSE_SENSEMASK
const char * rpmteSourcerpm(rpmte te)
Retrieve sourcerpm string from transaction element.
void rpmpsAppend(rpmps ps, rpmProblemType type, const char *pkgNEVR, fnpyKey key, const char *dn, const char *bn, const char *altNEVR, rpmuint64_t ulong1)
Append a problem to current set of problems.
rpmbf rpmbfNew(size_t m, size_t k, unsigned flags)
Create a Bloom filter.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
Structures used for an "rpmte" transaction element.
static rpmTag _debuginfo_tag
char * xstrdup(const char *str)
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.
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest context.
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
rpmuint32_t hGetColor(Header h)
Return header color.
int rpmdsGetconf(rpmds *dsp, const char *path)
Load getconf provides into a dependency set.
Structure(s) used for file info tag sets.
static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
Check dep for an unsatisfied dependency.
int rpmPlatformScore(const char *platform, void *mi_re, int mi_nre)
Return score of a platform string.
enum pgpHashAlgo_e pgpHashAlgo
9.4.
char * gidToGname(gid_t gid)
alKey rpmalAdd(rpmal *alistp, alKey pkgKey, fnpyKey key, rpmds provides, rpmfi fi, rpmuint32_t tscolor)
Add package to available list.
const char * rpmteN(rpmte te)
Retrieve name string of transaction element.
rpmTag rpmdsTagN(const rpmds ds)
Return current dependency type.
static const char * envGet(const char *name)
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
static char * sysinfo_path
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
struct rpmtsi_s * rpmtsi
Transaction element iterator.
static void rpmlog(int code, const char *fmt,...)
struct rpmps_s * rpmps
Transaction problems found while processing a transaction set/.
rpmElementType rpmteType(rpmte te)
Retrieve type of transaction element.
rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet, int running, rpmte rbte)
Rollback a failed transaction.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
const char * rpmteA(rpmte te)
Retrieve arch string of transaction element.
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
rpmPRCO rpmtsPRCO(rpmts ts)
Get transaction set dependencies.
struct rpmPRCO_s * rpmPRCO
Container for commonly extracted dependency set(s).
rpmds rpmteDS(rpmte te, rpmTag tag)
Retrieve dependency tag set from transaction element.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
static int uintcmp(const void *a, const void *b)
Compare removed package instances (qsort/bsearch).
static int checkDependentConflicts(rpmts ts, const char *depName, nsType depNS)
Check to-be-added dependencies against installed conflicts.
Command line option information.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
static int rpmtsAddObsoletes(rpmts ts, rpmte p, rpmuint32_t hcolor)
Add Obsoletes: erasures to a transaction set.
struct rpmte_s * rpmte
An element of a transaction set, i.e.
static int removePackage(rpmts ts, Header h, uint32_t hdrNum, int *indexp, alKey depends)
Add removed package instance to ordered transaction set.
int rpmtsInitDSI(const rpmts ts)
Initialize disk space info for each and every mounted file systems.
int rpmpsNumProblems(rpmps ps)
Return number of problems in set.
enum evrFlags_e evrFlags
Dependency Attributes.
void rpmbfParams(size_t n, double e, size_t *mp, size_t *kp)
Return optimal {m, k} for given n and e.
alKey rpmteSetAddedKey(rpmte te, alKey npkgKey)
rpmPRCO rpmdsNewPRCO(Header h)
Create dependency set(s) container.
#define RPMSENSE_NOTEQUAL
enum rpmElementType_e rpmElementType
Transaction element type.
int _rpmtsCheck(rpmts ts)
const char * rpmteNEVR(rpmte te)
Retrieve name-version-release string from transaction element.
void rpmnsClean(void)
Clean global name space dependency sets.
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
rpmRC rpmnsProbeSignature(void *_ts, const char *fn, const char *sigfn, const char *pubfn, const char *pubid, int flags)
Verify OpenPGP signature on a file.
alKey rpmteAddedKey(rpmte te)
static int checkPackageSet(rpmts ts, const char *depName, nsType depNS, rpmmi mi, int adding)
Check dependency against installed packages.
rpmfi rpmteFI(rpmte te, rpmTag tag)
Retrieve file info tag set from transaction element.
int gnameToGid(const char *thisGname, gid_t *gid)
int rpmdsRpmlib(rpmds *dsp, void *tblp)
Load rpmlib provides into a dependency set.
static int rpmtsEraseDebuginfo(rpmts ts, rpmte p, Header h, alKey pkgKey)
Add unreferenced debuginfo erasures to a transaction set.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
int rpmdsCompare(const rpmds A, const rpmds B)
Compare two versioned dependency ranges, looking for overlap.
static int rpmHeadersIdentical(Header first, Header second)
Are two headers identical?
const char const bson * data
enum rpmdepFlags_e rpmdepFlags
Bit(s) to control rpmtsCheck() and rpmtsOrder() operation.
static int xisspace(int c)
unsigned long long rpmuint64_t
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
void rpmdsNotify(rpmds ds, const char *where, int rc)
Notify of results of dependency match.
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
int rpmioAccess(const char *FN, const char *path, int mode)
Check FN access, expanding relative paths and twiddles.
static rpmTag _obsolete_tag
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
Structure(s) used for dependency tag sets.
int rpmdbCloseDBI(rpmdb db, int tag)
Close a single database index.
The FD_t File Handle data structure.
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
const char * rpmteNEVRA(rpmte te)
Retrieve name-version-release.arch string from transaction element.
int argvAdd(ARGV_t *argvp, ARGstr_t val)
Add a string to an argv array.
Header headerFree(Header h)
Dereference a header instance.
int rpmswEnter(rpmop op, ssize_t rc)
Enter timed operation.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
pgpHashAlgo pgpHashAlgoStringToNumber(const char *name, size_t name_len)
Convert a hash algorithm "foo" to the internal PGPHASHALGO_FOO number.
void * alKey
An added/available package retrieval key.
size_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd)
fread(3) clone.
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
const char * rpmteO(rpmte te)
Retrieve os string of transaction element.
static int envPut(const char *name, const char *value)
Header rpmteSetHeader(rpmte te, Header h)
Save header into transaction element.
const char * rpmdsN(const rpmds ds)
Return current dependency name.
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
int Fclose(FD_t fd)
fclose(3) clone.
const char const bson int mongo_write_concern int flags
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
Display results of package verify.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
Header headerLink(Header h)
Reference a header instance.
#define CACHE_DEPENDENCY_RESULT
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
const char * _sysinfo_path
fnpyKey rpmteKey(rpmte te)
Retrieve key from transaction element.
enum rpmRC_e rpmRC
RPM return codes.
int Ferror(FD_t fd)
ferror(3) clone.
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
rpmuint32_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
static int xisdigit(int c)
rpmdepFlags rpmtsDFlags(rpmts ts)
Get dependency flags, i.e.
const char const bson * key
fnpyKey rpmalSatisfiesDepend(const rpmal al, const rpmds ds, alKey *keyp)
Check added package file lists for first package that has a provide.
rpmds rpmdsLink(rpmds ds, const char *msg)
Reference a dependency set instance.
dbiIndex dbiOpen(rpmdb db, rpmTag tag, unsigned int flags)
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
struct rpmts_s * rpmts
The RPM Transaction Set.
struct rpmQVKArguments_s * QVA_t
static int checkDependentPackages(rpmts ts, const char *depName, nsType depNS)
Check to-be-erased dependencies against installed requires.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
char * uidToUname(uid_t uid)
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
int rpmdsCpuinfo(rpmds *dsp, const char *fn)
Load /proc/cpuinfo provides into a dependency set.
static int rpmtsAddUpgrades(rpmts ts, rpmte p, rpmuint32_t hcolor, Header h)
Add upgrade erasures to a transaction set.
static int chkSuffix(const char *fn, const char *suffix)
Check string for a suffix.
int rpmdsUname(rpmds *dsp, const struct utsname *un)
int rpmtsAddEraseElement(rpmts ts, Header h, uint32_t hdrNum)
Add package to be erased to transaction set.
int rpmbfAdd(rpmbf bf, const void *_s, size_t ns)
Add item to a Bloom filter.
int(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
static int checkPackageDeps(rpmts ts, const char *pkgNEVRA, rpmds requires, rpmds conflicts, rpmds dirnames, rpmds linktos, const char *depName, nsType depNS, rpmuint32_t tscolor, int adding)
Check added requires/conflicts against against installed+added packages.
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.
void rpmalMakeIndex(rpmal al)
Generate index for available list.
int rpmdsMergePRCO(void *context, rpmds ds)
Merge provides/requires/conflicts/obsoletes dependencies.
static rpmTag _upgrade_tag
rpmuint32_t rpmdsColor(const rpmds ds)
Return current dependency color.
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
fnpyKey * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, alKey *keyp)
Check added package file lists for package(s) that have a provide.
int rpmDigestFinal(DIGEST_CTX ctx, void *datap, size_t *lenp, int asAscii)
Return digest and destroy context.
int rpmdsELF(const char *fn, int flags, int(*add)(void *context, rpmds ds), void *context)
Return a soname dependency constructed from an elf string.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
Access RPM indices using Berkeley DB interface(s).
int unameToUid(const char *thisUname, uid_t *uid)
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
Create and load a dependency set.
int rpmdsSetNoPromote(rpmds ds, int nopromote)
Set "Don't promote Epoch:" flag.
rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type, fnpyKey key, rpmRelocation relocs, uint32_t dboffset, alKey pkgKey)
Create a transaction element.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
static const char * platform
int rpmtsDBMode(rpmts ts)
Retrieve dbmode of transaction set.
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmds rpmdsThis(Header h, rpmTag tagN, evrFlags Flags)
Create, load and initialize a dependency for this header.
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API's.
int rpmdsNegateRC(const rpmds ds, int rc)
Negate return code for negated comparisons.
int rpmteIsSource(rpmte te)
Retrieve isSource attribute of transaction element.
struct _dbiIndex * dbiIndex
rpmds rpmdsFromPRCO(rpmPRCO PRCO, rpmTag tagN)
Retrieve a dependency set from container.