Add a few API bits for problem sets in transaction elements
- make rpmteProblems() public and refcount the returned sets - add public rpmteCleanProblems() to destroy the per-element problem sets - add internal rpmteAddDepProblem() for adding per-element dependency problems
This commit is contained in:
parent
ee24a84656
commit
1d98830819
30
lib/rpmte.c
30
lib/rpmte.c
|
@ -715,7 +715,14 @@ int rpmteHaveTransScript(rpmte te, rpmTag tag)
|
|||
|
||||
rpmps rpmteProblems(rpmte te)
|
||||
{
|
||||
return te ? te->probs : NULL;
|
||||
return (te != NULL) ? rpmpsLink(te->probs, RPMDBG_M("rpmteProbs")) : NULL;
|
||||
}
|
||||
|
||||
void rpmteCleanProblems(rpmte te)
|
||||
{
|
||||
if (te != NULL && te->probs != NULL) {
|
||||
te->probs = rpmpsFree(te->probs);
|
||||
}
|
||||
}
|
||||
|
||||
void rpmteAddProblem(rpmte te, rpmProblemType type,
|
||||
|
@ -730,6 +737,27 @@ void rpmteAddProblem(rpmte te, rpmProblemType type,
|
|||
}
|
||||
}
|
||||
|
||||
void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds,
|
||||
fnpyKey * suggestedKeys, int adding)
|
||||
{
|
||||
if (te != NULL) {
|
||||
const char * DNEVR = rpmdsDNEVR(ds);
|
||||
rpmProblemType type;
|
||||
fnpyKey key = (suggestedKeys ? suggestedKeys[0] : NULL);
|
||||
|
||||
if (te->probs == NULL)
|
||||
te->probs = rpmpsCreate();
|
||||
|
||||
switch ((unsigned)DNEVR[0]) {
|
||||
case 'C': type = RPMPROB_CONFLICT; break;
|
||||
default:
|
||||
case 'R': type = RPMPROB_REQUIRES; break;
|
||||
}
|
||||
|
||||
rpmpsAppend(te->probs, type, pkgNEVR, key, NULL, NULL, DNEVR, adding);
|
||||
}
|
||||
}
|
||||
|
||||
const char * rpmteTypeString(rpmte te)
|
||||
{
|
||||
switch(rpmteType(te)) {
|
||||
|
|
13
lib/rpmte.h
13
lib/rpmte.h
|
@ -170,6 +170,19 @@ rpmte rpmteParent(rpmte te);
|
|||
*/
|
||||
rpmte rpmteSetParent(rpmte te, rpmte pte);
|
||||
|
||||
/** \ingroup rpmte
|
||||
* Return problem set info of transaction element.
|
||||
* @param te transaction element
|
||||
* @return problem set (or NULL if none)
|
||||
*/
|
||||
rpmps rpmteProblems(rpmte te);
|
||||
|
||||
/** \ingroup rpmte
|
||||
* Destroy problem set info of transaction element.
|
||||
* @param te transaction element
|
||||
*/
|
||||
void rpmteCleanProblems(rpmte te);
|
||||
|
||||
/** \ingroup rpmte
|
||||
* Destroy dependency set info of transaction element.
|
||||
* @param te transaction element
|
||||
|
|
|
@ -31,14 +31,15 @@ int rpmteMarkFailed(rpmte te, rpmts ts);
|
|||
RPM_GNUC_INTERNAL
|
||||
int rpmteHaveTransScript(rpmte te, rpmTag tag);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
rpmps rpmteProblems(rpmte te);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
void rpmteAddProblem(rpmte te, rpmProblemType type,
|
||||
const char *dn, const char *bn,
|
||||
const char *altNEVR, uint64_t number);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds,
|
||||
fnpyKey * suggestedKeys, int adding);
|
||||
|
||||
RPM_GNUC_INTERNAL
|
||||
const char * rpmteTypeString(rpmte te);
|
||||
|
||||
|
|
Loading…
Reference in New Issue