transaction.c | transaction.c | |||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
/*@access rpmpsm @*/ | /*@access rpmpsm @*/ | |||
/*@access rpmte @*/ | /*@access rpmte @*/ | |||
/*@access rpmtsi @*/ | /*@access rpmtsi @*/ | |||
/*@access rpmts @*/ | /*@access rpmts @*/ | |||
/*@access IDT @*/ | /*@access IDT @*/ | |||
/*@access IDTX @*/ | /*@access IDTX @*/ | |||
/*@access FD_t @*/ | /*@access FD_t @*/ | |||
#ifdef __cplusplus | ||||
#define FF_ISSET(_fflags, _FLAG) ((_fflags) & (RPMFILE_##_FLAG)) | ||||
#define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG)) | ||||
#define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG)) | ||||
#define VSF_SET(_vsflags, _FLAG) \ | ||||
(*((unsigned *)&(_vsflags)) |= (RPMVSF_##_FLAG)) | ||||
#define VSF_CLR(_vsflags, _FLAG) \ | ||||
(*((unsigned *)&(_vsflags)) &= ~(RPMVSF_##_FLAG)) | ||||
#define TSF_ISSET(_tsflags, _FLAG) ((_tsflags) & (RPMTRANS_FLAG_##_FLAG | ||||
)) | ||||
#define TSF_SET(_tsflags, _FLAG) \ | ||||
(*((unsigned *)&(_tsflags)) |= (RPMTRANS_FLAG_##_FLAG)) | ||||
#define TSF_CLR(_tsflags, _FLAG) \ | ||||
(*((unsigned *)&(_tsflags)) &= ~(RPMTRANS_FLAG_##_FLAG)) | ||||
#define IIF_ISSET(_iflags, _FLAG) ((_iflags) & (INSTALL_##_FLAG)) | ||||
#define IIF_SET(_iflags, _FLAG) \ | ||||
(*((unsigned *)&(_iflags)) |= (INSTALL_##_FLAG)) | ||||
#define IIF_CLR(_iflags, _FLAG) \ | ||||
(*((unsigned *)&(_iflags)) &= ~(INSTALL_##_FLAG)) | ||||
GENfree(int *) | ||||
GENfree(struct fingerPrint_s *) | ||||
#else /* __cplusplus */ | ||||
#define FF_ISSET(_fflags, _FLAG) ((_fflags) & (RPMFILE_##_FLAG)) | ||||
#define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG)) | ||||
#define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG)) | ||||
#define VSF_SET(_vsflags, _FLAG) (_vsflags) |= (RPMVSF_##_FLAG) | ||||
#define VSF_CLR(_vsflags, _FLAG) (_vsflags) &= ~(RPMVSF_##_FLAG) | ||||
#define TSF_ISSET(_tsflags, _FLAG) ((_tsflags) & (RPMTRANS_FLAG_##_FLA | ||||
G)) | ||||
#define TSF_SET(_tsflags, _FLAG) (_tsflags) |= (RPMTRANS_FLA | ||||
G_##_FLAG) | ||||
#define TSF_CLR(_tsflags, _FLAG) (_tsflags) &= ~(RPMTRANS_FLA | ||||
G_##_FLAG) | ||||
#define IIF_ISSET(_iflags, _FLAG) ((_iflags) & (INSTALL_##_FLAG)) | ||||
#define IIF_SET(_iflags, _FLAG) (_iflags) |= (INSTALL_##_FL | ||||
AG) | ||||
#define IIF_CLR(_iflags, _FLAG) (_iflags) &= ~(INSTALL_##_FL | ||||
AG) | ||||
#endif /* __cplusplus */ | ||||
static int handleInstInstalledFile(const rpmts ts, rpmte p, rpmfi fi, | static int handleInstInstalledFile(const rpmts ts, rpmte p, rpmfi fi, | |||
Header otherHeader, rpmfi otherFi, | Header otherHeader, rpmfi otherFi, | |||
int beingRemoved) | int beingRemoved) | |||
/*@modifies ts, p, fi @*/ | /*@modifies ts, p, fi @*/ | |||
{ | { | |||
unsigned int fx = rpmfiFX(fi); | unsigned int fx = rpmfiFX(fi); | |||
int isCfgFile = ((rpmfiFFlags(otherFi) | rpmfiFFlags(fi)) & RPMFILE_CON FIG); | int isCfgFile = (FF_ISSET(rpmfiFFlags(otherFi), CONFIG) || FF_ISSET(rpm fiFFlags(fi), CONFIG)); | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmfs fs = rpmteGetFileStates(p); | rpmfs fs = rpmteGetFileStates(p); | |||
if (XFA_SKIPPING(rpmfsGetAction(fs, fx))) | if (XFA_SKIPPING(rpmfsGetAction(fs, fx))) | |||
#else | #else | |||
if (iosmFileActionSkipped(fi->actions[fx])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[fx])) | |||
#endif | #endif | |||
return 0; | return 0; | |||
if (rpmfiCompare(otherFi, fi)) { | if (rpmfiCompare(otherFi, fi)) { | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpm_color_t tscolor = rpmtsColor(ts); | rpm_color_t tscolor = rpmtsColor(ts); | |||
rpm_color_t prefcolor = rpmtsPrefColor(ts); | rpm_color_t prefcolor = rpmtsPrefColor(ts); | |||
rpm_color_t FColor = rpmfiFColor(fi) & tscolor; | rpm_color_t FColor = rpmfiFColor(fi) & tscolor; | |||
rpm_color_t oFColor = rpmfiFColor(otherFi) & tscolor; | rpm_color_t oFColor = rpmfiFColor(otherFi) & tscolor; | |||
#else | #else | |||
skipping to change at line 121 | skipping to change at line 168 | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmfsSetAction(fs, fx, FA_CREATE); | rpmfsSetAction(fs, fx, FA_CREATE); | |||
#else | #else | |||
fi->actions[fx] = FA_CREATE; | fi->actions[fx] = FA_CREATE; | |||
#endif | #endif | |||
rConflicts = 0; | rConflicts = 0; | |||
} | } | |||
} | } | |||
if (rConflicts) { | if (rConflicts) { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
rpmps ps = rpmtsProblems(ts); | rpmps ps = rpmtsProblems(ts); | |||
int xx; | int xx; | |||
he->tag = RPMTAG_NVRA; | he->tag = RPMTAG_NVRA; | |||
xx = headerGet(otherHeader, he, 0); | xx = headerGet(otherHeader, he, 0); | |||
rpmpsAppend(ps, RPMPROB_FILE_CONFLICT, | rpmpsAppend(ps, RPMPROB_FILE_CONFLICT, | |||
rpmteNEVRA(p), rpmteKey(p), | rpmteNEVRA(p), rpmteKey(p), | |||
rpmfiDN(fi), rpmfiBN(fi), | rpmfiDN(fi), rpmfiBN(fi), | |||
he->p.str, | he->p.str, | |||
0); | 0); | |||
he->p.ptr = _free(he->p.ptr); | he->p.ptr = _free(he->p.ptr); | |||
skipping to change at line 144 | skipping to change at line 191 | |||
/* Save file identifier to mark as state REPLACED. */ | /* Save file identifier to mark as state REPLACED. */ | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
if ( !(isCfgFile || XFA_SKIPPING(rpmfsGetAction(fs, fx))) ) { | if ( !(isCfgFile || XFA_SKIPPING(rpmfsGetAction(fs, fx))) ) { | |||
if (!beingRemoved) | if (!beingRemoved) | |||
rpmfsAddReplaced(rpmteGetFileStates(p), rpmfiFX(fi), | rpmfsAddReplaced(rpmteGetFileStates(p), rpmfiFX(fi), | |||
headerGetInstance(otherHeader), | headerGetInstance(otherHeader), | |||
rpmfiFX(otherFi)); | rpmfiFX(otherFi)); | |||
} | } | |||
#else | #else | |||
if ( !(isCfgFile || iosmFileActionSkipped(fi->actions[fx])) ) { | if ( !(isCfgFile || iosmFileActionSkipped((iosmFileAction) fi->actio ns[fx])) ) { | |||
if (!beingRemoved) { | if (!beingRemoved) { | |||
struct sharedFileInfo_s _shared; | struct sharedFileInfo_s _shared; | |||
p->replaced = xrealloc(p->replaced, | p->replaced = (sharedFileInfo) xrealloc(p->replaced, | |||
sizeof(*p->replaced) * (p->nreplaced + 1)); | sizeof(*p->replaced) * (p->nreplaced + 1)); | |||
memset(p->replaced + p->nreplaced, 0, sizeof(*p->replaced)); | memset(p->replaced + p->nreplaced, 0, sizeof(*p->replaced)); | |||
_shared.pkgFileNum = fx; | _shared.pkgFileNum = fx; | |||
_shared.otherFileNum = rpmfiFX(otherFi); | _shared.otherFileNum = rpmfiFX(otherFi); | |||
_shared.otherPkg = headerGetInstance(otherHeader); | _shared.otherPkg = headerGetInstance(otherHeader); | |||
_shared.isRemoved = 0; | _shared.isRemoved = 0; | |||
p->replaced[p->nreplaced++] = _shared; | p->replaced[p->nreplaced++] = _shared; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
} | } | |||
/* Determine config file dispostion, skipping missing files (if any). * / | /* Determine config file dispostion, skipping missing files (if any). * / | |||
if (isCfgFile) { | if (isCfgFile) { | |||
int skipMissing = ((rpmtsFlags(ts) & RPMTRANS_FLAG_ALLFILES) ? 0 : 1 | rpmtransFlags tsflags = rpmtsFlags(ts); | |||
); | int skipMissing = (TSF_ISSET(tsflags, ALLFILES) ? 0 : 1); | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmFileAction action = rpmfiDecideFate(otherFi, fi, skipMissing); | rpmFileAction action = rpmfiDecideFate(otherFi, fi, skipMissing); | |||
rpmfsSetAction(fs, fx, action); | rpmfsSetAction(fs, fx, action); | |||
#else | #else | |||
fi->actions[fx] = rpmfiDecideFate(otherFi, fi, skipMissing); | fi->actions[fx] = rpmfiDecideFate(otherFi, fi, skipMissing); | |||
#endif | #endif | |||
} | } | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmfiSetFReplacedSize(fi, rpmfiFSize(otherFi)); | rpmfiSetFReplacedSize(fi, rpmfiFSize(otherFi)); | |||
#else | #else | |||
skipping to change at line 229 | skipping to change at line 277 | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmfileAttrs FFlags; | rpmfileAttrs FFlags; | |||
rpm_mode_t FMode; | rpm_mode_t FMode; | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
rpmuint32_t FFlags; | rpmuint32_t FFlags; | |||
rpmuint16_t FMode; | rpmuint16_t FMode; | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
struct rpmffi_s ** recs; | struct rpmffi_s ** recs; | |||
int numRecs; | int numRecs; | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) | |||
continue; | continue; | |||
fn = rpmfiFN(fi); | fn = rpmfiFN(fi); | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
fiFps = rpmfiFpsIndex(fi, i); | fiFps = rpmfiFpsIndex(fi, i); | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
fiFps = fi->fps + i; | fiFps = fi->fps + i; | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
FFlags = rpmfiFFlags(fi); | FFlags = rpmfiFFlags(fi); | |||
FMode = rpmfiFMode(fi); | FMode = rpmfiFMode(fi); | |||
skipping to change at line 330 | skipping to change at line 378 | |||
int done = 0; | int done = 0; | |||
if (otherPkgNum < 0) { | if (otherPkgNum < 0) { | |||
iosmFileAction action; | iosmFileAction action; | |||
/* XXX is this test still necessary? */ | /* XXX is this test still necessary? */ | |||
if (fi->actions[i] != FA_UNKNOWN) | if (fi->actions[i] != FA_UNKNOWN) | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
if (rpmfiConfigConflict(fi)) | if (rpmfiConfigConflict(fi)) | |||
#else | #else | |||
if ((FFlags & RPMFILE_CONFIG) && (FFlags & RPMFILE_EXISTS)) | if (FF_ISSET(FFlags, CONFIG) && FF_ISSET(FFlags, EXISTS)) | |||
#endif | #endif | |||
{ | { | |||
/* Here is a non-overlapped pre-existing config file. */ | /* Here is a non-overlapped pre-existing config file. */ | |||
action = (FFlags & RPMFILE_NOREPLACE) | action = FF_ISSET(FFlags, NOREPLACE) | |||
? FA_ALTNAME : FA_BACKUP; | ? FA_ALTNAME : FA_BACKUP; | |||
} else { | } else { | |||
action = FA_CREATE; | action = FA_CREATE; | |||
} | } | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmfsSetAction(fs, i, action); | rpmfsSetAction(fs, i, action); | |||
#else | #else | |||
fi->actions[i] = action; | fi->actions[i] = action; | |||
#endif | #endif | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
skipping to change at line 357 | skipping to change at line 405 | |||
assert(otherFi != NULL); | assert(otherFi != NULL); | |||
/* Mark added overlapped non-identical files as a conflict. */ | /* Mark added overlapped non-identical files as a conflict. */ | |||
if (rpmfiCompare(otherFi, fi)) { | if (rpmfiCompare(otherFi, fi)) { | |||
int rConflicts; | int rConflicts; | |||
rConflicts = reportConflicts; | rConflicts = reportConflicts; | |||
/* Resolve file conflicts to prefer Elf64 (if not forced) .. . */ | /* Resolve file conflicts to prefer Elf64 (if not forced) .. . */ | |||
if (tscolor != 0) { | if (tscolor != 0) { | |||
if (FColor & prefcolor) { | if (FColor & prefcolor) { | |||
/* ... last file of preferred colour is installed .. . */ | /* ... last file of preferred colour is installed .. . */ | |||
if (!iosmFileActionSkipped(fi->actions[i])) { | if (!iosmFileActionSkipped((iosmFileAction) fi->acti ons[i])) { | |||
#ifdef DEAD | #ifdef DEAD | |||
/* XXX static helpers are order dependent. Ick. */ | /* XXX static helpers are order dependent. Ick. */ | |||
if (strcmp(fn, "/usr/sbin/libgcc_post_upgrade") | if (strcmp(fn, "/usr/sbin/libgcc_post_upgrade") | |||
&& strcmp(fn, "/usr/sbin/glibc_post_upgrade")) | && strcmp(fn, "/usr/sbin/glibc_post_upgrade")) | |||
#endif | #endif | |||
otherFi->actions[otherFileNum] = FA_SKIPCOLO R; | otherFi->actions[otherFileNum] = FA_SKIPCOLO R; | |||
} | } | |||
fi->actions[i] = FA_CREATE; | fi->actions[i] = FA_CREATE; | |||
rConflicts = 0; | rConflicts = 0; | |||
} else | } else | |||
if (oFColor & prefcolor) { | if (oFColor & prefcolor) { | |||
/* ... first file of preferred colour is installed . .. */ | /* ... first file of preferred colour is installed . .. */ | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actio ns[i])) | |||
otherFi->actions[otherFileNum] = FA_CREATE; | otherFi->actions[otherFileNum] = FA_CREATE; | |||
fi->actions[i] = FA_SKIPCOLOR; | fi->actions[i] = FA_SKIPCOLOR; | |||
rConflicts = 0; | rConflicts = 0; | |||
} else | } else | |||
if (FColor == 0 && oFColor == 0) { | if (FColor == 0 && oFColor == 0) { | |||
/* ... otherwise, do both, last in wins. */ | /* ... otherwise, do both, last in wins. */ | |||
otherFi->actions[otherFileNum] = FA_CREATE; | otherFi->actions[otherFileNum] = FA_CREATE; | |||
fi->actions[i] = FA_CREATE; | fi->actions[i] = FA_CREATE; | |||
rConflicts = 0; | rConflicts = 0; | |||
} | } | |||
done = 1; | done = 1; | |||
} | } | |||
if (rConflicts) { | if (rConflicts) { | |||
rpmpsAppend(ps, RPMPROB_NEW_FILE_CONFLICT, | rpmpsAppend(ps, RPMPROB_NEW_FILE_CONFLICT, | |||
rpmteNEVR(p), rpmteKey(p), | rpmteNEVR(p), rpmteKey(p), | |||
fn, NULL, | fn, NULL, | |||
rpmteNEVR(otherFi->te), | rpmteNEVR((rpmte) otherFi->te), | |||
0); | 0); | |||
} | } | |||
} | } | |||
/* Try to get the disk accounting correct even if a conflict. */ | /* Try to get the disk accounting correct even if a conflict. */ | |||
fixupSize = rpmfiFSize(otherFi); | fixupSize = rpmfiFSize(otherFi); | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
if (rpmfiConfigConflict(fi)) | if (rpmfiConfigConflict(fi)) | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
if ((FFlags & RPMFILE_CONFIG) && (FFlags & RPMFILE_EXISTS)) | if (FF_ISSET(FFlags, CONFIG) && FF_ISSET(FFlags, EXISTS)) | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
{ | { | |||
/* Here is an overlapped pre-existing config file. */ | /* Here is an overlapped pre-existing config file. */ | |||
fi->actions[i] = (FFlags & RPMFILE_NOREPLACE) | fi->actions[i] = FF_ISSET(FFlags, NOREPLACE) | |||
? FA_ALTNAME : FA_SKIP; | ? FA_ALTNAME : FA_SKIP; | |||
} else { | } else { | |||
if (!done) | if (!done) | |||
fi->actions[i] = FA_CREATE; | fi->actions[i] = FA_CREATE; | |||
} | } | |||
} /*@switchbreak@*/ break; | } /*@switchbreak@*/ break; | |||
case TR_REMOVED: | case TR_REMOVED: | |||
if (otherPkgNum >= 0) { | if (otherPkgNum >= 0) { | |||
assert(otherFi != NULL); | assert(otherFi != NULL); | |||
/* Here is an overlapped added file we don't want to nuke. * / | /* Here is an overlapped added file we don't want to nuke. * / | |||
if (otherFi->actions[otherFileNum] != FA_ERASE) { | if (otherFi->actions[otherFileNum] != FA_ERASE) { | |||
/* On updates, don't remove files. */ | /* On updates, don't remove files. */ | |||
fi->actions[i] = FA_SKIP; | fi->actions[i] = FA_SKIP; | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
/* Here is an overlapped removed file: skip in previous. */ | /* Here is an overlapped removed file: skip in previous. */ | |||
otherFi->actions[otherFileNum] = FA_SKIP; | otherFi->actions[otherFileNum] = FA_SKIP; | |||
} | } | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
if (rpmfiFState(fi) != RPMFILE_STATE_NORMAL) | if (rpmfiFState(fi) != RPMFILE_STATE_NORMAL) | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
/* Disposition is assumed to be FA_ERASE. */ | /* Disposition is assumed to be FA_ERASE. */ | |||
fi->actions[i] = FA_ERASE; | fi->actions[i] = FA_ERASE; | |||
if (!(S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG))) | if (!(S_ISREG(FMode) && FF_ISSET(FFlags, CONFIG))) | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
/* Check for pre-existing modified config file that needs saving . */ | /* Check for pre-existing modified config file that needs saving . */ | |||
if (!(FFlags & RPMFILE_SPARSE)) | if (!FF_ISSET(FFlags,SPARSE)) | |||
{ int dalgo = 0; | { int dalgo = 0; | |||
size_t dlen = 0; | size_t dlen = 0; | |||
const unsigned char * digest = rpmfiDigest(fi, &dalgo, &dlen ); | const unsigned char * digest = rpmfiDigest(fi, &dalgo, &dlen ); | |||
unsigned char * fdigest; | unsigned char * fdigest; | |||
assert(digest != NULL); | assert(digest != NULL); | |||
fdigest = xcalloc(1, dlen); | fdigest = (unsigned char *) xcalloc(1, dlen); | |||
/* Save (by renaming) locally modified config files. */ | /* Save (by renaming) locally modified config files. */ | |||
if (!dodigest(dalgo, fn, fdigest, 0, NULL) | if (!dodigest(dalgo, fn, fdigest, 0, NULL) | |||
&& memcmp(digest, fdigest, dlen)) | && memcmp(digest, fdigest, dlen)) | |||
fi->actions[i] = FA_BACKUP; | fi->actions[i] = FA_BACKUP; | |||
fdigest = _free(fdigest); | fdigest = _free(fdigest); | |||
} | } | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
/* Update disk space info for a file. */ | /* Update disk space info for a file. */ | |||
skipping to change at line 477 | skipping to change at line 525 | |||
* @param p current transaction element | * @param p current transaction element | |||
* @param h installed header | * @param h installed header | |||
* @return 0 if not newer, 1 if okay | * @return 0 if not newer, 1 if okay | |||
*/ | */ | |||
/*@-nullpass@*/ | /*@-nullpass@*/ | |||
static int ensureOlder(rpmts ts, | static int ensureOlder(rpmts ts, | |||
const rpmte p, const Header h) | const rpmte p, const Header h) | |||
/*@globals internalState @*/ | /*@globals internalState @*/ | |||
/*@modifies ts, internalState @*/ | /*@modifies ts, internalState @*/ | |||
{ | { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
rpmuint32_t reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL); | evrFlags reqFlags = (evrFlags) (RPMSENSE_LESS | RPMSENSE_EQUAL); | |||
const char * reqEVR; | const char * reqEVR; | |||
rpmds req; | rpmds req; | |||
char * t; | char * t; | |||
size_t nb; | size_t nb; | |||
int rc; | int rc; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%p,%p)\n", __FUNCTION__, ts, p, h)); | FPSDEBUG(0, (stderr, "--> %s(%p,%p,%p)\n", __FUNCTION__, ts, p, h)); | |||
if (p == NULL || h == NULL) | if (p == NULL || h == NULL) | |||
return 1; | return 1; | |||
nb = strlen(rpmteNEVR(p)) + (rpmteE(p) != NULL ? strlen(rpmteE(p)) : 0) + 1; | nb = strlen(rpmteNEVR(p)) + (rpmteE(p) != NULL ? strlen(rpmteE(p)) : 0) + 1; | |||
#ifdef RPM_VENDOR_MANDRIVA | #ifdef RPM_VENDOR_MANDRIVA | |||
nb += (rpmteD(p) != NULL ? strlen(rpmteD(p)) + 1 : 0); | nb += (rpmteD(p) != NULL ? strlen(rpmteD(p)) + 1 : 0); | |||
#endif | #endif | |||
t = alloca(nb); | t = (char *) alloca(nb); | |||
*t = '\0'; | *t = '\0'; | |||
reqEVR = t; | reqEVR = t; | |||
if (rpmteE(p) != NULL) t = stpcpy( stpcpy(t, rpmteE(p)), ":"); | if (rpmteE(p) != NULL) t = stpcpy( stpcpy(t, rpmteE(p)), ":"); | |||
if (rpmteV(p) != NULL) t = stpcpy(t, rpmteV(p)); | if (rpmteV(p) != NULL) t = stpcpy(t, rpmteV(p)); | |||
*t++ = '-'; | *t++ = '-'; | |||
if (rpmteR(p) != NULL) t = stpcpy(t, rpmteR(p)); | if (rpmteR(p) != NULL) t = stpcpy(t, rpmteR(p)); | |||
#ifdef RPM_VENDOR_MANDRIVA | #ifdef RPM_VENDOR_MANDRIVA | |||
if (rpmteD(p) != NULL) *t++ = ':', t = stpcpy(t, rpmteD(p)); | if (rpmteD(p) != NULL) *t++ = ':', t = stpcpy(t, rpmteD(p)); | |||
#endif | #endif | |||
skipping to change at line 542 | skipping to change at line 590 | |||
* @param fi file info set | * @param fi file info set | |||
*/ | */ | |||
/*@-mustmod@*/ /* FIX: fi->actions is modified. */ | /*@-mustmod@*/ /* FIX: fi->actions is modified. */ | |||
/*@-nullpass@*/ | /*@-nullpass@*/ | |||
static void rpmtsSkipFiles(const rpmts ts, rpmfi fi) | static void rpmtsSkipFiles(const rpmts ts, rpmfi fi) | |||
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies fi, rpmGlobalMacroContext, internalState @*/ | /*@modifies fi, rpmGlobalMacroContext, internalState @*/ | |||
{ | { | |||
rpmuint32_t tscolor = rpmtsColor(ts); | rpmuint32_t tscolor = rpmtsColor(ts); | |||
rpmuint32_t FColor; | rpmuint32_t FColor; | |||
int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS); | rpmtransFlags tsflags = rpmtsFlags(ts); | |||
int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS); | int noConfigs = TSF_ISSET(tsflags, NOCONFIGS); | |||
int noDocs = TSF_ISSET(tsflags, NODOCS); | ||||
ARGV_t netsharedPaths = NULL; | ARGV_t netsharedPaths = NULL; | |||
ARGV_t languages = NULL; | ARGV_t languages = NULL; | |||
const char * dn, * bn; | const char * dn, * bn; | |||
size_t dnlen, bnlen; | size_t dnlen, bnlen; | |||
int ix; | int ix; | |||
const char * s; | const char * s; | |||
int * drc; | int * drc; | |||
char * dff; | char * dff; | |||
int dc; | int dc; | |||
int i, j; | int i, j; | |||
skipping to change at line 584 | skipping to change at line 633 | |||
s = rpmExpand("%{?_install_langs}", NULL); | s = rpmExpand("%{?_install_langs}", NULL); | |||
if (!(s && *s)) | if (!(s && *s)) | |||
s = _free(s); | s = _free(s); | |||
if (s) { | if (s) { | |||
xx = argvSplit(&languages, s, ":"); | xx = argvSplit(&languages, s, ":"); | |||
s = _free(s); | s = _free(s); | |||
} | } | |||
/* Compute directory refcount, skip directory if now empty. */ | /* Compute directory refcount, skip directory if now empty. */ | |||
dc = rpmfiDC(fi); | dc = rpmfiDC(fi); | |||
drc = alloca(dc * sizeof(*drc)); | drc = (int *) alloca(dc * sizeof(*drc)); | |||
memset(drc, 0, dc * sizeof(*drc)); | memset(drc, 0, dc * sizeof(*drc)); | |||
dff = alloca(dc * sizeof(*dff)); | dff = (char *) alloca(dc * sizeof(*dff)); | |||
memset(dff, 0, dc * sizeof(*dff)); | memset(dff, 0, dc * sizeof(*dff)); | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
if (fi != NULL) /* XXX lclint */ | if (fi != NULL) /* XXX lclint */ | |||
while ((i = rpmfiNext(fi)) >= 0) | while ((i = rpmfiNext(fi)) >= 0) | |||
{ | { | |||
ARGV_t nsp; | ARGV_t nsp; | |||
bn = rpmfiBN(fi); | bn = rpmfiBN(fi); | |||
bnlen = strlen(bn); | bnlen = strlen(bn); | |||
ix = rpmfiDX(fi); | ix = rpmfiDX(fi); | |||
dn = rpmfiDN(fi); | dn = rpmfiDN(fi); | |||
if (dn == NULL) | if (dn == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
dnlen = strlen(dn); | dnlen = strlen(dn); | |||
drc[ix]++; | drc[ix]++; | |||
/* Don't bother with skipped files */ | /* Don't bother with skipped files */ | |||
if (iosmFileActionSkipped(fi->actions[i])) { | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) { | |||
drc[ix]--; dff[ix] = 1; | drc[ix]--; dff[ix] = 1; | |||
continue; | continue; | |||
} | } | |||
/* Ignore colored files not in our rainbow. */ | /* Ignore colored files not in our rainbow. */ | |||
FColor = rpmfiFColor(fi); | FColor = rpmfiFColor(fi); | |||
if (tscolor && FColor && !(tscolor & FColor)) { | if (tscolor && FColor && !(tscolor & FColor)) { | |||
drc[ix]--; dff[ix] = 1; | drc[ix]--; dff[ix] = 1; | |||
fi->actions[i] = FA_SKIPCOLOR; | fi->actions[i] = FA_SKIPCOLOR; | |||
continue; | continue; | |||
skipping to change at line 688 | skipping to change at line 737 | |||
if (*lang == NULL) { | if (*lang == NULL) { | |||
drc[ix]--; dff[ix] = 1; | drc[ix]--; dff[ix] = 1; | |||
fi->actions[i] = FA_SKIPNSTATE; | fi->actions[i] = FA_SKIPNSTATE; | |||
continue; | continue; | |||
} | } | |||
} | } | |||
/* | /* | |||
* Skip config files if requested. | * Skip config files if requested. | |||
*/ | */ | |||
if (noConfigs && (rpmfiFFlags(fi) & RPMFILE_CONFIG)) { | if (noConfigs && FF_ISSET(rpmfiFFlags(fi), CONFIG)) { | |||
drc[ix]--; dff[ix] = 1; | drc[ix]--; dff[ix] = 1; | |||
fi->actions[i] = FA_SKIPNSTATE; | fi->actions[i] = FA_SKIPNSTATE; | |||
continue; | continue; | |||
} | } | |||
/* | /* | |||
* Skip documentation if requested. | * Skip documentation if requested. | |||
*/ | */ | |||
if (noDocs && (rpmfiFFlags(fi) & RPMFILE_DOC)) { | if (noDocs && FF_ISSET(rpmfiFFlags(fi), DOC)) { | |||
drc[ix]--; dff[ix] = 1; | drc[ix]--; dff[ix] = 1; | |||
fi->actions[i] = FA_SKIPNSTATE; | fi->actions[i] = FA_SKIPNSTATE; | |||
continue; | continue; | |||
} | } | |||
} | } | |||
/* Skip (now empty) directories that had skipped files. */ | /* Skip (now empty) directories that had skipped files. */ | |||
#ifndef NOTYET | #ifndef NOTYET | |||
if (fi != NULL) /* XXX can't happen */ | if (fi != NULL) /* XXX can't happen */ | |||
for (j = 0; j < dc; j++) | for (j = 0; j < dc; j++) | |||
skipping to change at line 733 | skipping to change at line 782 | |||
bn--; | bn--; | |||
} | } | |||
/* If explicitly included in the package, skip the directory. */ | /* If explicitly included in the package, skip the directory. */ | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
if (fi != NULL) /* XXX lclint */ | if (fi != NULL) /* XXX lclint */ | |||
while ((i = rpmfiNext(fi)) >= 0) { | while ((i = rpmfiNext(fi)) >= 0) { | |||
const char * fdn, * fbn; | const char * fdn, * fbn; | |||
rpmuint16_t fFMode; | rpmuint16_t fFMode; | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
fFMode = rpmfiFMode(fi); | fFMode = rpmfiFMode(fi); | |||
if (!S_ISDIR(fFMode)) | if (!S_ISDIR(fFMode)) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
fdn = rpmfiDN(fi); | fdn = rpmfiDN(fi); | |||
if (strlen(fdn) != dnlen) | if (strlen(fdn) != dnlen) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
if (strncmp(fdn, dn, dnlen)) | if (strncmp(fdn, dn, dnlen)) | |||
skipping to change at line 885 | skipping to change at line 934 | |||
size_t k = 0; | size_t k = 0; | |||
rpmbf bf; | rpmbf bf; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%u)\n", __FUNCTION__, ts, (unsigned)fileCou nt)); | FPSDEBUG(0, (stderr, "--> %s(%p,%u)\n", __FUNCTION__, ts, (unsigned)fileCou nt)); | |||
rpmbfParams(n, e, &m, &k); | rpmbfParams(n, e, &m, &k); | |||
bf = rpmbfNew(m, k, 0); | bf = rpmbfNew(m, k, 0); | |||
mi = rpmmiInit(rpmtsGetRdb(ts), _tag, NULL, 0); | mi = rpmmiInit(rpmtsGetRdb(ts), _tag, NULL, 0); | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
(void) rpmdbCheckSignals(); | (void) rpmdbCheckSignals(); | |||
if ((fi = rpmteFI(p, _tag)) == NULL) | if ((fi = rpmteFI(p, _tag)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_PROGRESS, rpmtsiOc(pi) , | ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_PROGRESS, rpmtsiOc(pi) , | |||
ts->orderCount); | ts->orderCount); | |||
/* Gather all installed headers with matching basename's. */ | /* Gather all installed headers with matching basename's. */ | |||
skipping to change at line 931 | skipping to change at line 980 | |||
* and then check for matching finger prints | * and then check for matching finger prints | |||
* @param ts transaction set | * @param ts transaction set | |||
* @param fpc global finger print cache | * @param fpc global finger print cache | |||
*/ | */ | |||
static | static | |||
int rpmtsCheckInstalledFiles(rpmts ts, uint32_t fileCount, | int rpmtsCheckInstalledFiles(rpmts ts, uint32_t fileCount, | |||
hashTable ht, fingerPrintCache fpc) | hashTable ht, fingerPrintCache fpc) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies ts, fpc, rpmGlobalMacroContext, h_errno, fileSystem, int ernalState @*/ | /*@modifies ts, fpc, rpmGlobalMacroContext, h_errno, fileSystem, int ernalState @*/ | |||
{ | { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
rpmTagData BN = { .ptr = NULL }; | rpmTagData BN = { NULL }; | |||
rpmTagData DN = { .ptr = NULL }; | rpmTagData DN = { NULL }; | |||
rpmTagData DI = { .ptr = NULL }; | rpmTagData DI = { NULL }; | |||
rpmTagData FSTATES = { .ptr = NULL }; | rpmTagData FSTATES = { NULL }; | |||
rpmuint32_t fc; | rpmuint32_t fc; | |||
rpmte p; | rpmte p; | |||
rpmmi mi; | rpmmi mi; | |||
Header h; | Header h; | |||
rpmfi fi; | rpmfi fi; | |||
const char * oldDir; | const char * oldDir; | |||
int beingRemoved; | int beingRemoved; | |||
rpmfi otherFi = NULL; | rpmfi otherFi = NULL; | |||
skipping to change at line 1146 | skipping to change at line 1195 | |||
* leading to packages of same VRA but with different epoch or d istepoch | * leading to packages of same VRA but with different epoch or d istepoch | |||
* being treated as the same package */ | * being treated as the same package */ | |||
if (nkeys > 0) { | if (nkeys > 0) { | |||
int i, t; | int i, t; | |||
rpmTag tags[2] = { RPMTAG_EPOCH, RPMTAG_DISTEPOCH }; | rpmTag tags[2] = { RPMTAG_EPOCH, RPMTAG_DISTEPOCH }; | |||
for (t = 0; t < 2; t++) { | for (t = 0; t < 2; t++) { | |||
for (i = 0; i < nkeys; i++) { | for (i = 0; i < nkeys; i++) { | |||
rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, keys[i ], 0); | rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, keys[i ], 0); | |||
Header h; | Header h; | |||
while ((h = rpmmiNext(mi)) != NULL) { | while ((h = rpmmiNext(mi)) != NULL) { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof( *he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
const char *val = NULL; | const char *val = NULL; | |||
he->tag = tags[t]; | he->tag = tags[t]; | |||
xx = headerGet(h, he, 0); | xx = headerGet(h, he, 0); | |||
if (he->tag == RPMTAG_EPOCH) | if (he->tag == RPMTAG_EPOCH) | |||
val = rpmteE(p); | val = rpmteE(p); | |||
else if (he->tag == RPMTAG_DISTEPOCH) | else if (he->tag == RPMTAG_DISTEPOCH) | |||
val = rpmteD(p); | val = rpmteD(p); | |||
if (strcmp(he->p.str ? he->p.str : "", val ? val : "")) | if (strcmp(he->p.str ? he->p.str : "", val ? val : "")) | |||
nkeys--; | nkeys--; | |||
he->p.ptr = _free(he->p.ptr); | he->p.ptr = _free(he->p.ptr); | |||
skipping to change at line 1274 | skipping to change at line 1323 | |||
{ | { | |||
rpmtsi pi; | rpmtsi pi; | |||
rpmte p; | rpmte p; | |||
rpmfi fi; | rpmfi fi; | |||
int i; | int i; | |||
hashTable symlinks = htCreate(fileCount/16+16, 0, 0, fpHashFunction, fp Equal); | hashTable symlinks = htCreate(fileCount/16+16, 0, 0, fpHashFunction, fp Equal); | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%u,%p,%p)\n", __FUNCTION__, ts, (unsigned)f ileCount, ht, fpc)); | FPSDEBUG(0, (stderr, "--> %s(%p,%u,%p,%p)\n", __FUNCTION__, ts, (unsigned)f ileCount, ht, fpc)); | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
(void) rpmdbCheckSignals(); | (void) rpmdbCheckSignals(); | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
if ((fi = rpmtsiFi(pi)) == NULL) | if ((fi = rpmtsiFi(pi)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | |||
rpmfiFpLookup(fi, fpc); | rpmfiFpLookup(fi, fpc); | |||
/* Collect symlinks. */ | /* Collect symlinks. */ | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
if (fi != NULL) /* XXX lclint */ | if (fi != NULL) /* XXX lclint */ | |||
while ((i = rpmfiNext(fi)) >= 0) { | while ((i = rpmfiNext(fi)) >= 0) { | |||
char const *linktarget; | char const *linktarget; | |||
linktarget = rpmfiFLink(fi); | linktarget = rpmfiFLink(fi); | |||
if (!(linktarget && *linktarget != '\0')) | if (!(linktarget && *linktarget != '\0')) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
{ struct rpmffi_s ffi; | { struct rpmffi_s ffi; | |||
ffi.p = p; | ffi.p = p; | |||
ffi.fileno = i; | ffi.fileno = i; | |||
htAddEntry(symlinks, rpmfiFpsIndex(fi, i), ffi); | htAddEntry(symlinks, rpmfiFpsIndex(fi, i), ffi); | |||
} | } | |||
#else | #else | |||
{ struct rpmffi_s *ffip = alloca(sizeof(*ffip)); | { struct rpmffi_s *ffip = (struct rpmffi_s *) alloca(sizeof(*f fip)); | |||
/*@-dependenttrans@*/ | /*@-dependenttrans@*/ | |||
ffip->p = p; | ffip->p = p; | |||
/*@=dependenttrans@*/ | /*@=dependenttrans@*/ | |||
ffip->fileno = i; | ffip->fileno = i; | |||
htAddEntry(symlinks, fi->fps + i, (void *) ffip); | htAddEntry(symlinks, fi->fps + i, (void *) ffip); | |||
} | } | |||
#endif | #endif | |||
} | } | |||
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), rpmfiFC(fi)); | (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), rpmfiFC(fi)); | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
/* =============================================== | /* =============================================== | |||
* Check fingerprints if they contain symlinks | * Check fingerprints if they contain symlinks | |||
* and add them to the hash table | * and add them to the hash table | |||
*/ | */ | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
(void) rpmdbCheckSignals(); | (void) rpmdbCheckSignals(); | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
if ((fi = rpmteFI(p, RPMTAG_BASENAMES)) == NULL) | if ((fi = rpmteFI(p, RPMTAG_BASENAMES)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | |||
while ((i = rpmfiNext(fi)) >= 0) { | while ((i = rpmfiNext(fi)) >= 0) { | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
if (XFA_SKIPPING(rpmfsGetAction(rpmteGetFileStates(p), i))) | if (XFA_SKIPPING(rpmfsGetAction(rpmteGetFileStates(p), i))) | |||
continue; | continue; | |||
#else | #else | |||
if (iosmFileActionSkipped(fi->actions[i])) | if (iosmFileActionSkipped((iosmFileAction) fi->actions[i])) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
#endif | #endif | |||
fpLookupSubdir(symlinks, ht, fpc, p, i); | fpLookupSubdir(symlinks, ht, fpc, p, i); | |||
} | } | |||
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
symlinks = htFree(symlinks); | symlinks = htFree(symlinks); | |||
} | } | |||
static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet, rpmsx * sxp) | static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet, rpmsx * sxp) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies ts, *sxp, rpmGlobalMacroContext, h_errno, fileSystem, in ternalState @*/ | /*@modifies ts, *sxp, rpmGlobalMacroContext, h_errno, fileSystem, in ternalState @*/ | |||
{ | { | |||
rpmtransFlags tsflags = rpmtsFlags(ts); | ||||
int xx; | int xx; | |||
/*@+voidabstract@*/ | /*@+voidabstract@*/ | |||
FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%p)\n", __FUNCTION__, ts, ignoreSet, ( void *)sxp)); | FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%p)\n", __FUNCTION__, ts, ignoreSet, ( void *)sxp)); | |||
/*@=voidabstract@*/ | /*@=voidabstract@*/ | |||
/* --noscripts implies no scripts or triggers, duh. */ | /* --noscripts implies no scripts or triggers, duh. */ | |||
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS) | if (TSF_ISSET(tsflags, NOSCRIPTS)) { | |||
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTran | TSF_SET(tsflags, NOPRETRANS); | |||
sTriggers)); | TSF_SET(tsflags, NOPRE); | |||
TSF_SET(tsflags, NOPOST); | ||||
TSF_SET(tsflags, NOPREUN); | ||||
TSF_SET(tsflags, NOPOSTUN); | ||||
TSF_SET(tsflags, NOPOSTTRANS); | ||||
TSF_SET(tsflags, NOTRIGGERPREIN); | ||||
TSF_SET(tsflags, NOTRIGGERIN); | ||||
TSF_SET(tsflags, NOTRIGGERUN); | ||||
TSF_SET(tsflags, NOTRIGGERPOSTUN); | ||||
(void) rpmtsSetFlags(ts, tsflags); | ||||
} | ||||
/* --notriggers implies no triggers, duh. */ | /* --notriggers implies no triggers, duh. */ | |||
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERS) | if (TSF_ISSET(tsflags, NOTRIGGERS)) { | |||
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransTriggers)); | TSF_SET(tsflags, NOTRIGGERPREIN); | |||
TSF_SET(tsflags, NOTRIGGERIN); | ||||
TSF_SET(tsflags, NOTRIGGERUN); | ||||
TSF_SET(tsflags, NOTRIGGERPOSTUN); | ||||
(void) rpmtsSetFlags(ts, tsflags); | ||||
} | ||||
/* --justdb implies no scripts or triggers, duh. */ | /* --justdb implies no scripts or triggers, duh. */ | |||
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) | if (TSF_ISSET(tsflags, JUSTDB)) { | |||
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTran | TSF_SET(tsflags, NOPRETRANS); | |||
sTriggers)); | TSF_SET(tsflags, NOPRE); | |||
TSF_SET(tsflags, NOPOST); | ||||
TSF_SET(tsflags, NOPREUN); | ||||
TSF_SET(tsflags, NOPOSTUN); | ||||
TSF_SET(tsflags, NOPOSTTRANS); | ||||
TSF_SET(tsflags, NOTRIGGERPREIN); | ||||
TSF_SET(tsflags, NOTRIGGERIN); | ||||
TSF_SET(tsflags, NOTRIGGERUN); | ||||
TSF_SET(tsflags, NOTRIGGERPOSTUN); | ||||
(void) rpmtsSetFlags(ts, tsflags); | ||||
} | ||||
/* if SELinux isn't enabled or init fails, don't bother... */ | /* if SELinux isn't enabled or init fails, don't bother... */ | |||
if (!rpmtsSELinuxEnabled(ts)) | if (!rpmtsSELinuxEnabled(ts)) { | |||
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | (RPMTRANS_FLAG_NOCONTEXTS | TSF_SET(tsflags, NOCONTEXTS); | |||
|RPMTRANS_FLAG_NOPOLICY))); | TSF_SET(tsflags, NOPOLICY); | |||
(void) rpmtsSetFlags(ts, tsflags); | ||||
} | ||||
if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOCONTEXTS|RPMTRANS_FLAG_NOPOLICY ))) { | if (!(TSF_ISSET(tsflags, NOCONTEXTS) || TSF_ISSET(tsflags, NOPOLICY))) { | |||
*sxp = rpmsxNew("%{?_install_file_context_path}", 0); | *sxp = rpmsxNew("%{?_install_file_context_path}", 0); | |||
if (*sxp == NULL) | if (*sxp == NULL) { | |||
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | (RPMTRANS_FLAG_NOCONT | TSF_SET(tsflags, NOCONTEXTS); | |||
EXTS|RPMTRANS_FLAG_NOPOLICY))); | TSF_SET(tsflags, NOPOLICY); | |||
(void) rpmtsSetFlags(ts, tsflags); | ||||
} | ||||
} else | } else | |||
*sxp = NULL; | *sxp = NULL; | |||
/* XXX Make sure the database is open RDWR for package install/erase. * / | /* XXX Make sure the database is open RDWR for package install/erase. * / | |||
{ int dbmode = O_RDONLY; | { int dbmode = O_RDONLY; | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) { | if (!TSF_ISSET(tsflags, TEST)) { | |||
rpmtsi pi; | rpmtsi pi; | |||
rpmte p; | rpmte p; | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
dbmode = (O_RDWR|O_CREAT); | dbmode = (O_RDWR|O_CREAT); | |||
break; | break; | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
} | } | |||
/* Open database RDWR for installing packages. */ | /* Open database RDWR for installing packages. */ | |||
if (rpmtsOpenDB(ts, dbmode)) | if (rpmtsOpenDB(ts, dbmode)) | |||
return -1; /* XXX W2DO? */ | return -1; /* XXX W2DO? */ | |||
skipping to change at line 1427 | skipping to change at line 1514 | |||
xx = rpmtsInitDSI(ts); | xx = rpmtsInitDSI(ts); | |||
return 0; | return 0; | |||
} | } | |||
static int rpmtsFinish(rpmts ts, /*@only@*/ rpmsx sx) | static int rpmtsFinish(rpmts ts, /*@only@*/ rpmsx sx) | |||
/*@modifies sx @*/ | /*@modifies sx @*/ | |||
{ | { | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%p)\n", __FUNCTION__, ts, sx)); | FPSDEBUG(0, (stderr, "--> %s(%p,%p)\n", __FUNCTION__, ts, sx)); | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS)) { | rpmtransFlags tsflags = rpmtsFlags(ts); | |||
if (!TSF_ISSET(tsflags, NOCONTEXTS)) | ||||
matchpathcon_fini(); | matchpathcon_fini(); | |||
} | ||||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
if (sx != NULL) sx = rpmsxFree(sx); | if (sx != NULL) sx = rpmsxFree(sx); | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
return 0; | return 0; | |||
} | } | |||
static int rpmtsPrepare(rpmts ts, rpmsx sx, uint32_t fileCount, | static int rpmtsPrepare(rpmts ts, rpmsx sx, uint32_t fileCount, | |||
uint32_t * nrmvdp) | uint32_t * nrmvdp) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies ts, *nrmvdp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@modifies ts, *nrmvdp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
skipping to change at line 1496 | skipping to change at line 1583 | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
void * ptr; | void * ptr; | |||
uint32_t numAdded = 0; | uint32_t numAdded = 0; | |||
uint32_t numRemoved = 0; | uint32_t numRemoved = 0; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%p,%u,%p)\n", __FUNCTION__, ts, sx, (unsign ed)fileCount, nrmvdp)); | FPSDEBUG(0, (stderr, "--> %s(%p,%p,%u,%p)\n", __FUNCTION__, ts, sx, (unsign ed)fileCount, nrmvdp)); | |||
rpmlog(RPMLOG_DEBUG, D_("computing %u file fingerprints\n"), (unsigned)file Count); | rpmlog(RPMLOG_DEBUG, D_("computing %u file fingerprints\n"), (unsigned)file Count); | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
int fc; | int fc; | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
if ((fi = rpmtsiFi(pi)) == NULL) | if ((fi = rpmtsiFi(pi)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
fc = rpmfiFC(fi); | fc = rpmfiFC(fi); | |||
switch (rpmteType(p)) { | switch (rpmteType(p)) { | |||
case TR_ADDED: | case TR_ADDED: | |||
numAdded++; | numAdded++; | |||
skipping to change at line 1518 | skipping to change at line 1605 | |||
/* Skip netshared paths, not our i18n files, and excluded docs * / | /* Skip netshared paths, not our i18n files, and excluded docs * / | |||
if (fc > 0) | if (fc > 0) | |||
rpmtsSkipFiles(ts, fi); | rpmtsSkipFiles(ts, fi); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case TR_REMOVED: | case TR_REMOVED: | |||
numRemoved++; | numRemoved++; | |||
fi->record = rpmteDBOffset(p); | fi->record = rpmteDBOffset(p); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
fi->fps = (fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL); | fi->fps = (struct fingerPrint_s *) | |||
(fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL); | ||||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
if (nrmvdp) | if (nrmvdp) | |||
*nrmvdp = numRemoved; | *nrmvdp = numRemoved; | |||
if (!rpmtsChrootDone(ts)) { | if (!rpmtsChrootDone(ts)) { | |||
const char * rootDir = rpmtsRootDir(ts); | const char * rootDir = rpmtsRootDir(ts); | |||
static int openall_before_chroot = -1; | static int openall_before_chroot = -1; | |||
skipping to change at line 1571 | skipping to change at line 1659 | |||
*/ | */ | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmtsCheckInstalledFiles(ts, fileCount, ht, fpc); | rpmtsCheckInstalledFiles(ts, fileCount, ht, fpc); | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
rc = rpmtsCheckInstalledFiles(ts, fileCount, ts->ht, fpc); | rc = rpmtsCheckInstalledFiles(ts, fileCount, ts->ht, fpc); | |||
if (rc) | if (rc) | |||
goto exit; | goto exit; | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
if ((fi = rpmteFI(p, RPMTAG_BASENAMES)) == NULL) | if ((fi = rpmteFI(p, RPMTAG_BASENAMES)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
/* XXX Set all SRPM files to FA_CREATE. */ | /* XXX Set all SRPM files to FA_CREATE. */ | |||
if (p->isSource) { | if (p->isSource) { | |||
int i; | int i; | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
if (fi != NULL) | if (fi != NULL) | |||
while ((i = rpmfiNext(fi)) >= 0) | while ((i = rpmfiNext(fi)) >= 0) | |||
fi->actions[i] = FA_CREATE; | fi->actions[i] = FA_CREATE; | |||
continue; | continue; | |||
skipping to change at line 1626 | skipping to change at line 1714 | |||
xx = Chdir(currDir); | xx = Chdir(currDir); | |||
} | } | |||
ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_STOP, 6, ts->orderCount); | ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_STOP, 6, ts->orderCount); | |||
/* =============================================== | /* =============================================== | |||
* Free unused memory as soon as possible. | * Free unused memory as soon as possible. | |||
*/ | */ | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
rpmteSetFI(p, NULL); | rpmteSetFI(p, NULL); | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
if ((fi = rpmtsiFi(pi)) == NULL) | if ((fi = rpmtsiFi(pi)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
if (rpmfiFC(fi) == 0) | if (rpmfiFC(fi) == 0) | |||
continue; | continue; | |||
fi->fps = _free(fi->fps); | fi->fps = _free(fi->fps); | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
skipping to change at line 1668 | skipping to change at line 1756 | |||
int rollbackFailures) | int rollbackFailures) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies ts, rpmGlobalMacroContext, h_errno, fileSystem, internal State @*/ | /*@modifies ts, rpmGlobalMacroContext, h_errno, fileSystem, internal State @*/ | |||
{ | { | |||
rpmtsi pi; | rpmtsi pi; | |||
rpmte p; | rpmte p; | |||
int rc = 0; | int rc = 0; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%d)\n", __FUNCTION__, ts, ignoreSet, r ollbackFailures)); | FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%d)\n", __FUNCTION__, ts, ignoreSet, r ollbackFailures)); | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
rpmfi fi; | rpmfi fi; | |||
rpmop sw; | rpmop sw; | |||
rpmpsm psm = NULL; | rpmpsm psm = NULL; | |||
pkgStage stage = PSM_UNKNOWN; | pkgStage stage = PSM_UNKNOWN; | |||
int failed; | int failed; | |||
int gotfd; | int gotfd; | |||
int xx; | int xx; | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
rpmElementType tetype = rpmteType(p); | rpmElementType tetype = rpmteType(p); | |||
skipping to change at line 1788 | skipping to change at line 1876 | |||
} | } | |||
#else /* REFERENCE */ | #else /* REFERENCE */ | |||
(void) rpmswEnter(sw, 0); | (void) rpmswEnter(sw, 0); | |||
failed = (rpmpsmStage(psm, stage) != RPMRC_OK); | failed = (rpmpsmStage(psm, stage) != RPMRC_OK); | |||
(void) rpmswExit(sw, 0); | (void) rpmswExit(sw, 0); | |||
#endif /* REFERENCE */ | #endif /* REFERENCE */ | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
#if defined(RPM_VENDOR_MANDRIVA) | #if defined(RPM_VENDOR_MANDRIVA) | |||
if (!failed && !(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) { | { rpmtransFlags tsflags = rpmtsFlags(ts); | |||
if(!rpmteIsSource(p)) | if (!failed && !TSF_ISSET(tsflags, TEST)) { | |||
xx = mayAddToFilesAwaitingFiletriggers(rpmtsRootDir(ts), | if(!rpmteIsSource(p)) | |||
xx = mayAddToFilesAwaitingFiletriggers(rpmtsRootDir(ts), | ||||
fi, (rpmteType(p) == TR_ADDED ? 1 : 0)); | fi, (rpmteType(p) == TR_ADDED ? 1 : 0)); | |||
p->done = 1; | p->done = 1; | |||
} | ||||
} | } | |||
#endif | #endif | |||
/*@-nullstate@*/ /* FIX: psm->fi may be NULL */ | /*@-nullstate@*/ /* FIX: psm->fi may be NULL */ | |||
psm = rpmpsmFree(psm, __FUNCTION__); | psm = rpmpsmFree(psm, __FUNCTION__); | |||
/*@=nullstate@*/ | /*@=nullstate@*/ | |||
if (failed) { | if (failed) { | |||
rc++; | rc++; | |||
#ifdef REFERENCE | #ifdef REFERENCE | |||
skipping to change at line 1835 | skipping to change at line 1925 | |||
} | } | |||
pi = rpmtsiFree(pi); | pi = rpmtsiFree(pi); | |||
return rc; | return rc; | |||
} | } | |||
/* ================================================================= */ | /* ================================================================= */ | |||
static int rpmtsRepackage(rpmts ts, uint32_t numRemoved) | static int rpmtsRepackage(rpmts ts, uint32_t numRemoved) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies ts, rpmGlobalMacroContext, h_errno, fileSystem, internal State @*/ | /*@modifies ts, rpmGlobalMacroContext, h_errno, fileSystem, internal State @*/ | |||
{ | { | |||
rpmtransFlags tsflags = rpmtsFlags(ts); | ||||
rpmpsm psm; | rpmpsm psm; | |||
rpmfi fi; | rpmfi fi; | |||
rpmtsi pi; | rpmtsi pi; | |||
rpmte p; | rpmte p; | |||
void * ptr; | void * ptr; | |||
int progress = 0; | int progress = 0; | |||
int rc = 0; | int rc = 0; | |||
int xx; | int xx; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%u)\n", __FUNCTION__, ts, (unsigned)numRemo ved)); | FPSDEBUG(0, (stderr, "--> %s(%p,%u)\n", __FUNCTION__, ts, (unsigned)numRemo ved)); | |||
pi = rpmtsiInit(ts); | pi = rpmtsiInit(ts); | |||
while ((p = rpmtsiNext(pi, 0)) != NULL) { | while ((p = rpmtsiNext(pi, (rpmElementType) 0)) != NULL) { | |||
(void) rpmdbCheckSignals(); | (void) rpmdbCheckSignals(); | |||
if (p->isSource) continue; | if (p->isSource) continue; | |||
if ((fi = rpmtsiFi(pi)) == NULL) | if ((fi = rpmtsiFi(pi)) == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
switch (rpmteType(p)) { | switch (rpmteType(p)) { | |||
case TR_ADDED: | case TR_ADDED: | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case TR_REMOVED: | case TR_REMOVED: | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE)) | if (!TSF_ISSET(tsflags, REPACKAGE)) | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
if (!progress) | if (!progress) | |||
ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_REPACKAGE_START, | ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_REPACKAGE_START, | |||
7, numRemoved); | 7, numRemoved); | |||
ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_REPACKAGE_PROGRESS, | ptr = rpmtsNotify(ts, NULL, RPMCALLBACK_REPACKAGE_PROGRESS, | |||
progress, numRemoved); | progress, numRemoved); | |||
progress++; | progress++; | |||
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0); | (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0); | |||
skipping to change at line 1926 | skipping to change at line 2017 | |||
* This will allow us to add the failed package as an erase | * This will allow us to add the failed package as an erase | |||
* to the rollback transaction. This must be done because we | * to the rollback transaction. This must be done because we | |||
* want the the erase scriptlets to run, and the only way that | * want the the erase scriptlets to run, and the only way that | |||
* is going is if the header is in the rpmdb. | * is going is if the header is in the rpmdb. | |||
*/ | */ | |||
assert(psm != NULL); | assert(psm != NULL); | |||
psm->stepName = "failed"; /* XXX W2DO? */ | psm->stepName = "failed"; /* XXX W2DO? */ | |||
rc = rpmpsmStage(psm, PSM_RPMDB_ADD); | rc = rpmpsmStage(psm, PSM_RPMDB_ADD); | |||
psm = rpmpsmFree(psm, __FUNCTION__); | psm = rpmpsmFree(psm, __FUNCTION__); | |||
} | } | |||
return rc; | return (rpmRC) rc; | |||
} | } | |||
/*@=nullpass@*/ | /*@=nullpass@*/ | |||
/*@-nullpass@*/ | /*@-nullpass@*/ | |||
rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet, int running, rpmte rbte) | rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet, int running, rpmte rbte) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies rbts, rpmGlobalMacroContext, fileSystem, internalState @ */ | /*@modifies rbts, rpmGlobalMacroContext, fileSystem, internalState @ */ | |||
{ | { | |||
const char * semfn = NULL; | const char * semfn = NULL; | |||
rpmRC rc = 0; | rpmRC rc = (rpmRC) 0; | |||
rpmuint32_t arbgoal = rpmtsARBGoal(rbts); | rpmuint32_t arbgoal = rpmtsARBGoal(rbts); | |||
QVA_t ia = memset(alloca(sizeof(*ia)), 0, sizeof(*ia)); | QVA_t ia = (QVA_t) memset(alloca(sizeof(*ia)), 0, sizeof(*ia)); | |||
time_t ttid; | time_t ttid; | |||
int xx; | int xx; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%d,%p)\n", __FUNCTION__, rbts, ignoreS et, running, rbte)); | FPSDEBUG(0, (stderr, "--> %s(%p,0x%x,%d,%p)\n", __FUNCTION__, rbts, ignoreS et, running, rbte)); | |||
/* Don't attempt rollback's of rollback transactions */ | /* Don't attempt rollback's of rollback transactions */ | |||
if ((rpmtsType(rbts) & RPMTRANS_TYPE_ROLLBACK) || | if ((rpmtsType(rbts) & RPMTRANS_TYPE_ROLLBACK) || | |||
(rpmtsType(rbts) & RPMTRANS_TYPE_AUTOROLLBACK)) | (rpmtsType(rbts) & RPMTRANS_TYPE_AUTOROLLBACK)) | |||
return RPMRC_OK; | return RPMRC_OK; | |||
if (arbgoal == 0xffffffff) | if (arbgoal == 0xffffffff) | |||
skipping to change at line 1971 | skipping to change at line 2062 | |||
rpmte te; | rpmte te; | |||
/* XXX Insure an O_RDWR rpmdb. */ | /* XXX Insure an O_RDWR rpmdb. */ | |||
xx = rpmtsOpenDB(rbts, O_RDWR); | xx = rpmtsOpenDB(rbts, O_RDWR); | |||
tsi = rpmtsiInit(rbts); | tsi = rpmtsiInit(rbts); | |||
while((te = rpmtsiNext(tsi, TR_REMOVED)) != NULL) { | while((te = rpmtsiNext(tsi, TR_REMOVED)) != NULL) { | |||
if (te->isSource) continue; | if (te->isSource) continue; | |||
if(!te->u.removed.dboffset) | if(!te->u.removed.dboffset) | |||
continue; | continue; | |||
rc = rpmdbRemove(rpmtsGetRdb(rbts), | rc = (rpmRC) rpmdbRemove(rpmtsGetRdb(rbts), | |||
rpmtsGetTid(rbts), | rpmtsGetTid(rbts), | |||
te->u.removed.dboffset, NULL); | te->u.removed.dboffset, NULL); | |||
if (rc != RPMRC_OK) { | if (rc != RPMRC_OK) { | |||
rpmlog(RPMLOG_ERR, _("rpmdb erase failed. NEVRA: %s\n"), | rpmlog(RPMLOG_ERR, _("rpmdb erase failed. NEVRA: %s\n"), | |||
rpmteNEVRA(te)); | rpmteNEVRA(te)); | |||
break; | break; | |||
} | } | |||
} | } | |||
tsi = rpmtsiFree(tsi); | tsi = rpmtsiFree(tsi); | |||
if (rc != RPMRC_OK) | if (rc != RPMRC_OK) | |||
skipping to change at line 2001 | skipping to change at line 2092 | |||
ttid = (time_t)arbgoal; | ttid = (time_t)arbgoal; | |||
rpmlog(RPMLOG_NOTICE, _("Rollback to %-24.24s (0x%08x)\n"), | rpmlog(RPMLOG_NOTICE, _("Rollback to %-24.24s (0x%08x)\n"), | |||
ctime(&ttid), arbgoal); | ctime(&ttid), arbgoal); | |||
/* Set the verify signature flags: | /* Set the verify signature flags: | |||
* - can't verify signatures/digests on repackaged packages. | * - can't verify signatures/digests on repackaged packages. | |||
* - header check are out. | * - header check are out. | |||
*/ | */ | |||
{ | { | |||
rpmVSFlags vsflags = rpmExpandNumeric("%{?_vsflags_erase}"); | rpmVSFlags vsflags = (rpmVSFlags) rpmExpandNumeric("%{?_vsflags_eras | |||
vsflags = 0; /* XXX FIXME: ignore default disablers. */ | e}"); | |||
vsflags |= _RPMVSF_NODIGESTS; | vsflags = (rpmVSFlags) 0; /* XXX FIXME: ignore default disablers. */ | |||
vsflags |= _RPMVSF_NOSIGNATURES; | #if defined(SUPPORT_NOSIGNATURES) | |||
vsflags |= RPMVSF_NOHDRCHK; | /* --nodigest */ | |||
vsflags |= RPMVSF_NEEDPAYLOAD; | VSF_SET(vsflags, NOSHA1HEADER); | |||
VSF_SET(vsflags, NOMD5HEADER); | ||||
VSF_SET(vsflags, NOSHA1); | ||||
VSF_SET(vsflags, NOMD5); | ||||
/* --nosignature */ | ||||
VSF_SET(vsflags, NODSAHEADER); | ||||
VSF_SET(vsflags, NORSAHEADER); | ||||
VSF_SET(vsflags, NODSA); | ||||
VSF_SET(vsflags, NORSA); | ||||
/* --nohdrchk */ | ||||
VSF_SET(vsflags, NOHDRCHK); | ||||
VSF_SET(vsflags, NEEDPAYLOAD); /* XXX needed? */ | ||||
#endif | ||||
xx = rpmtsSetVSFlags(rbts, vsflags); | xx = rpmtsSetVSFlags(rbts, vsflags); | |||
} | } | |||
/* Set transaction flags to be the same as the running transaction */ | /* Set transaction flags to be the same as the running transaction */ | |||
{ | { | |||
rpmtransFlags tsFlags = rpmtsFlags(rbts); | rpmtransFlags tsflags = rpmtsFlags(rbts); | |||
tsFlags &= ~RPMTRANS_FLAG_DIRSTASH; /* No repackage of rollbacks | TSF_CLR(tsflags, DIRSTASH); /* No repackage of rollbacks */ | |||
*/ | TSF_CLR(tsflags, REPACKAGE); /* No repackage of rollbacks */ | |||
tsFlags &= ~RPMTRANS_FLAG_REPACKAGE; /* No repackage of rollbacks | TSF_SET(tsflags, NOFDIGESTS); /* Don't check file digests */ | |||
*/ | tsflags = rpmtsSetFlags(rbts, tsflags); | |||
tsFlags |= RPMTRANS_FLAG_NOFDIGESTS; /* Don't check file digests | ||||
*/ | ||||
tsFlags = rpmtsSetFlags(rbts, tsFlags); | ||||
} | } | |||
/* Create install arguments structure */ | /* Create install arguments structure */ | |||
ia->rbtid = arbgoal; | ia->rbtid = arbgoal; | |||
/* transFlags/depFlags from rbts, (re-)set in rpmRollback(). */ | /* transFlags/depFlags from rbts, (re-)set in rpmRollback(). */ | |||
ia->transFlags = rpmtsFlags(rbts); | ia->transFlags = rpmtsFlags(rbts); | |||
ia->depFlags = rpmtsDFlags(rbts); | ia->depFlags = rpmtsDFlags(rbts); | |||
/* XXX probFilter is normally set in main(). */ | /* XXX probFilter is normally set in main(). */ | |||
ia->probFilter = ignoreSet; /* XXX RPMPROB_FILTER_NONE? */ | ia->probFilter = ignoreSet; /* XXX RPMPROB_FILTER_NONE? */ | |||
/* XXX installInterfaceFlags is normally set in main(). */ | /* XXX installInterfaceFlags is normally set in main(). */ | |||
ia->installInterfaceFlags = INSTALL_UPGRADE | INSTALL_HASH ; | IIF_SET(ia->installInterfaceFlags, UPGRADE); | |||
IIF_SET(ia->installInterfaceFlags, HASH); | ||||
/* rpmtsCheck and rpmtsOrder failures do not have links. */ | /* rpmtsCheck and rpmtsOrder failures do not have links. */ | |||
ia->no_rollback_links = 1; | ia->no_rollback_links = 1; | |||
/* Create a file semaphore. */ | /* Create a file semaphore. */ | |||
semfn = rpmExpand("%{?semaphore_backout}", NULL); | semfn = rpmExpand("%{?semaphore_backout}", NULL); | |||
if (semfn && *semfn) { | if (semfn && *semfn) { | |||
FD_t fd = Fopen(semfn, "w.fdio"); | FD_t fd = Fopen(semfn, "w.fdio"); | |||
if (fd) | if (fd) | |||
xx = Fclose(fd); | xx = Fclose(fd); | |||
} | } | |||
/*@-compmempass@*/ | /*@-compmempass@*/ | |||
rc = rpmRollback(rbts, ia, NULL); | rc = (rpmRC) rpmRollback(rbts, ia, NULL); | |||
/*@=compmempass@*/ | /*@=compmempass@*/ | |||
cleanup: | cleanup: | |||
/* Remove the file semaphore. */ | /* Remove the file semaphore. */ | |||
if (semfn && *semfn) | if (semfn && *semfn) | |||
xx = Unlink(semfn); | xx = Unlink(semfn); | |||
semfn = _free(semfn); | semfn = _free(semfn); | |||
return rc; | return rc; | |||
} | } | |||
/*@=nullpass@*/ | /*@=nullpass@*/ | |||
int _rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) | int _rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) | |||
{ | { | |||
rpmtransFlags tsflags = rpmtsFlags(ts); | ||||
int ourrc = -1; /* assume failure */ | int ourrc = -1; /* assume failure */ | |||
uint32_t totalFileCount = 0; | uint32_t totalFileCount = 0; | |||
rpmps ps; | rpmps ps; | |||
rpmsx sx = NULL; | rpmsx sx = NULL; | |||
uint32_t numRemoved; | uint32_t numRemoved; | |||
int rollbackFailures = 0; | int rollbackFailures = 0; | |||
void * lock = NULL; | void * lock = NULL; | |||
int xx; | int xx; | |||
FPSDEBUG(0, (stderr, "--> %s(%p,%p,0x%x)\n", __FUNCTION__, ts, okProbs, ign oreSet)); | FPSDEBUG(0, (stderr, "--> %s(%p,%p,0x%x)\n", __FUNCTION__, ts, okProbs, ign oreSet)); | |||
if (_rpmts_debug) | if (_rpmts_debug) | |||
fprintf(stderr, "--> %s(%p,%p,0x%x) tsFlags 0x%x\n", __FUNCTION__, ts, okPr obs, (unsigned) ignoreSet, rpmtsFlags(ts)); | fprintf(stderr, "--> %s(%p,%p,0x%x) tsflags 0x%x\n", __FUNCTION__, ts, okPr obs, (unsigned) ignoreSet, tsflags); | |||
/* XXX programmer error segfault avoidance. */ | /* XXX programmer error segfault avoidance. */ | |||
if (rpmtsNElements(ts) <= 0) { | if (rpmtsNElements(ts) <= 0) { | |||
rpmlog(RPMLOG_ERR, | rpmlog(RPMLOG_ERR, | |||
_("Invalid number of transaction elements.\n")); | _("Invalid number of transaction elements.\n")); | |||
return -1; | return -1; | |||
} | } | |||
/* Don't acquire the transaction lock if testing. */ | /* Don't acquire the transaction lock if testing. */ | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) | if (!TSF_ISSET(tsflags, TEST)) | |||
lock = rpmtsAcquireLock(ts); | lock = rpmtsAcquireLock(ts); | |||
rollbackFailures = rpmExpandNumeric("%{?_rollback_transaction_on_failur e}"); | rollbackFailures = rpmExpandNumeric("%{?_rollback_transaction_on_failur e}"); | |||
/* Don't rollback unless repackaging. */ | /* Don't rollback unless repackaging. */ | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE)) | if (!TSF_ISSET(tsflags, REPACKAGE)) | |||
rollbackFailures = 0; | rollbackFailures = 0; | |||
/* Don't rollback if testing. */ | /* Don't rollback if testing. */ | |||
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) | if (TSF_ISSET(tsflags, TEST)) | |||
rollbackFailures = 0; | rollbackFailures = 0; | |||
if (rpmtsType(ts) & (RPMTRANS_TYPE_ROLLBACK | RPMTRANS_TYPE_AUTOROLLBAC K)) | if (rpmtsType(ts) & (RPMTRANS_TYPE_ROLLBACK | RPMTRANS_TYPE_AUTOROLLBAC K)) | |||
rollbackFailures = 0; | rollbackFailures = 0; | |||
/* =============================================== | /* =============================================== | |||
* Setup flags and such, open the rpmdb in O_RDWR mode. | * Setup flags and such, open the rpmdb in O_RDWR mode. | |||
*/ | */ | |||
sx = NULL; | sx = NULL; | |||
if (rpmtsSetup(ts, ignoreSet, &sx)) | if (rpmtsSetup(ts, ignoreSet, &sx)) | |||
skipping to change at line 2113 | skipping to change at line 2217 | |||
* - count files. | * - count files. | |||
*/ | */ | |||
totalFileCount = 0; | totalFileCount = 0; | |||
ps = rpmtsSanityCheck(ts, &totalFileCount); | ps = rpmtsSanityCheck(ts, &totalFileCount); | |||
ps = rpmpsFree(ps); | ps = rpmpsFree(ps); | |||
/* =============================================== | /* =============================================== | |||
* Run pre-transaction scripts, but only if no known problems exist. | * Run pre-transaction scripts, but only if no known problems exist. | |||
*/ | */ | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRETRANS) && | if (!TSF_ISSET(tsflags, NOPRETRANS) && | |||
(!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST)) | (!(TSF_ISSET(tsflags, BUILD_PROBS) || TSF_ISSET(tsflags, TEST)) | |||
|| (rpmpsNumProblems(ts->probs) && | || (rpmpsNumProblems(ts->probs) && | |||
(okProbs == NULL || rpmpsTrim(ts->probs, okProbs)))))) | (okProbs == NULL || rpmpsTrim(ts->probs, okProbs))))) | |||
{ | { | |||
rpmlog(RPMLOG_DEBUG, D_("running pre-transaction scripts\n")); | rpmlog(RPMLOG_DEBUG, D_("running pre-transaction scripts\n")); | |||
xx = rpmtsRunScript(ts, RPMTAG_PRETRANS); | xx = rpmtsRunScript(ts, RPMTAG_PRETRANS); | |||
} | } | |||
/* =============================================== | /* =============================================== | |||
* Compute file disposition for each package in transaction set. | * Compute file disposition for each package in transaction set. | |||
*/ | */ | |||
numRemoved = 0; | numRemoved = 0; | |||
if (rpmtsPrepare(ts, sx, totalFileCount, &numRemoved)) | if (rpmtsPrepare(ts, sx, totalFileCount, &numRemoved)) | |||
goto exit; | goto exit; | |||
/* =============================================== | /* =============================================== | |||
* If unfiltered problems exist, free memory and return. | * If unfiltered problems exist, free memory and return. | |||
*/ | */ | |||
if ((rpmtsFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS) | if (TSF_ISSET(tsflags, BUILD_PROBS) | |||
|| (rpmpsNumProblems(ts->probs) && | || (rpmpsNumProblems(ts->probs) && | |||
(okProbs == NULL || rpmpsTrim(ts->probs, okProbs))) | (okProbs == NULL || rpmpsTrim(ts->probs, okProbs))) | |||
) | ) | |||
{ | { | |||
lock = rpmtsFreeLock(lock); | lock = rpmtsFreeLock(lock); | |||
if (sx != NULL) sx = rpmsxFree(sx); | if (sx != NULL) sx = rpmsxFree(sx); | |||
return ts->orderCount; | return ts->orderCount; | |||
} | } | |||
/* =============================================== | /* =============================================== | |||
* Save removed files before erasing. | * Save removed files before erasing. | |||
*/ | */ | |||
if (rpmtsFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE) ) { | if (TSF_ISSET(tsflags, DIRSTASH) || TSF_ISSET(tsflags, REPACKAGE)) { | |||
xx = rpmtsRepackage(ts, numRemoved); | xx = rpmtsRepackage(ts, numRemoved); | |||
} | } | |||
#ifdef NOTYET | #ifdef NOTYET | |||
xx = rpmtxnBegin(rpmtsGetRdb(ts), NULL, &ts->txn); | xx = rpmtxnBegin(rpmtsGetRdb(ts), NULL, &ts->txn); | |||
#endif | #endif | |||
/* =============================================== | /* =============================================== | |||
* Install and remove packages. | * Install and remove packages. | |||
*/ | */ | |||
ourrc = rpmtsProcess(ts, ignoreSet, rollbackFailures); | ourrc = rpmtsProcess(ts, ignoreSet, rollbackFailures); | |||
/* =============================================== | /* =============================================== | |||
* Run post-transaction scripts unless disabled. | * Run post-transaction scripts unless disabled. | |||
*/ | */ | |||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOSTTRANS) && | if (!TSF_ISSET(tsflags, NOPOSTTRANS) && !TSF_ISSET(tsflags, TEST)) | |||
!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) | ||||
{ | { | |||
#if defined(RPM_VENDOR_MANDRIVA) | #if defined(RPM_VENDOR_MANDRIVA) | |||
if ((rpmtsFlags(ts) & _noTransTriggers) != _noTransTriggers) | /* XXX FIXME: simplify the logic. */ | |||
if (!TSF_ISSET(tsflags, NOTRIGGERPREIN) | ||||
|| !TSF_ISSET(tsflags, NOTRIGGERIN) | ||||
|| !TSF_ISSET(tsflags, NOTRIGGERUN) | ||||
|| !TSF_ISSET(tsflags, NOTRIGGERPOSTUN)) | ||||
rpmRunFileTriggers(rpmtsRootDir(ts)); | rpmRunFileTriggers(rpmtsRootDir(ts)); | |||
#endif | #endif | |||
rpmlog(RPMLOG_DEBUG, D_("running post-transaction scripts\n")); | rpmlog(RPMLOG_DEBUG, D_("running post-transaction scripts\n")); | |||
xx = rpmtsRunScript(ts, RPMTAG_POSTTRANS); | xx = rpmtsRunScript(ts, RPMTAG_POSTTRANS); | |||
} | } | |||
exit: | exit: | |||
xx = rpmtsFinish(ts, sx); | xx = rpmtsFinish(ts, sx); | |||
End of changes. 77 change blocks. | ||||
105 lines changed or deleted | 211 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |