16 #define _RPMDB_INTERNAL 19 #define _RPMEVR_INTERNAL 23 #define _RPMTE_INTERNAL 25 #define _RPMTS_INTERNAL 35 #define CACHE_DEPENDENCY_RESULT 1 36 #if defined(CACHE_DEPENDENCY_RESULT) 56 static int uintcmp(
const void * a,
const void * b)
59 const uint32_t * aptr = (
const uint32_t *) a;
60 const uint32_t * bptr = (
const uint32_t *) b;
64 else if (*aptr < *bptr)
90 if (ts->numRemovedPackages > 0 && ts->removedPackages != NULL) {
91 uint32_t * needle = NULL;
92 needle = (uint32_t *) bsearch(&hdrNum,
93 ts->removedPackages, ts->numRemovedPackages,
94 sizeof(*ts->removedPackages),
uintcmp);
98 *indexp = needle - ts->removedPackages;
103 if (ts->rbf == NULL) {
104 static size_t n = 10000;
105 static double e = 1.0e-4;
108 rpmbfParams(n, e, &m, &k);
109 ts->rbf = rpmbfNew(m, k, 0);
112 if (ts->numRemovedPackages == ts->allocedRemovedPackages) {
113 ts->allocedRemovedPackages += ts->delta;
115 ts->removedPackages = (uint32_t *)
xrealloc(ts->removedPackages,
116 sizeof(*ts->removedPackages) * ts->allocedRemovedPackages);
119 assert(ts->removedPackages != NULL);
120 xx = rpmbfAdd(ts->rbf, &hdrNum,
sizeof(hdrNum));
122 ts->removedPackages[ts->numRemovedPackages] = hdrNum;
123 ts->numRemovedPackages++;
124 if (ts->numRemovedPackages > 1)
125 qsort(ts->removedPackages, ts->numRemovedPackages,
126 sizeof(*ts->removedPackages),
uintcmp);
128 if (ts->orderCount >= ts->orderAlloced) {
129 ts->orderAlloced += (ts->orderCount - ts->orderAlloced) + ts->delta;
131 ts->order = (
rpmte *)
xrealloc(ts->order,
sizeof(*ts->order) * ts->orderAlloced);
136 ts->order[ts->orderCount] = p;
139 *indexp = ts->orderCount;
158 const char * one, * two;
170 rc = ((strcmp(one, two) == 0) ? 1 : 0);
171 else if (one && !two)
173 else if (!one && two)
218 const char * t =
rpmExpand(
"%{?_upgrade_tag}", NULL);
232 if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
238 if (xx && he->
p.
ui32p != NULL) {
239 if (p->originTid[0] == 0 || p->originTid[0] > he->
p.
ui32p[0]
240 || (he->
c > 1 && p->originTid[0] == he->
p.
ui32p[0] && p->originTid[1] > he->
p.
ui32p[1]))
242 p->originTid[0] = he->
p.
ui32p[0];
243 p->originTid[1] = (he->
c > 1 ? he->
p.
ui32p[1] : 0);
249 if (xx && he->
p.
ui32p != NULL) {
250 if (p->originTime[0] == 0 || p->originTime[0] > he->
p.
ui32p[0]
251 || (he->
c > 1 && p->originTime[0] == he->
p.
ui32p[0] && p->originTime[1] > he->
p.
ui32p[1]))
253 p->originTime[0] = he->
p.
ui32p[0];
254 p->originTime[1] = (he->
c > 1 ? he->
p.
ui32p[1] : 0);
259 #if defined(RPM_VENDOR_WINDRIVER) 266 if (tscolor && (!hcolor || !ohcolor)) {
271 arch = (xx && he->
p.
str != NULL ? he->
p.
str : NULL);
274 oharch = (xx && he->
p.
str != NULL ? he->
p.
str : NULL);
275 if (arch != NULL && oharch != NULL) {
276 if (strcmp(
"noarch", arch) || strcmp(
"noarch", oharch)) {
277 if (!_isCompatibleArch(arch, oharch)) {
279 oharch =
_free(oharch);
285 oharch =
_free(oharch);
296 assert(lastx >= 0 && lastx < ts->orderCount);
297 q = ts->order[lastx];
321 size_t flen = strlen(fn);
322 size_t slen = strlen(suffix);
323 return (flen > slen && !strcmp(fn + flen - slen, suffix));
340 const void *keyval = NULL;
344 Header debuginfoHeader = NULL;
351 const char * t =
rpmExpand(
"%{?_debuginfo_tag}", NULL);
361 default:
return 0;
break;
367 xx =
rpmmiPrune(mi, ts->removedPackages, ts->numRemovedPackages, 1);
375 if (!xx || he->
p.
str == NULL)
388 if (nrefs == 0 && debuginfoInstance > 0 && debuginfoHeader != NULL) {
396 assert(lastx >= 0 && lastx < ts->orderCount);
397 q = ts->order[lastx];
410 debuginfoHeader = NULL;
436 const char *t =
rpmExpand(
"%{?_obsolete_tag}", NULL);
445 if (obsoletes != NULL)
449 if ((Name =
rpmdsN(obsoletes)) == NULL)
459 if (tscolor && dscolor && !(tscolor & dscolor))
463 if (!strcmp(
rpmteN(p), Name))
472 xx =
rpmmiPrune(mi, ts->removedPackages, ts->numRemovedPackages, 1);
483 if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
497 assert(lastx >= 0 && lastx < ts->orderCount);
498 q = ts->order[lastx];
516 #if defined(RPM_VENDOR_WINDRIVER) 518 int _isCompatibleArch(
const char * arch,
const char * compat)
520 const char * compatArch =
rpmExpand(compat,
" %{?_", compat,
"_compat_arch}", NULL);
521 const char * p, * pe, * t;
525 if (arch[0] ==
'i' && arch[2] ==
'8' && arch[3] ==
'6') {
526 if ((arch[0] == compat[0]) &&
527 (arch[2] == compat[2]) &&
528 (arch[3] == compat[3]))
531 if (!strcmp(compat,
"x86_32"))
535 for ( p = pe = compatArch ; *pe && match == 0 ; ) {
537 pe = p ;
while (*pe && !
xisspace(*pe)) pe++;
540 t = strndup(p, (pe - p));
543 if (!strcmp(arch, t))
547 compatArch =
_free(compatArch);
562 const char * arch = NULL;
563 const char * os = NULL;
564 rpmds oldChk, newChk;
611 platform = he->
p.
str;
612 if (!xx || platform == NULL)
613 platform =
rpmExpand(arch,
"-unknown-", os, NULL);
617 #if defined(RPM_VENDOR_MANDRIVA) 624 platform =
_free(platform);
625 platform =
rpmExpand(arch,
"-unknown-", os, NULL);
633 assert(he->
p.
str != NULL);
636 platform, NULL, NULL, 0);
649 platform =
_free(platform);
683 if (arch == NULL || (parch =
rpmteA(p)) == NULL)
685 #if defined(RPM_VENDOR_WINDRIVER) 687 if (!_isCompatibleArch(arch, parch))
691 if (arch[0] ==
'i' && arch[2] ==
'8' && arch[3] ==
'6') {
692 if (arch[0] != parch[0])
continue;
693 if (arch[2] != parch[2])
continue;
694 if (arch[3] != parch[3])
continue;
697 else if (strcmp(arch, parch))
699 if (os == NULL || (pos =
rpmteO(p)) == NULL)
717 _(
"package %s was already added, skipping %s\n"),
718 (pkgNEVR ? pkgNEVR + 2 :
"?pkgNEVR?"),
719 (addNEVR ? addNEVR + 2 :
"?addNEVR?"));
731 _(
"package %s was already added, replacing with %s\n"),
732 (pkgNEVR ? pkgNEVR + 2 :
"?pkgNEVR?"),
733 (addNEVR ? addNEVR + 2 :
"?addNEVR?"));
750 if (oc >= ts->orderAlloced) {
751 ts->orderAlloced += (oc - ts->orderAlloced) + ts->delta;
753 ts->order = (
rpmte *)
xrealloc(ts->order, ts->orderAlloced *
sizeof(*ts->order));
760 if (duplicate && oc < ts->orderCount) {
763 ts->order[oc] =
rpmteFree(ts->order[oc]);
778 ts->order[oc] =
rpmteFree(ts->order[oc]);
779 ts->teInstall = NULL;
786 ts->numAddedPackages++;
789 ts->teInstall = ts->order[oc];
796 if (!(upgrade & 0x1))
843 if (rc == 0 && oc >= 0 && oc < ts->orderCount) {
845 ts->teErase = ts->order[oc];
901 #if defined(CACHE_DEPENDENCY_RESULT) 902 int _cacheThisRC = 1;
908 if ((Name =
rpmdsN(dep)) == NULL)
913 #if defined(CACHE_DEPENDENCY_RESULT) 927 DBC * dbcursor = NULL;
930 size_t DNEVRlen = strlen(DNEVR);
932 xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, 0);
934 memset(key, 0,
sizeof(*key));
935 key->
data = (
void *) DNEVR;
936 key->
size = DNEVRlen;
937 memset(data, 0,
sizeof(*data));
939 data->
size = datalen;
941 xx = dbiGet(dbi, dbcursor, key, data,
DB_SET);
943 DNEVR = (
char *) key->
data;
944 DNEVRlen = key->
size;
946 datalen = data->
size;
948 if (xx == 0 && datap && datalen == 4)
949 memcpy(&rc, datap, datalen);
950 xx = dbiCclose(dbi, dbcursor, 0);
968 if (Flags & RPMSENSE_MISSINGOK)
978 s = Name;
while (*s &&
xisdigit(*s)) s++;
983 uid = strtol(Name, NULL, 10);
986 rc = (xx >= 0 ? 0 : 1);
987 if (Flags & RPMSENSE_MISSINGOK)
995 s = Name;
while (*s &&
xisdigit(*s)) s++;
1000 gid = strtol(Name, NULL, 10);
1003 rc = (xx >= 0 ? 0 : 1);
1004 if (Flags & RPMSENSE_MISSINGOK)
1013 if (Flags & RPMSENSE_MISSINGOK)
1021 const char ** fs = NULL;
1026 fs = ts->filesystems;
1027 nfs = ts->filesystemCount;
1030 for (i = 0; i < nfs; i++) {
1031 if (!strcmp(fs[i], Name))
1034 rc = (i < nfs ? 0 : 1);
1035 if (Flags & RPMSENSE_MISSINGOK)
1042 size_t nb = strlen(Name);
1043 rpmDiskSpaceInfo dsi = NULL;
1044 const char ** fs = NULL;
1045 size_t fslen = 0, longest = 0;
1050 fs = ts->filesystems;
1051 nfs = ts->filesystemCount;
1054 for (i = 0; i < nfs; i++) {
1055 fslen = strlen(fs[i]);
1058 if (strncmp(fs[i], Name, fslen))
1060 if (fslen > 1 && Name[fslen] !=
'/' && Name[fslen] !=
'\0')
1062 if (fslen < longest)
1076 if (strchr(
"Gg", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1077 needed *= 1024 * 1024 * 1024;
1078 if (strchr(
"Mm", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1079 needed *= 1024 * 1024;
1080 if (strchr(
"Kk", end[0]) && strchr(
"Bb", end[1]) && !end[2])
1083 needed *= 1024 * 1024;
1085 needed = BLOCK_ROUND(needed, dsi->f_bsize);
1086 xx = (dsi->f_bavail - needed);
1092 if (Flags & RPMSENSE_MISSINGOK)
1100 const char *filename;
1108 if ((cp = (
char *) strchr(filename,
':')) != NULL) {
1110 digestHashAlgo = algo;
1115 fd =
Fopen(filename,
"r.fdio");
1118 const char * digest = NULL;
1119 size_t digestlen = 0;
1121 size_t nbuf = 8 * BUFSIZ;
1122 char * buf = (
char *)
alloca(nbuf);
1125 while ((nb =
Fread(buf,
sizeof(buf[0]), nbuf, fd)) > 0)
1127 xx =
Fclose(fd); fd = NULL;
1130 xx = (EVR && *EVR && digest && *digest) ? strcasecmp(EVR, digest) : -1;
1134 if (Flags & RPMSENSE_MISSINGOK)
1158 if (Flags & RPMSENSE_MISSINGOK)
1172 if (!strcmp(Name,
"*"))
1174 else if (Name[0] ==
'/')
1179 if (!(Name[0] ==
'/' || !strcmp(Name,
"*")))
1189 if (Flags & RPMSENSE_MISSINGOK)
1197 if (!(EVR && *EVR)) {
1198 static const char gnupg_pre[] =
"%(%{__gpg} --batch --no-tty --quiet --verify ";
1199 static const char gnupg_post[] =
" 2>/dev/null; echo $?)";
1200 const char * t =
rpmExpand(gnupg_pre, Name, gnupg_post, NULL);
1201 rc = (t && t[0] ==
'0') ? 0 : 1;
1205 static const char gnupg_pre[] =
"%(%{__gpg} --batch --no-tty --quiet --verify ";
1206 static const char gnupg_post[] =
" 2>&1 | grep '^Primary key fingerprint:' | sed -e 's;^.*: *;;' -e 's; *;;g')";
1207 const char * t =
rpmExpand(gnupg_pre, Name, gnupg_post, NULL);
1208 rc = ((Flags &
RPMSENSE_EQUAL) && strcasecmp(EVR, t) == 0) ? 0 : 1;
1211 if (Flags & RPMSENSE_MISSINGOK)
1218 static const char macro_pre[] =
"%{?";
1219 static const char macro_post[] =
":0}";
1220 const char * a =
rpmExpand(macro_pre, Name, macro_post, NULL);
1222 rc = (a && a[0] ==
'0') ? 0 : 1;
1224 if (Flags & RPMSENSE_MISSINGOK)
1231 const char * a = envGet(Name);
1238 int sense = (a && *a) ? strcmp(a, b) : -1;
1252 if (Flags & RPMSENSE_MISSINGOK)
1260 pid_t pid = strtol(Name, &t, 10);
1262 if (t == NULL || *t !=
'\0') {
1263 const char * fn =
rpmGetPath(
"%{_varrun}/", Name,
".pid", NULL);
1266 if (fn && *fn !=
'%' && (fd =
Fopen(fn,
"r.fdio")) && !
Ferror(fd)) {
1268 size_t nb =
Fread(buf,
sizeof(buf[0]),
sizeof(buf), fd);
1271 pid = strtol(buf, &t, 10);
1278 rc = (pid > 0 ? (kill(pid, 0) < 0 &&
errno == ESRCH) : 1);
1279 if (Flags & RPMSENSE_MISSINGOK)
1301 if (Flags & RPMSENSE_MISSINGOK)
1322 if (Flags & RPMSENSE_MISSINGOK)
1356 static int oneshot = -1;
1371 static int oneshot = -1;
1386 static int oneshot = -1;
1401 static int oneshot = -1;
1416 rpmds sonameP = NULL;
1418 char * fn = strcpy((
char *)
alloca(strlen(Name)+1), Name);
1425 fn[strlen(fn)-1] =
'\0';
1430 if (!(xx == 0 && sonameP != NULL))
1450 #if defined(CACHE_DEPENDENCY_RESULT) 1464 if (Name[0] ==
'/' && Name[1] ==
'\0') {
1468 if (Name[0] ==
'/') {
1471 ts->removedPackages, ts->numRemovedPackages, 1);
1482 ts->removedPackages, ts->numRemovedPackages, 1);
1497 if (ts->solve != NULL) {
1498 xx = (*ts->solve) (ts, dep, ts->solveData);
1510 if (Flags & RPMSENSE_MISSINGOK) {
1512 #if defined(CACHE_DEPENDENCY_RESULT) 1525 #if defined(CACHE_DEPENDENCY_RESULT) 1535 DBC * dbcursor = NULL;
1536 size_t DNEVRlen = strlen(DNEVR);
1540 memset(key, 0,
sizeof(*key));
1541 key->
data = (
void *) DNEVR;
1542 key->
size = DNEVRlen;
1543 memset(data, 0,
sizeof(*data));
1545 data->
size =
sizeof(rc);
1548 xx = dbiPut(dbi, dbcursor, key, data, 0);
1579 const char * depName,
1592 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS) 1598 if (requires != NULL)
1599 while (ourrc < terminate &&
rpmdsNext(requires) >= 0) {
1601 if ((Name =
rpmdsN(requires)) == NULL)
1605 if (depName != NULL && strcmp(depName, Name))
1610 if (tscolor && dscolor && !(tscolor & dscolor))
1619 {
fnpyKey * suggestedKeys = NULL;
1621 if (ts->availablePackages != NULL) {
1626 rpmdsProblem(ps, pkgNEVRA, requires, suggestedKeys, adding);
1639 if (conflicts != NULL)
1640 while (ourrc < terminate &&
rpmdsNext(conflicts) >= 0) {
1642 if ((Name =
rpmdsN(conflicts)) == NULL)
1646 if (depName != NULL && strcmp(depName, Name))
1651 if (tscolor && dscolor && !(tscolor & dscolor))
1671 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS) 1672 dirname_deps =
rpmExpandNumeric(
"%{?_check_dirname_deps}%{?!_check_dirname_deps:1}");
1676 if (dirnames != NULL)
1677 while (ourrc < terminate &&
rpmdsNext(dirnames) >= 0) {
1679 if ((Name =
rpmdsN(dirnames)) == NULL)
1683 if (depName != NULL && strcmp(depName, Name))
1688 if (tscolor && dscolor && !(tscolor & dscolor))
1697 {
fnpyKey * suggestedKeys = NULL;
1699 if (ts->availablePackages != NULL) {
1704 rpmdsProblem(ps, pkgNEVRA, dirnames, suggestedKeys, adding);
1715 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS) 1718 symlink_deps =
rpmExpandNumeric(
"%{?_check_symlink_deps}%{?!_check_symlink_deps:1}");
1722 if (linktos != NULL)
1723 while (ourrc < terminate &&
rpmdsNext(linktos) >= 0) {
1725 if ((Name =
rpmdsN(linktos)) == NULL)
1731 if (depName != NULL && strcmp(depName, Name))
1736 if (tscolor && dscolor && !(tscolor & dscolor))
1745 {
fnpyKey * suggestedKeys = NULL;
1747 if (ts->availablePackages != NULL) {
1752 rpmdsProblem(ps, pkgNEVRA, linktos, suggestedKeys, adding);
1763 #if defined(RPM_VENDOR_MANDRIVA) || defined(RPM_VENDOR_ARK) || defined(RPM_OPTIONAL_DIRNAME_AND_SYMLINK_DEPS) 1782 rpmmi mi,
int adding)
1795 ts->removedPackages, ts->numRemovedPackages, 1);
1796 while (ourrc < terminate && (h =
rpmmiNext(mi)) != NULL) {
1797 rpmds requires = NULL;
1798 rpmds conflicts = NULL;
1799 rpmds dirnames = NULL;
1800 rpmds linktos = NULL;
1807 if (ourrc >= terminate) {
1827 requires, conflicts, dirnames, linktos,
1828 depName, tscolor, adding);
1893 const char * depName = NULL;
1898 int closeatexit = 0;
1905 fprintf(stderr,
"--> %s(%p) tsFlags 0x%x\n", __FUNCTION__, ts,
rpmtsFlags(ts));
1912 closeatexit = (rc == 0);
1914 if (rc && (ourrc = rc) >= terminate)
1927 rpmds provides, requires, conflicts, dirnames, linktos;
1950 requires, conflicts, dirnames, linktos,
1952 if (rc && (ourrc = rc) >= terminate)
1957 if (provides != NULL)
1958 while (ourrc < terminate &&
rpmdsNext(provides) >= 0) {
1959 depName =
_free(depName);
1964 const char * EVR =
rpmdsEVR(provides);
1967 if (envPut(depName, EVR));
1976 if (rc && (ourrc = rc) >= terminate)
1981 while (ourrc < terminate &&
rpmfiNext(fi) >= 0) {
1982 depName =
_free(depName);
1988 if (rc && (ourrc = rc) >= terminate)
1992 if (rc && (ourrc = rc) >= terminate)
2010 if (provides != NULL)
2011 while (ourrc < terminate &&
rpmdsNext(provides) >= 0) {
2012 depName =
_free(depName);
2019 if (rc && (ourrc = rc) >= terminate)
2024 while (ourrc < terminate &&
rpmfiNext(fi) >= 0) {
2025 depName =
_free(depName);
2031 if (rc && (ourrc = rc) >= terminate)
2035 if (rc && (ourrc = rc) >= terminate)
2041 {
const char * tsNEVRA =
"transaction dependencies";
2046 const char * dep = NULL;
2051 if (rc && (ourrc = rc) >= terminate)
2057 depName =
_free(depName);
2063 #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.
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.
static int checkDependentPackages(rpmts ts, const char *depName)
Check to-be-erased dependencies against installed requires.
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.
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)
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.
static int checkPackageSet(rpmts ts, const char *depName, rpmmi mi, int adding)
Check dependency against installed packages.
rpmTag rpmdsTagN(const rpmds ds)
Return current dependency type.
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).
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.
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)
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?
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.
int(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
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.
static int checkPackageDeps(rpmts ts, const char *pkgNEVRA, rpmds requires, rpmds conflicts, rpmds dirnames, rpmds linktos, const char *depName, rpmuint32_t tscolor, int adding)
Check added requires/conflicts against against installed+added packages.
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.
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.
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.
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.
static int checkDependentConflicts(rpmts ts, const char *depName)
Check to-be-added dependencies against installed conflicts.
struct rpmQVKArguments_s * QVA_t
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 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.