17 #define _FPRINT_INTERNAL
20 #define _RPMDB_INTERNAL
24 #define _RPMFI_INTERNAL
28 #define _RPMTE_INTERNAL
30 #define _RPMTS_INTERNAL
33 #define _RPMSQ_INTERNAL
34 #define _RPMPSM_INTERNAL
43 #if defined(RPM_VENDOR_MANDRIVA)
73 #define FF_ISSET(_fflags, _FLAG) ((_fflags) & (RPMFILE_##_FLAG))
75 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG))
77 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG))
78 #define VSF_SET(_vsflags, _FLAG) \
79 (*((unsigned *)&(_vsflags)) |= (RPMVSF_##_FLAG))
80 #define VSF_CLR(_vsflags, _FLAG) \
81 (*((unsigned *)&(_vsflags)) &= ~(RPMVSF_##_FLAG))
83 #define TSF_ISSET(_tsflags, _FLAG) ((_tsflags) & (RPMTRANS_FLAG_##_FLAG))
84 #define TSF_SET(_tsflags, _FLAG) \
85 (*((unsigned *)&(_tsflags)) |= (RPMTRANS_FLAG_##_FLAG))
86 #define TSF_CLR(_tsflags, _FLAG) \
87 (*((unsigned *)&(_tsflags)) &= ~(RPMTRANS_FLAG_##_FLAG))
89 #define IIF_ISSET(_iflags, _FLAG) ((_iflags) & (INSTALL_##_FLAG))
90 #define IIF_SET(_iflags, _FLAG) \
91 (*((unsigned *)&(_iflags)) |= (INSTALL_##_FLAG))
92 #define IIF_CLR(_iflags, _FLAG) \
93 (*((unsigned *)&(_iflags)) &= ~(INSTALL_##_FLAG))
100 #define FF_ISSET(_fflags, _FLAG) ((_fflags) & (RPMFILE_##_FLAG))
102 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG))
104 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG))
105 #define VSF_SET(_vsflags, _FLAG) (_vsflags) |= (RPMVSF_##_FLAG)
106 #define VSF_CLR(_vsflags, _FLAG) (_vsflags) &= ~(RPMVSF_##_FLAG)
108 #define TSF_ISSET(_tsflags, _FLAG) ((_tsflags) & (RPMTRANS_FLAG_##_FLAG))
109 #define TSF_SET(_tsflags, _FLAG) (_tsflags) |= (RPMTRANS_FLAG_##_FLAG)
110 #define TSF_CLR(_tsflags, _FLAG) (_tsflags) &= ~(RPMTRANS_FLAG_##_FLAG)
112 #define IIF_ISSET(_iflags, _FLAG) ((_iflags) & (INSTALL_##_FLAG))
113 #define IIF_SET(_iflags, _FLAG) (_iflags) |= (INSTALL_##_FLAG)
114 #define IIF_CLR(_iflags, _FLAG) (_iflags) &= ~(INSTALL_##_FLAG)
126 rpmfs fs = rpmteGetFileStates(p);
127 if (XFA_SKIPPING(rpmfsGetAction(fs, fx)))
149 if (tscolor != 0 && FColor != 0 && FColor != oFColor) {
150 if (oFColor & prefcolor) {
157 }
else if (FColor & prefcolor) {
184 if ( !(isCfgFile || XFA_SKIPPING(rpmfsGetAction(fs, fx))) ) {
186 rpmfsAddReplaced(rpmteGetFileStates(p),
rpmfiFX(fi),
193 struct sharedFileInfo_s _shared;
195 p->replaced = (sharedFileInfo)
xrealloc(p->replaced,
196 sizeof(*p->replaced) * (p->nreplaced + 1));
197 memset(p->replaced + p->nreplaced, 0,
sizeof(*p->replaced));
199 _shared.pkgFileNum = fx;
200 _shared.otherFileNum =
rpmfiFX(otherFi);
202 _shared.isRemoved = 0;
203 p->replaced[p->nreplaced++] = _shared;
212 int skipMissing = (
TSF_ISSET(tsflags, ALLFILES) ? 0 : 1);
215 rpmfsSetAction(fs, fx, action);
221 rpmfiSetFReplacedSize(fi,
rpmfiFSize(otherFi));
229 #define ISROOT(_d) (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))
233 #define FPSDEBUG(_debug, _list) if ((_debug) || _fps_debug) fprintf _list
243 uint32_t fixupSize = 0;
251 rpmfs fs = rpmteGetFileStates(p);
255 FPSDEBUG(0, (stderr,
"--> %s(%p,%p,%p)\n", __FUNCTION__, ts, p, fi));
263 int otherPkgNum, otherFileNum;
274 struct rpmffi_s **
recs;
302 (void) rpmFpHashGetEntry(ht, fiFps, &recs, &numRecs, NULL);
304 (void)
htGetEntry(ts->ht, fiFps, &recs, &numRecs, NULL);
328 for (j = 0; j < numRecs && recs[
j]->p != p; j++) {
329 FPSDEBUG(0, (stderr,
"\trecs %p[%u:%u] te %p != %p\n", recs, (
unsigned)j, (
unsigned)numRecs, recs[j]->p, p));
331 FPSDEBUG(0, (stderr,
"*** got recs %p[%u:%u]\n", recs, (
unsigned)j, (
unsigned)numRecs));
341 for (otherPkgNum = j - 1; otherPkgNum >= 0; otherPkgNum--) {
342 FPSDEBUG(0, (stderr,
"\trecs %p[%u:%u] %p -> {%p,%d}\n", recs, (
unsigned)otherPkgNum, (
unsigned)numRecs, recs[otherPkgNum], recs[otherPkgNum]->p, recs[otherPkgNum]->fileno));
343 otherTe = recs[otherPkgNum]->p;
345 otherFileNum = recs[otherPkgNum]->fileno;
347 otherFs = rpmteGetFileStates(otherTe);
357 if (otherFi->actions[otherFileNum] !=
FA_UNKNOWN)
366 {
int reportConflicts =
370 if (otherPkgNum < 0) {
376 if (rpmfiConfigConflict(fi))
382 action =
FF_ISSET(FFlags, NOREPLACE)
388 rpmfsSetAction(fs, i, action);
390 fi->actions[
i] = action;
395 assert(otherFi != NULL);
400 rConflicts = reportConflicts;
403 if (FColor & prefcolor) {
408 if (strcmp(fn,
"/usr/sbin/libgcc_post_upgrade")
409 && strcmp(fn,
"/usr/sbin/glibc_post_upgrade"))
416 if (oFColor & prefcolor) {
419 otherFi->actions[otherFileNum] =
FA_CREATE;
423 if (FColor == 0 && oFColor == 0) {
425 otherFi->actions[otherFileNum] =
FA_CREATE;
445 if (rpmfiConfigConflict(fi))
451 fi->actions[
i] =
FF_ISSET(FFlags, NOREPLACE)
460 if (otherPkgNum >= 0) {
461 assert(otherFi != NULL);
463 if (otherFi->actions[otherFileNum] !=
FA_ERASE) {
469 otherFi->actions[otherFileNum] =
FA_SKIP;
478 if (!(S_ISREG(FMode) &&
FF_ISSET(FFlags, CONFIG)))
485 const unsigned char * digest =
rpmfiDigest(fi, &dalgo, &dlen);
486 unsigned char * fdigest;
487 assert(digest != NULL);
489 fdigest = (
unsigned char *)
xcalloc(1, dlen);
491 if (!
dodigest(dalgo, fn, fdigest, 0, NULL)
492 && memcmp(digest, fdigest, dlen))
494 fdigest =
_free(fdigest);
502 rpmfiFReplacedSize(fi), fixupSize, rpmfsGetAction(fs, i));
505 fi->replacedSizes[i], fixupSize, fi->actions[i]);
533 FPSDEBUG(0, (stderr,
"--> %s(%p,%p,%p)\n", __FUNCTION__, ts, p, h));
534 if (p == NULL || h == NULL)
538 #ifdef RPM_VENDOR_MANDRIVA
548 #ifdef RPM_VENDOR_MANDRIVA
561 assert(he->
p.
str != NULL);
591 int noConfigs =
TSF_ISSET(tsflags, NOCONFIGS);
593 ARGV_t netsharedPaths = NULL;
595 const char * dn, * bn;
605 FPSDEBUG(0, (stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, fi));
606 #if defined(RPM_VENDOR_OPENPKG)
617 {
const char *tmpPath =
rpmExpand(
"%{?_netsharedpath}", NULL);
618 if (tmpPath && *tmpPath)
619 xx =
argvSplit(&netsharedPaths, tmpPath,
":");
620 tmpPath =
_free(tmpPath);
623 s =
rpmExpand(
"%{?_install_langs}", NULL);
633 drc = (
int *)
alloca(dc *
sizeof(*drc));
634 memset(drc, 0, dc *
sizeof(*drc));
635 dff = (
char *)
alloca(dc *
sizeof(*dff));
636 memset(dff, 0, dc *
sizeof(*dff));
656 drc[ix]--; dff[ix] = 1;
662 if (tscolor && FColor && !(tscolor & FColor)) {
663 drc[ix]--; dff[ix] = 1;
673 for (nsp = netsharedPaths; nsp && *nsp; nsp++) {
678 if (strncmp(dn, *nsp, len))
681 if (!(dn[len] ==
'/' || dn[len] ==
'\0'))
684 if (len < (dnlen + bnlen))
686 if (strncmp(dn, *nsp, dnlen))
689 if ((s = strchr((*nsp) + dnlen,
'/')) != NULL && s[1] !=
'\0')
691 if (strncmp(bn, (*nsp) + dnlen, bnlen))
695 if (!((*nsp)[len] ==
'/' || (*nsp)[len] ==
'\0'))
703 drc[ix]--; dff[ix] = 1;
711 if (languages != NULL && fi->flangs != NULL && *fi->flangs[i]) {
714 for (lang = languages; *lang != NULL; lang++) {
715 if (!strcmp(*lang,
"all"))
717 for (l = fi->flangs[i]; *l !=
'\0'; l = le) {
718 for (le = l; *le !=
'\0' && *le !=
'|'; le++)
720 if ((le-l) > 0 && !strncmp(*lang, l, (le-l)))
722 if (*le ==
'|') le++;
728 drc[ix]--; dff[ix] = 1;
738 drc[ix]--; dff[ix] = 1;
747 drc[ix]--; dff[ix] = 1;
756 for (j = 0; j <
dc; j++)
763 if (drc[j])
continue;
764 if (!dff[j])
continue;
767 dn = fi->dnl[
j]; dnlen = strlen(dn) - 1;
768 bn = dn + dnlen; bnlen = 0;
769 while (bn > dn && bn[-1] !=
'/') {
779 const char * fdn, * fbn;
787 if (!S_ISDIR(fFMode))
790 if (strlen(fdn) != dnlen)
792 if (strncmp(fdn, dn, dnlen))
795 if (strlen(fbn) != bnlen)
797 if (strncmp(fbn, bn, bnlen))
806 netsharedPaths =
argvFree(netsharedPaths);
825 if (tsi != NULL && tsi->ocsave != -1) {
829 if (te != NULL && (fi = te->fi) != NULL)
850 if (AV != NULL && B != NULL)
851 for (a = AV; *a != NULL; a++) {
852 if (**a && *B && !strcmp(*a, B))
892 q->linkFailed = p->linkFailed;
921 size_t n = (fileCount > 10 ? fileCount : 10);
922 static double e = 1.0e-4;
927 FPSDEBUG(0, (stderr,
"--> %s(%p,%u)\n", __FUNCTION__, ts, (
unsigned)fileCount));
938 if ((fi =
rpmteFI(p, _tag)) == NULL)
994 rpmfi otherFi = NULL;
995 unsigned int fileNum;
999 FPSDEBUG(0, (stderr,
"--> %s(%p,%u,%p,%p)\n", __FUNCTION__, ts, (
unsigned)fileCount, ht, fpc));
1019 if (ts->removedPackages != NULL)
1020 for (j = 0; j < ts->numRemovedPackages; j++) {
1021 if (ts->removedPackages[j] != hdrNum)
1030 fc = (xx ? he->
c : 0);
1040 FSTATES.
ui8p = (xx ? he->
p.
ui8p : NULL);
1044 for (i = 0; i < (int)fc; i++) {
1045 const char * baseName = BN.
argv[
i];
1048 struct rpmffi_s **
recs;
1053 if (baseKey != tagNum)
1059 if (dirName == oldDir) {
1063 fp =
fpLookup(fpc, dirName, baseName, 1);
1071 gotRecs = rpmFpHashGetEntry(ht, &fp, &recs, &numRecs, NULL);
1073 gotRecs = (
htGetEntry(ts->ht, &fp, &recs, &numRecs, NULL) == 0);
1076 for (j = 0; j < numRecs && gotRecs; j++) {
1083 if (otherFi == NULL) {
1084 static int scareMem = 0;
1092 if (!beingRemoved) {
1096 rpmfs fs = rpmteGetFileStates(p);
1097 rpmfsSetAction(fs, recs[j].fileno,
FA_SKIP);
1101 fi->actions[recs[
j]->fileno] =
FA_SKIP;
1135 uint32_t totalFileCount = 0;
1138 FPSDEBUG(0, (stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, tfcp));
1147 if (p->isSource)
continue;
1154 if (!archOkay(
rpmteA(p)))
1190 for (t = 0; t < 2; t++) {
1191 for (i = 0; i < nkeys; i++) {
1196 const char *val = NULL;
1201 if (val ? atoi(val) : 0 != he->
p.
ui32p ? *(he->
p.
ui32p) : 0)
1205 if (strcmp(he->
p.
str ? he->
p.
str :
"", val ? val :
""))
1234 totalFileCount += fc;
1243 if (p->isSource)
continue;
1248 totalFileCount += fc;
1253 *tfcp = totalFileCount;
1275 FPSDEBUG(0, (stderr,
"--> %s(%p,%s(%u))\n", __FUNCTION__, ts,
tagName(stag), (
unsigned)stag));
1286 if (p->isSource)
continue;
1324 FPSDEBUG(0, (stderr,
"--> %s(%p,%u,%p,%p)\n", __FUNCTION__, ts, (
unsigned)fileCount, ht, fpc));
1329 if (p->isSource)
continue;
1341 char const *linktarget;
1343 if (!(linktarget && *linktarget !=
'\0'))
1348 {
struct rpmffi_s ffi;
1354 {
struct rpmffi_s *ffip = (
struct rpmffi_s *)
alloca(
sizeof(*ffip));
1359 htAddEntry(symlinks, fi->fps + i, (
void *) ffip);
1378 if (p->isSource)
continue;
1385 if (XFA_SKIPPING(rpmfsGetAction(rpmteGetFileStates(p), i)))
1397 symlinks =
htFree(symlinks);
1409 FPSDEBUG(0, (stderr,
"--> %s(%p,0x%x,%p)\n", __FUNCTION__, ts, ignoreSet, (
void *)sxp));
1418 TSF_SET(tsflags, NOPOSTTRANS);
1420 TSF_SET(tsflags, NOTRIGGERPREIN);
1421 TSF_SET(tsflags, NOTRIGGERIN);
1422 TSF_SET(tsflags, NOTRIGGERUN);
1423 TSF_SET(tsflags, NOTRIGGERPOSTUN);
1429 TSF_SET(tsflags, NOTRIGGERPREIN);
1430 TSF_SET(tsflags, NOTRIGGERIN);
1431 TSF_SET(tsflags, NOTRIGGERUN);
1432 TSF_SET(tsflags, NOTRIGGERPOSTUN);
1443 TSF_SET(tsflags, NOPOSTTRANS);
1445 TSF_SET(tsflags, NOTRIGGERPREIN);
1446 TSF_SET(tsflags, NOTRIGGERIN);
1447 TSF_SET(tsflags, NOTRIGGERUN);
1448 TSF_SET(tsflags, NOTRIGGERPOSTUN);
1461 *sxp =
rpmsxNew(
"%{?_install_file_context_path}", 0);
1471 {
int dbmode = O_RDONLY;
1478 if (p->isSource)
continue;
1479 dbmode = (O_RDWR|O_CREAT);
1491 ts->ignoreSet = ignoreSet;
1496 currDir =
_free(currDir);
1515 FPSDEBUG(0, (stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, sx));
1519 matchpathcon_fini();
1539 uint64_t fileCount = countFiles(ts);
1541 int dochroot = (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/');
1553 if ((fi =
rpmteFI(p)) == NULL)
1567 if (chroot(rootDir) == -1) {
1579 uint32_t numAdded = 0;
1580 uint32_t numRemoved = 0;
1582 FPSDEBUG(0, (stderr,
"--> %s(%p,%p,%u,%p)\n", __FUNCTION__, ts, sx, (
unsigned)fileCount, nrmvdp));
1589 if (p->isSource)
continue;
1609 (fc > 0 ?
xmalloc(fc *
sizeof(*fi->fps)) : NULL);
1614 *nrmvdp = numRemoved;
1618 static int openall_before_chroot = -1;
1620 if (openall_before_chroot < 0)
1625 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/') {
1626 if (openall_before_chroot)
1702 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/')
1706 if (currDir != NULL)
1707 xx =
Chdir(currDir);
1724 if (p->isSource)
continue;
1729 fi->fps =
_free(fi->fps);
1736 ht = rpmFpHashFree(ht);
1749 int rollbackFailures)
1757 FPSDEBUG(0, (stderr,
"--> %s(%p,0x%x,%d)\n", __FUNCTION__, ts, ignoreSet, rollbackFailures));
1811 if (gotfd &&
rpmteFd(p) != NULL) {
1818 int mapflags = fi->mapflags;
1836 fi->fstates =
_free(fi->fstates);
1837 fi->fstates = fstates;
1838 fi->actions =
_free(fi->actions);
1839 fi->actions = (
int *) actions;
1845 psm->fi =
rpmfiLink(p->fi, __FUNCTION__);
1878 #if defined(RPM_VENDOR_MANDRIVA)
1880 if (!failed && !
TSF_ISSET(tsflags, TEST)) {
1882 xx = mayAddToFilesAwaitingFiletriggers(
rpmtsRootDir(ts),
1896 rpmteMarkFailed(p, ts);
1902 if (rollbackFailures) {
1938 FPSDEBUG(0, (stderr,
"--> %s(%p,%u)\n", __FUNCTION__, ts, (
unsigned)numRemoved));
1944 if (p->isSource)
continue;
1958 progress, numRemoved);
1968 assert(psm != NULL);
2000 FPSDEBUG(0, (stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, p));
2015 assert(psm != NULL);
2016 psm->stepName =
"failed";
2029 const char * semfn = NULL;
2036 FPSDEBUG(0, (stderr,
"--> %s(%p,0x%x,%d,%p)\n", __FUNCTION__, rbts, ignoreSet, running, rbte));
2042 if (arbgoal == 0xffffffff)
2046 if (!running && arbgoal == 0xffffffff)
2062 if (te->isSource)
continue;
2063 if(!te->u.removed.dboffset)
2067 te->u.removed.dboffset, NULL);
2086 ttid = (time_t)arbgoal;
2088 ctime(&ttid), arbgoal);
2097 #if defined(SUPPORT_NOSIGNATURES)
2099 VSF_SET(vsflags, NOSHA1HEADER);
2100 VSF_SET(vsflags, NOMD5HEADER);
2104 VSF_SET(vsflags, NODSAHEADER);
2105 VSF_SET(vsflags, NORSAHEADER);
2110 VSF_SET(vsflags, NEEDPAYLOAD);
2125 ia->
rbtid = arbgoal;
2139 semfn =
rpmExpand(
"%{?semaphore_backout}", NULL);
2140 if (semfn && *semfn) {
2152 if (semfn && *semfn)
2154 semfn =
_free(semfn);
2164 uint32_t totalFileCount = 0;
2167 uint32_t numRemoved;
2168 int rollbackFailures = 0;
2172 FPSDEBUG(0, (stderr,
"--> %s(%p,%p,0x%x)\n", __FUNCTION__, ts, okProbs, ignoreSet));
2174 fprintf(stderr,
"--> %s(%p,%p,0x%x) tsflags 0x%x\n", __FUNCTION__, ts, okProbs, (
unsigned) ignoreSet, tsflags);
2179 _(
"Invalid number of transaction elements.\n"));
2187 rollbackFailures =
rpmExpandNumeric(
"%{?_rollback_transaction_on_failure}");
2190 rollbackFailures = 0;
2193 rollbackFailures = 0;
2196 rollbackFailures = 0;
2223 (okProbs == NULL ||
rpmpsTrim(ts->probs, okProbs)))))
2241 (okProbs == NULL ||
rpmpsTrim(ts->probs, okProbs)))
2246 return ts->orderCount;
2273 #if defined(RPM_VENDOR_MANDRIVA)
2278 || !
TSF_ISSET(tsflags, NOTRIGGERPOSTUN))
2293 if (ts->txn != NULL)
2298 if (ts->txn != NULL)
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.
int rpmdbOpenAll(rpmdb db)
Open all database indices.
fingerPrint fpLookup(fingerPrintCache cache, const char *dirName, const char *baseName, int scareMem)
Return finger print of a file path.
int rpmteClose(rpmte te, rpmts ts, int reset_fi)
static int rpmtsPrepare(rpmts ts, rpmsx sx, uint32_t fileCount, uint32_t *nrmvdp)
FD_t rpmteFd(rpmte te)
Retrieve file handle from transaction element.
int rpmtxnBegin(rpmdb rpmdb, rpmtxn parent, rpmtxn *txnp)
int rpmmiGrowBasename(rpmmi mi, const char *bn)
Append packages containing common basename to iterator.
rpmuint32_t rpmteColor(rpmte te)
Retrieve color bits of transaction element.
rpmtime_t rpmswExit(rpmop op, ssize_t rc)
Exit timed operation.
int rpmfiDX(rpmfi fi)
Return current directory index from file info set.
int rpmtxnCheckpoint(rpmdb rpmdb)
int rpmteOpen(rpmte te, rpmts ts, int reload_fi)
static int rpmtsCheckInstalledFiles(rpmts ts, uint32_t fileCount, hashTable ht, fingerPrintCache fpc)
Header rpmteFDHeader(rpmts ts, rpmte te)
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
Perform transaction progress notify callback.
static int rpmtsProcess(rpmts ts, rpmprobFilterFlags ignoreSet, int rollbackFailures)
const char const char size_t len
void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
const char bson_timestamp_t * ts
rpmProblem rpmpsGetProblem(rpmps ps, int num)
Return a problem from problem set.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set 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.
enum iosmFileAction_e iosmFileAction
File disposition(s) during package install/erase processing.
rpmbf rpmbfNew(size_t m, size_t k, unsigned flags)
Create a Bloom filter.
#define TSF_ISSET(_tsflags, _FLAG)
int Chroot(const char *path)
chroot(2) clone.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
Structures used for an "rpmte" transaction element.
int rpmtxnCommit(rpmtxn txn)
static int cmpArgvStr(const char **AV, const char *B)
Search for string B in argv array AV.
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
Structure(s) used for file info tag sets.
enum rpmprobFilterFlags_e rpmprobFilterFlags
rpmpsi rpmpsFreeIterator(rpmpsi psi)
Destroy problem set iterator.
#define TSF_SET(_tsflags, _FLAG)
rpmsx rpmsxFree(rpmsx sx)
Destroy a SELinux wrapper.
const char * rpmteN(rpmte te)
Retrieve name string of transaction element.
rpmuint32_t fpHashFunction(rpmuint32_t h, const void *data, size_t size)
rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet, int running, rpmte rbte)
Rollback a failed transaction.
int rpmfiSetFX(rpmfi fi, int fx)
Set current file index in file info set.
struct rpmpsm_s * rpmpsm
Package state machine data.
static rpmVSFlags vsflags
void * rpmtsFreeLock(void *lock)
rpmfi rpmfiFree(rpmfi fi)
Destroy a file info set.
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
int rpmdbCheckSignals(void)
Check for and exit on termination signals.
unsigned short rpmuint16_t
int rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
Return file disposition.
enum rpmtsOpX_e rpmtsOpX
Indices for timestamps.
int dodigest(int dalgo, const char *fn, unsigned char *digest, unsigned dflags, size_t *fsizep)
Return digest and size of a file.
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
Set chrootDone flag, i.e.
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
struct rpmtsi_s * rpmtsi
Transaction element iterator.
int _rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
rpmTSType rpmtsType(rpmts ts)
Return the type of a transaction.
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.
fingerPrintCache fpCacheFree(fingerPrintCache cache)
Destroy finger print cache.
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package name-version-release from header with a single dependency.
const char * rpmteA(rpmte te)
Retrieve arch string of transaction element.
rpmfi rpmfiNew(const void *_ts, Header h, rpmTag tagN, int flags)
Create and load a file info set.
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
static int rpmtsRunScript(rpmts ts, rpmTag stag)
rpmuint32_t rpmfiFColor(rpmfi fi)
Return current file color bits from file info set.
int rpmteHaveTransScript(rpmte te, rpmTag tag)
const char * rpmfiBN(rpmfi fi)
Return current base name from file info set.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
Command line option information.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
rpmuint32_t rpmfiFSize(rpmfi fi)
Return current file size from file info set.
int rpmpsTrim(rpmps ps, rpmps filter)
Filter a problem set.
struct rpmte_s * rpmte
An element of a transaction set, i.e.
const char * rpmteE(rpmte te)
Retrieve epoch string of transaction element.
rpmmi rpmmiInit(rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
Return database iterator.
int htGetEntry(hashTable ht, const void *key, const void *data, int *dataCount, const void *tableKey)
Retrieve item from hash table.
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.
const char * rpmtsCurrDir(rpmts ts)
Get transaction currDir, i.e.
struct fingerPrint_s * rpmfiFpsIndex(rpmfi fi, int ix)
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.
static rpmfi rpmtsiFi(const rpmtsi tsi)
Return transaction element's file info.
Yet Another syslog(3) API clone.
enum rpmElementType_e rpmElementType
Transaction element type.
int rpmfiNextD(rpmfi fi)
Return next directory iterator index.
rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid)
Set transaction id, i.e.
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
const char * rpmteV(rpmte te)
Retrieve version string of transaction element.
const char * rpmteNEVR(rpmte te)
Retrieve name-version-release string from transaction element.
void * xcalloc(size_t nmemb, size_t size)
const char * rpmfiDN(rpmfi fi)
Return current directory name from file info set.
rpmbf rpmbfFree(rpmbf bf)
Destroy a Bloom filter.
int rpmmiSort(rpmmi mi)
Sort iterator instances.
static int rpmtsRepackage(rpmts ts, uint32_t numRemoved)
rpmfi rpmteFI(rpmte te, rpmTag tag)
Retrieve file info tag set from transaction element.
char * currentDirectory(void)
Return (malloc'd) current working directory.
int rpmpsNextIterator(rpmpsi psi)
Return next problem set iterator index.
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
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.
int rpmdbRemove(rpmdb db, int rid, uint32_t hdrNum, rpmts ts)
Remove package header from rpm database and indices.
rpmuint16_t rpmfiFMode(rpmfi fi)
Return current file mode from file info set.
hashTable htFree(hashTable ht)
Destroy hash table.
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
#define VSF_SET(_vsflags, _FLAG)
int iosmFileActionSkipped(iosmFileAction action)
Is the file going to be skipped?
int rpmtsNElements(rpmts ts)
Return number of (ordered) transaction set elements.
const char * tagName(rpmTag tag)
Return tag name from value.
rpmuint32_t rpmtsPrefColor(rpmts ts)
Retrieve preferred file color.
Structure(s) used for dependency tag sets.
static rpmps rpmtsSanityCheck(rpmts ts, uint32_t *tfcp)
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 * rpmteD(rpmte te)
Retrieve distepoch string of transaction element.
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
Create and load a package state machine.
int rpmtsChrootDone(rpmts ts)
Get chrootDone flag, i.e.
const char * rpmteNEVRA(rpmte te)
Retrieve name-version-release.arch string from transaction element.
int rpmRollback(rpmts ts, QVA_t ia, const char **argv)
Rollback transactions, erasing new, reinstalling old, package(s).
void rpmtsUpdateDSI(const rpmts ts, dev_t dev, rpmuint32_t fileSize, rpmuint32_t prevSize, rpmuint32_t fixupSize, int _action)
Update disk space info for a file.
int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
Return array of keys matching a pattern.
rpmpsi rpmpsInitIterator(rpmps ps)
Initialize problem set iterator.
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
Header headerFree(Header h)
Dereference a header instance.
int rpmswEnter(rpmop op, ssize_t rc)
Enter timed operation.
const char const bson const bson * op
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
int Chdir(const char *path)
chdir(2) clone.
rpmuint32_t rpmtsARBGoal(rpmts ts)
Return the autorollback goal.
int fpEqual(const void *key1, const void *key2)
Compare two finger print entries.
Identify a file name path by a unique "finger print".
static int rpmtsFinish(rpmts ts, rpmsx sx)
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
Package state machine driver.
const char * rpmteO(rpmte te)
Retrieve os string of transaction element.
void rpmtsSetCurrDir(rpmts ts, const char *currDir)
Set transaction currDir, i.e.
rpmInstallInterfaceFlags installInterfaceFlags
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
static rpmmi rpmtsFindBaseNamesInDB(rpmts ts, uint32_t fileCount)
int Fclose(FD_t fd)
fclose(3) clone.
static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet, rpmsx *sxp)
Cumulative statistics for an operation.
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
rpmprobFilterFlags probFilter
enum rpmfileAttrs_e rpmfileAttrs
File Attributes.
Associates a trailing sub-directory and final base name with an existing directory finger print...
int rpmfiNext(rpmfi fi)
Return next file iterator index.
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
int rpmfiDC(rpmfi fi)
Return directory count from file info set.
int rpmtsiOc(rpmtsi tsi)
Return transaction element index.
fnpyKey rpmteKey(rpmte te)
Retrieve key from transaction element.
#define IIF_SET(_iflags, _FLAG)
enum rpmRC_e rpmRC
RPM return codes.
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Check a transaction element for disk space problems.
static const char * dirName
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
static void rpmtsAddFingerprints(rpmts ts, uint32_t fileCount, hashTable ht, fingerPrintCache fpc)
rpmuint32_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
void htAddEntry(hashTable ht, const void *key, const void *data)
Add item to hash table.
Package state machine to handle a package from a transaction set.
rpmdepFlags rpmtsDFlags(rpmts ts)
Get dependency flags, i.e.
static void handleOverlappedFiles(const rpmts ts, const rpmte p, rpmfi fi)
Update disk space needs on each partition for this package's files.
rpmfi rpmfiLink(rpmfi fi, const char *msg)
Reference a file info set instance.
const struct fprintCacheEntry_s * entry
const char * rpmfiFLink(rpmfi fi)
Return current file linkto (i.e.
int(* rpmtsRun)(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
Methods to handle package elements.
rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
Set current relocate transaction element.
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
enum rpmtransFlags_e rpmtransFlags
Bit(s) to control rpmtsRun() operation.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct fprintCache_s * fingerPrintCache
uint32_t rpmmiBNTag(rpmmi mi)
Return basename tag for current position of rpmdb iterator.
char * stpcpy(char *dest, const char *src)
struct rpmts_s * rpmts
The RPM Transaction Set.
struct rpmQVKArguments_s * QVA_t
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int rpmteDBOffset(rpmte te)
Retrieve rpmdb instance of TR_REMOVED transaction element.
static void rpmtsSkipFiles(const rpmts ts, rpmfi fi)
Skip any files that do not match install policies.
Structures and prototypes used for an "rpmts" transaction set.
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
rpmfileState rpmfiFState(rpmfi fi)
Return current file state from file info set.
rpmfi rpmteSetFI(rpmte te, rpmfi fi)
File state machine to handle a payload within an rpm package.
rpmfi rpmfiInitD(rpmfi fi, int dx)
Initialize directory iterator index.
void * rpmtsAcquireLock(rpmts ts)
rpmsx rpmsxNew(const char *fn, unsigned int flags)
Create and load a SELinux wrapper.
static rpmRC _processFailedPackage(rpmts ts, rpmte p)
Force add a failed package into the rpmdb.
int rpmbfAdd(rpmbf bf, const void *_s, size_t ns)
Add item to a Bloom filter.
const unsigned char * rpmfiDigest(rpmfi fi, int *algop, size_t *lenp)
Return current file (binary) digest from file info set.
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
void fpLookupSubdir(hashTable symlinks, hashTable fphash, fingerPrintCache fpc, void *_p, int filenr)
Check file for to be installed symlinks in their path, correct their fingerprint and add it to newht...
int rpmtsUnorderedSuccessors(rpmts ts, int first)
Set index of 1st element of successors.
static int rpmtsMarkLinkedFailed(rpmts ts, rpmte p)
Mark all erasure elements linked to installed element p as failed.
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
Return file info comparison.
rpmpsm rpmpsmFree(rpmpsm psm, const char *msg)
Destroy a package state machine.
rpmuint32_t hashFunctionString(rpmuint32_t h, const void *data, size_t size)
Return hash value of a string.
static int ensureOlder(rpmts ts, const rpmte p, const Header h)
Ensure that current package is newer than installed package.
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Get problem ignore bit mask, i.e.
int rpmteFailed(rpmte te)
int rpmtsSELinuxEnabled(rpmts ts)
Get selinuxEnabled flag, i.e.
void rpmRunFileTriggers(const char *rootDir)
rpmuint32_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
Access RPM indices using Berkeley DB interface(s).
#define TSF_CLR(_tsflags, _FLAG)
static int handleInstInstalledFile(const rpmts ts, rpmte p, rpmfi fi, Header otherHeader, rpmfi otherFi, int beingRemoved)
hashTable htCreate(int numBuckets, size_t keySize, int freeData, hashFunctionType fn, hashEqualityType eq)
Create hash table.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
#define FF_ISSET(_fflags, _FLAG)
rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
Run rpmpsmStage(PSM_SCRIPT) for scriptTag and progTag.
int rpmtxnAbort(rpmtxn txn)
const char * rpmteR(rpmte te)
Retrieve release string of transaction element.
int rpmfiFX(rpmfi fi)
Return current file index from file info set.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
void rpmtsEmpty(rpmts ts)
Re-create an empty transaction set.
int rpmteIsSource(rpmte te)
Retrieve isSource attribute of transaction element.
fingerPrintCache fpCacheCreate(int sizeHint)
Create finger print cache.
int rpmbfChk(rpmbf bf, const void *_s, size_t ns)
Check for item in a Bloom filter.
void rpmpsmSetAsync(rpmpsm psm, int async)
#define FPSDEBUG(_debug, _list)
int Unlink(const char *path)
unlink(2) clone.