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)
44 #include "filetriggers.h"
48 #include <rpmrollback.h>
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)))
138 rpm_color_t oFColor =
rpmfiFColor(otherFi) & tscolor;
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);
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;
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) {
463 if (otherFi->actions[otherFileNum] !=
FA_ERASE) {
469 otherFi->actions[otherFileNum] =
FA_SKIP;
478 if (!(S_ISREG(FMode) &&
FF_ISSET(FFlags, CONFIG)))
489 fdigest = (
unsigned char *)
xcalloc(1, dlen);
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));
538 #ifdef RPM_VENDOR_MANDRIVA
548 #ifdef RPM_VENDOR_MANDRIVA
591 int noConfigs =
TSF_ISSET(tsflags, NOCONFIGS);
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);
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)
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));
928 rpmbfParams(n, e, &m, &k);
929 bf = rpmbfNew(m, k, 0);
952 if (rpmbfChk(bf, s, ns))
957 xx = rpmbfAdd(bf, s, ns);
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);
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);
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++) {
1201 if (val ? atoi(val) : 0 != he->
p.
ui32p ? *(he->
p.
ui32p) : 0)
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);
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 ==
'/');
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;
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));
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);
2000 FPSDEBUG(0, (stderr,
"--> %s(%p,%p)\n", __FUNCTION__, ts, p));
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;
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"));
2185 lock = rpmtsAcquireLock(ts);
2187 rollbackFailures =
rpmExpandNumeric(
"%{?_rollback_transaction_on_failure}");
2190 rollbackFailures = 0;
2193 rollbackFailures = 0;
2196 rollbackFailures = 0;
2244 lock = rpmtsFreeLock(lock);
2246 return ts->orderCount;
2273 #if defined(RPM_VENDOR_MANDRIVA)
2278 || !
TSF_ISSET(tsflags, NOTRIGGERPOSTUN))
2289 lock = rpmtsFreeLock(lock);
2293 if (ts->txn !=
NULL)
2294 xx = rpmtxnAbort(ts->txn);
2298 if (ts->txn !=
NULL)
2299 xx = rpmtxnCommit(ts->txn);
const char * rpmteV(rpmte te)
Retrieve version string of transaction element.
rpmuint32_t rpmfiFFlags(rpmfi fi)
Return current file flags from file info set.
int _rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
const char * rpmteNEVRA(rpmte te)
Retrieve name-version-release.arch string from transaction element.
int rpmtsChrootDone(rpmts ts)
Get chrootDone flag, i.e.
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)
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
static int rpmtsPrepare(rpmts ts, rpmsx sx, uint32_t fileCount, uint32_t *nrmvdp)
rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
Set current relocate transaction element.
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Get problem ignore bit mask, i.e.
struct rpmQVKArguments_s * QVA_t
int rpmfiDX(rpmfi fi)
Return current directory index from file info set.
rpmlog(RPMLOG_ERR,"%s\n", buf)
int rpmteOpen(rpmte te, rpmts ts, int reload_fi)
int rpmmiGrowBasename(rpmmi mi, const char *bn)
Append packages containing common basename to iterator.
static int rpmtsCheckInstalledFiles(rpmts ts, uint32_t fileCount, hashTable ht, fingerPrintCache fpc)
rpmuint32_t rpmteColor(rpmte te)
Retrieve color bits of transaction element.
Header rpmteFDHeader(rpmts ts, rpmte te)
int rpmtsInitDSI(const rpmts ts)
Initialize disk space info for each and every mounted file systems.
struct rpmte_s * rpmte
An element of a transaction set, i.e.
static int rpmtsProcess(rpmts ts, rpmprobFilterFlags ignoreSet, int rollbackFailures)
void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
int(* rpmtsRun)(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
rpmProblem rpmpsGetProblem(rpmps ps, int num)
Return a problem from problem set.
struct rpmpsm_s * rpmpsm
Package state machine data.
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.
#define TSF_ISSET(_tsflags, _FLAG)
int Chroot(const char *path)
chroot(2) clone.
Structures used for an "rpmte" transaction element.
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.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
Structure(s) used for file info tag sets.
rpmfi rpmteFI(rpmte te, rpmTag tag)
Retrieve file info tag set from transaction element.
static char *size_t nb
fgets(3) analogue that reads \ continuations.
enum rpmprobFilterFlags_e rpmprobFilterFlags
rpmpsi rpmpsFreeIterator(rpmpsi psi)
Destroy problem set iterator.
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
struct rpmts_s * rpmts
The RPM Transaction Set.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
#define TSF_SET(_tsflags, _FLAG)
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.
rpmsx rpmsxFree(rpmsx sx)
Destroy a SELinux wrapper.
rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid)
Set transaction id, i.e.
rpmuint32_t fpHashFunction(rpmuint32_t h, const void *data, size_t size)
int rpmfiSetFX(rpmfi fi, int fx)
Set current file index in file info set.
int rpmtsUnorderedSuccessors(rpmts ts, int first)
Set index of 1st element of successors.
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
rpmTSType rpmtsType(rpmts ts)
Return the type of a transaction.
rpmfi rpmfiFree(rpmfi fi)
Destroy a file info set.
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
unsigned short rpmuint16_t
int rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
Return file disposition.
void rpmtsEmpty(rpmts ts)
Re-create an empty transaction set.
int dodigest(int dalgo, const char *fn, unsigned char *digest, unsigned dflags, size_t *fsizep)
Return digest and size of a file.
FD_t rpmteFd(rpmte te)
Retrieve file handle from transaction element.
struct rpmps_s * rpmps
Transaction problems found while processing a transaction set/.
const char * rpmteN(rpmte te)
Retrieve name string of transaction element.
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package name-version-release from header with a single dependency.
fingerPrintCache fpCacheFree(fingerPrintCache cache)
Destroy finger print cache.
rpmfi rpmfiNew(const void *_ts, Header h, rpmTag tagN, int flags)
Create and load a file info set.
static int rpmtsRunScript(rpmts ts, rpmTag stag)
rpmuint32_t rpmfiFColor(rpmfi fi)
Return current file color bits from file info set.
rpmuint32_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
int rpmteHaveTransScript(rpmte te, rpmTag tag)
const char * rpmfiBN(rpmfi fi)
Return current base name from file info 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.
int rpmdbRemove(rpmdb db, int rid, uint32_t hdrNum, rpmts ts)
Remove package header from rpm database and indices.
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
void rpmtsSetCurrDir(rpmts ts, const char *currDir)
Set transaction currDir, i.e.
const char * rpmteA(rpmte te)
Retrieve arch string of transaction element.
int htGetEntry(hashTable ht, const void *key, const void *data, int *dataCount, const void *tableKey)
Retrieve item from hash table.
int rpmpsNumProblems(rpmps ps)
Return number of problems in set.
struct fingerPrint_s * rpmfiFpsIndex(rpmfi fi, int ix)
enum evrFlags_e evrFlags
Dependency Attributes.
int rpmtsiOc(rpmtsi tsi)
Return transaction element index.
static rpmfi rpmtsiFi(const rpmtsi tsi)
Return transaction element's file info.
enum rpmRC_e rpmRC
RPM return codes.
Yet Another syslog(3) API clone.
int rpmfiNextD(rpmfi fi)
Return next directory iterator index.
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Check a transaction element for disk space problems.
memset(_r, 0, sizeof(*_r))
enum rpmElementType_e rpmElementType
Transaction element type.
static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *size_t dlen
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))
const char * rpmfiDN(rpmfi fi)
Return current directory name from file info set.
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
static int rpmtsRepackage(rpmts ts, uint32_t numRemoved)
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
char * currentDirectory(void)
Return (malloc'd) current working directory.
int rpmpsNextIterator(rpmpsi psi)
Return next problem set iterator index.
enum rpmtsOpX_e rpmtsOpX
Indices for timestamps.
int argvCount(const ARGV_t argv)
Return no.
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?
const char * tagName(rpmTag tag)
Return tag name from value.
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
rpmuint32_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
Structure(s) used for dependency tag sets.
static rpmps rpmtsSanityCheck(rpmts ts, uint32_t *tfcp)
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
Perform transaction progress notify callback.
The FD_t File Handle data structure.
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
Create and load a package state machine.
int rpmRollback(rpmts ts, QVA_t ia, const char **argv)
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
rpmpsi rpmpsInitIterator(rpmps ps)
Initialize problem set iterator.
int rpmdbCheckSignals(void)
Check for and exit on termination signals.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
int Chdir(const char *path)
chdir(2) clone.
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)
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set element.
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
Package state machine driver.
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
rpmInstallInterfaceFlags installInterfaceFlags
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.
uint32_t rpmmiBNTag(rpmmi mi)
Return basename tag for current position of rpmdb iterator.
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
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.
int rpmteIsSource(rpmte te)
Retrieve isSource attribute of transaction element.
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
const char * rpmteD(rpmte te)
Retrieve distepoch string of transaction element.
int rpmfiDC(rpmfi fi)
Return directory count from file info set.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
#define IIF_SET(_iflags, _FLAG)
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)
struct rpmtsi_s * rpmtsi
Transaction element iterator.
return strcmp(ame->name, bme->name)
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.
int rpmtsSELinuxEnabled(rpmts ts)
Get selinuxEnabled flag, 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.
const char * rpmteO(rpmte te)
Retrieve os string of transaction element.
rpmfi rpmfiLink(rpmfi fi, const char *msg)
Reference a file info set instance.
const char * rpmfiFLink(rpmfi fi)
Return current file linkto (i.e.
enum rpmtransFlags_e rpmtransFlags
Bit(s) to control rpmtsRun() operation.
Methods to handle package elements.
const char * rpmteE(rpmte te)
Retrieve epoch string of transaction element.
int rpmtsNElements(rpmts ts)
Return number of (ordered) transaction set elements.
struct fprintCache_s * fingerPrintCache
char * stpcpy(char *dest, const char *src)
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
rpmuint32_t rpmtsARBGoal(rpmts ts)
Return the autorollback goal.
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.
rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet, int running, rpmte rbte)
Rollback a failed transaction.
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.
rpmElementType rpmteType(rpmte te)
Retrieve type of transaction element.
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.
const unsigned char * rpmfiDigest(rpmfi fi, int *algop, size_t *lenp)
Return current file (binary) digest from file info set.
struct fprintCacheEntry_s * entry
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...
const char * rpmtsCurrDir(rpmts ts)
Get transaction currDir, i.e.
static int rpmtsMarkLinkedFailed(rpmts ts, rpmte p)
Mark all erasure elements linked to installed element p as failed.
int rpmdbOpenAll(rpmdb db)
Open all database indices.
int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
Return file info comparison.
rpmpsm rpmpsmFree(rpmpsm psm, const char *msg)
Destroy a package state machine.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
Set chrootDone flag, i.e.
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.
const char * rpmteNEVR(rpmte te)
Retrieve name-version-release string from transaction element.
int rpmteFailed(rpmte te)
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 * rpmteR(rpmte te)
Retrieve release string of transaction element.
rpmuint32_t rpmtsPrefColor(rpmts ts)
Retrieve preferred file color.
fnpyKey rpmteKey(rpmte te)
Retrieve key from transaction element.
Access RPM indices using Berkeley DB interface(s).
#define TSF_CLR(_tsflags, _FLAG)
int rpmteDBOffset(rpmte te)
Retrieve rpmdb instance of TR_REMOVED transaction element.
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.
int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
Return array of keys matching a pattern.
rpmdepFlags rpmtsDFlags(rpmts ts)
Get dependency flags, i.e.
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
#define FF_ISSET(_fflags, _FLAG)
rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
Run rpmpsmStage(PSM_SCRIPT) for scriptTag and progTag.
int rpmfiFX(rpmfi fi)
Return current file index from file info set.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
int rpmmiSort(rpmmi mi)
Sort iterator instances.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
rpmmi rpmmiInit(rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
Return database iterator.
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
fingerPrintCache fpCacheCreate(int sizeHint)
Create finger print cache.
void rpmpsmSetAsync(rpmpsm psm, int async)
const unsigned char * digest
#define FPSDEBUG(_debug, _list)
int Unlink(const char *path)
unlink(2) clone.