verify.c: updated verifyDependencies() for self-conflicting packages
To check the dependencies of an installed package, a "transaction" is created, and the package is added to the transaction. The transaction is then checked with rpmdepCheck(). However, since the installed package has not been marked for removal, a conflict can be triggered between the installed and that of transaction copies of the package. The right thing to do is to mark package for removal, re-add it to the transaction, and then to check the dependencies.
This commit is contained in:
parent
de60ab01a3
commit
6684fd8ee5
18
lib/verify.c
18
lib/verify.c
@ -459,15 +459,14 @@ exit:
|
|||||||
static int verifyDependencies(rpmdb rpmdb, Header h)
|
static int verifyDependencies(rpmdb rpmdb, Header h)
|
||||||
/*@modifies h @*/
|
/*@modifies h @*/
|
||||||
{
|
{
|
||||||
rpmTransactionSet ts;
|
rpmTransactionSet ts = rpmtransCreateSet(rpmdb, NULL);
|
||||||
rpmDependencyConflict conflicts;
|
unsigned int offset = headerGetInstance(h);
|
||||||
int numConflicts;
|
if (offset > 0)
|
||||||
int rc = 0; /* assume no problems */
|
rpmtransRemovePackage(ts, offset);
|
||||||
int i;
|
|
||||||
|
|
||||||
ts = rpmtransCreateSet(rpmdb, NULL);
|
|
||||||
(void) rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL);
|
(void) rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL);
|
||||||
|
|
||||||
|
rpmDependencyConflict conflicts;
|
||||||
|
int numConflicts;
|
||||||
(void) rpmdepCheck(ts, &conflicts, &numConflicts);
|
(void) rpmdepCheck(ts, &conflicts, &numConflicts);
|
||||||
ts = rpmtransFree(ts);
|
ts = rpmtransFree(ts);
|
||||||
|
|
||||||
@ -478,6 +477,7 @@ static int verifyDependencies(rpmdb rpmdb, Header h)
|
|||||||
int nb = 512;
|
int nb = 512;
|
||||||
(void) headerNVR(h, &n, &v, &r);
|
(void) headerNVR(h, &n, &v, &r);
|
||||||
|
|
||||||
|
int i;
|
||||||
for (i = 0; i < numConflicts; i++) {
|
for (i = 0; i < numConflicts; i++) {
|
||||||
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
|
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
|
||||||
if (conflicts[i].needsFlags)
|
if (conflicts[i].needsFlags)
|
||||||
@ -508,10 +508,10 @@ static int verifyDependencies(rpmdb rpmdb, Header h)
|
|||||||
te = t;
|
te = t;
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
}
|
}
|
||||||
rc = 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*@=branchstate@*/
|
/*@=branchstate@*/
|
||||||
return rc;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int showVerifyPackage(QVA_t qva, rpmdb rpmdb, Header h)
|
int showVerifyPackage(QVA_t qva, rpmdb rpmdb, Header h)
|
||||||
|
Loading…
Reference in New Issue
Block a user