Add rpmtsPrintSuggests() method for now, use instead of ts internals mucking

- temporary measure to get rid of silly RPMTS_INTERNAL uses, the whole
  solve/suggestion thingie needs love or ripping...
- clean up the suggestions in rpmtsClean() instead of while printing
This commit is contained in:
Panu Matilainen 2007-10-31 10:37:18 +02:00
parent 68dcdd5dad
commit c13ab34016
5 changed files with 38 additions and 45 deletions

View File

@ -6,7 +6,6 @@
#include "rpmlib.h"
#include "rpmte.h" /* XXX rpmElementType */
#define _RPMTS_INTERNAL /* XXX ts->probs et al */
#include "rpmgi_internal.h"
#include "rpmdb.h"
@ -569,7 +568,6 @@ enditer:
if (gi->flags & RPMGI_TSORDER) {
rpmts ts = gi->ts;
rpmps ps;
int i;
/* XXX installed database needs close here. */
xx = rpmtsCloseDB(ts);
@ -585,21 +583,9 @@ enditer:
if (rpmIsVerbose())
rpmpsPrint(NULL, ps);
if (ts->suggests != NULL && ts->nsuggests > 0) {
rpmlog(RPMLOG_INFO, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
const char * str = ts->suggests[i];
if (str == NULL)
break;
rpmlog(RPMLOG_INFO, "\t%s\n", str);
ts->suggests[i] = NULL;
str = _free(str);
}
ts->suggests = _free(ts->suggests);
}
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST))
rpmtsPrintSuggests(ts);
}
ps = rpmpsFree(ps);

View File

@ -9,7 +9,6 @@
#include "rpmdb.h"
#include "rpmds.h"
#define _RPMTS_INTERNAL /* ts->goal, ts->suggests */
#include "rpmts.h"
#include "manifest.h"
@ -598,21 +597,9 @@ maybe_manifest:
eiu->numFailed = eiu->numPkgs;
stopInstall = 1;
if (ts->suggests != NULL && ts->nsuggests > 0) {
rpmlog(RPMLOG_NOTICE, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
const char * str = ts->suggests[i];
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST))
rpmtsPrintSuggests(ts);
if (str == NULL)
break;
rpmlog(RPMLOG_NOTICE, "\t%s\n", str);
ts->suggests[i] = NULL;
str = _free(str);
}
ts->suggests = _free(ts->suggests);
}
}
ps = rpmpsFree(ps);
}

View File

@ -834,6 +834,23 @@ int rpmtsSetSolveCallback(rpmts ts,
return rc;
}
void rpmtsPrintSuggests(rpmts ts)
{
if (ts->suggests != NULL && ts->nsuggests > 0) {
int i;
rpmlog(RPMLOG_NOTICE, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
const char * str = ts->suggests[i];
if (str == NULL)
break;
rpmlog(RPMLOG_NOTICE, "\t%s\n", str);
}
}
}
rpmps rpmtsProblems(rpmts ts)
{
rpmps ps = NULL;
@ -860,6 +877,7 @@ void rpmtsCleanDig(rpmts ts)
void rpmtsClean(rpmts ts)
{
rpmtsi pi; rpmte p;
int i;
if (ts == NULL)
return;
@ -873,6 +891,11 @@ void rpmtsClean(rpmts ts)
ts->addedPackages = rpmalFree(ts->addedPackages);
ts->numAddedPackages = 0;
for (i = 0; i < ts->nsuggests; i++) {
const char * str = ts->suggests[i];
ts->suggests[i] = NULL;
_free(str);
}
ts->suggests = _free(ts->suggests);
ts->nsuggests = 0;

View File

@ -435,6 +435,15 @@ rpmtsType rpmtsGetType(rpmts ts);
*/
void rpmtsSetType(rpmts ts, rpmtsType type);
/**
* Print possible suggestions for current transaction set, assuming
* solvedb exists etc.
* @todo The whole suggests handling needs rework, this
* is just a temporary measure...
* @param ts transaction set
*/
void rpmtsPrintSuggests(rpmts ts);
/**
* Return current transaction set problems.
* @param ts transaction set

View File

@ -8,7 +8,6 @@ const char *__progname;
#include "rpmte.h"
#define _RPMTS_INTERNAL /* ts->goal, ts->dbmode, ts->suggests */
#include "rpmts.h"
#include "manifest.h"
@ -196,20 +195,9 @@ maybe_manifest:
rpmpsPrint(NULL, ps);
numFailed += numPkgs;
if (ts->suggests != NULL && ts->nsuggests > 0) {
rpmlog(RPMLOG_NOTICE, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
const char * str = ts->suggests[i];
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST))
rpmtsPrintSuggests(ts);
if (str == NULL)
break;
rpmlog(RPMLOG_NOTICE, "\t%s\n", str);
ts->suggests[i] = NULL;
str = _free(str);
}
ts->suggests = _free(ts->suggests);
}
}
ps = rpmpsFree(ps);
}