summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-10-31 10:37:18 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-10-31 10:37:18 +0200
commitc13ab3401614249d8321b9e920a479602dc8291d (patch)
tree85522b73dead77b66581b274fcacd40119d0f1d7
parent68dcdd5dad79481bd5561ba6b0556bdb84b66c15 (diff)
downloadlibrpm-tizen-c13ab3401614249d8321b9e920a479602dc8291d.tar.gz
librpm-tizen-c13ab3401614249d8321b9e920a479602dc8291d.tar.bz2
librpm-tizen-c13ab3401614249d8321b9e920a479602dc8291d.zip
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
-rw-r--r--lib/rpmgi.c18
-rw-r--r--lib/rpminstall.c17
-rw-r--r--lib/rpmts.c23
-rw-r--r--lib/rpmts.h9
-rw-r--r--tools/rpmgraph.c16
5 files changed, 38 insertions, 45 deletions
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index 633e56b7d..17f773a32 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -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);
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index f1d8719bc..af55a5e11 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -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);
}
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 67c1c153d..81851bbcc 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -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;
diff --git a/lib/rpmts.h b/lib/rpmts.h
index 2244e51ea..4ec1727e8 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -436,6 +436,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
* @return current problem set (or NULL)
diff --git a/tools/rpmgraph.c b/tools/rpmgraph.c
index 2f215794c..e97ccda9a 100644
--- a/tools/rpmgraph.c
+++ b/tools/rpmgraph.c
@@ -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);
}