poldek: poldek/install3/misc.c, poldek/install3/obsoletes.c, poldek/install...
mis
mis at pld-linux.org
Tue May 13 17:52:54 CEST 2008
Author: mis Date: Tue May 13 15:52:54 2008 GMT
Module: poldek Tag: HEAD
---- Log message:
- use colour if package coloured (#143 at bugs.pld)
- user friendly die message (#217160 at launchpad)
- more traces
---- Files affected:
poldek/poldek/install3:
misc.c (1.7 -> 1.8) , obsoletes.c (1.4 -> 1.5) , requirements.c (1.7 -> 1.8)
---- Diffs:
================================================================
Index: poldek/poldek/install3/misc.c
diff -u poldek/poldek/install3/misc.c:1.7 poldek/poldek/install3/misc.c:1.8
--- poldek/poldek/install3/misc.c:1.7 Sun May 11 23:02:41 2008
+++ poldek/poldek/install3/misc.c Tue May 13 17:52:49 2008
@@ -333,16 +333,25 @@
tn_array *pkgs;
int i;
- if ((pkgs = pkgset_search(ictx->ps, PS_SEARCH_NAME, pkg->name)) == NULL)
+
+ if ((pkgs = pkgset_search(ictx->ps, PS_SEARCH_NAME, pkg->name)) == NULL) {
+ tracef(indent + 2, "%s not found, return", pkg_id(pkg));
return NULL;
+ }
selected_pkg = pkg;
for (i=0; i < n_array_size(pkgs); i++) {
struct pkg *p = n_array_nth(pkgs, i);
int cmprc;
-
- if (!pkg_is_kind_of(p, pkg)) {
- DBGF("%s is not kind of %s\n", pkg_id(p), pkg_id(pkg));
+
+ if (pkg->color == 0) { /* no color -> use arch */
+ if (!pkg_is_kind_of(p, pkg)) {
+ tracef(indent + 2, "%s is not like %s, skipped", pkg_id(p), pkg_id(pkg));
+ continue;
+ }
+
+ } else if (!pkg_is_colored_like(p, pkg)) {
+ tracef(indent + 2, "%s is not colored like %s, skipped", pkg_id(p), pkg_id(pkg));
continue;
}
@@ -359,7 +368,7 @@
if (selected_pkg == pkg)
selected_pkg = NULL;
- tracef(indent, "RET %s (for %s)\n",
+ tracef(indent, "RET %s (for %s)",
selected_pkg ? pkg_id(selected_pkg) : "NULL", pkg_id(pkg));
return (struct pkg*)selected_pkg;
================================================================
Index: poldek/poldek/install3/obsoletes.c
diff -u poldek/poldek/install3/obsoletes.c:1.4 poldek/poldek/install3/obsoletes.c:1.5
--- poldek/poldek/install3/obsoletes.c:1.4 Sat Feb 2 22:30:16 2008
+++ poldek/poldek/install3/obsoletes.c Tue May 13 17:52:49 2008
@@ -17,7 +17,14 @@
#include <fnmatch.h>
#include "ictx.h"
-static struct orphan *orphan_new(struct pkg *pkg, tn_array *caps)
+static void orphan_free(struct orphan *o)
+{
+ pkg_free(o->pkg);
+ n_array_free(o->reqs);
+ free(o);
+}
+
+static struct orphan *orphan_new(int indent, struct pkg *pkg, tn_array *caps)
{
struct orphan *o;
@@ -30,22 +37,20 @@
const struct capreq *req;
struct capreq *cap = n_array_nth(caps, i);
- //tracef(0, "%s requires %s?", pkg_id(pkg), capreq_stra(cap));
- if ((req = pkg_requires_cap(pkg, cap)))
+ req = pkg_requires_cap(pkg, cap);
+ tracef(indent, "%s requires %s? %s", pkg_id(pkg), capreq_stra(cap), req ? "yes" : "no");
+ if (req)
n_array_push(o->reqs, (struct capreq *)req);
}
- //n_assert(n_array_size(o->reqs) > 0);
+ if (n_array_size(o->reqs) == 0) { /* not an orphan */
+ orphan_free(o);
+ o = NULL;
+ }
+
return o;
}
-static void orphan_free(struct orphan *o)
-{
- pkg_free(o->pkg);
- n_array_free(o->reqs);
- free(o);
-}
-
/* is to-install set provides cap? */
static int toin_provides(int indent, struct i3ctx *ictx,
const struct pkg *pkg, const struct capreq *cap)
@@ -60,7 +65,7 @@
/* get packages required by pkg */
static int get_orphaned(int indent, struct i3ctx *ictx,
- tn_array *orphaned, tn_array *unsatisfied_caps)
+ tn_array *orphaned, const tn_array *unsatisfied_caps)
{
struct pkgdb *db = ictx->ts->db;
unsigned ldflags = PKG_LDNEVR | PKG_LDREQS;
@@ -215,7 +220,7 @@
if (poldek_ts_issetf(ictx->ts, POLDEK_TS_DOWNGRADE))
getflags |= PKGDB_GETF_OBSOLETEDBY_REV;
-
+
obsoleted = get_obsoletedby_pkg(db, iset_packages_by_recno(unset), pkg,
getflags, PKG_LDWHOLE_FLDEPDIRS);
@@ -230,7 +235,10 @@
struct pkg_cap_iter *it;
const struct capreq *cap;
- n_assert(!iset_has_pkg(unset, dbpkg));
+ if (iset_has_pkg(unset, dbpkg)) { /* rpmdb with duplicate? */
+ logn(LOGERR | LOGDIE, "%s: installed twice? Give up.", pkg_id(dbpkg));
+ }
+
n_array_push(i3pkg->obsoletedby, pkg_link(dbpkg));
msgn_i(1, indent, _("%s obsoleted by %s"), pkg_id(dbpkg), pkg_id(pkg));
@@ -271,10 +279,11 @@
if (unsatisfied_caps == NULL)
return 0;
+ n_assert(n_array_size(unsatisfied_caps));
n_array_uniq(unsatisfied_caps);
orphaned = pkgs_array_new_ex(16, pkg_cmp_recno);
-
+
/*
determine what exactly requirements are missed, i.e no more
"foreign" dependencies skipping needed
@@ -284,14 +293,19 @@
} else {
n_assert(n_array_size(orphaned));
-
+ n_assert(n_array_size(unsatisfied_caps));
+
orphans = n_array_new(16, (tn_fn_free)orphan_free, NULL);
for (i=0; i < n_array_size(orphaned); i++) {
- struct orphan *o = orphan_new(n_array_nth(orphaned, i),
+ struct orphan *o = orphan_new(indent + 3, n_array_nth(orphaned, i),
unsatisfied_caps);
- n_array_push(orphans, o);
+ if (o)
+ n_array_push(orphans, o);
}
+
+ if (n_array_size(orphans) == 0)
+ n_array_cfree(&orphans);
}
n_array_free(orphaned);
@@ -301,7 +315,7 @@
} else {
for (i=0; i < n_array_size(orphans); i++) {
struct orphan *o = n_array_nth(orphans, i);
- trace(indent + 2, "- %s", pkg_id(o->pkg));
+ trace(indent + 2, "- %s (nreqs=%d)", pkg_id(o->pkg), n_array_size(o->reqs));
}
for (i=0; i < n_array_size(orphans); i++) {
================================================================
Index: poldek/poldek/install3/requirements.c
diff -u poldek/poldek/install3/requirements.c:1.7 poldek/poldek/install3/requirements.c:1.8
--- poldek/poldek/install3/requirements.c:1.7 Mon May 12 22:01:33 2008
+++ poldek/poldek/install3/requirements.c Tue May 13 17:52:49 2008
@@ -335,8 +335,7 @@
n_assert(reqs);
n_assert(pkg->reqs);
- tracef(indent, "%s as ORPHAN", pkg_id(pkg));
-
+ tracef(indent, "%s as ORPHAN (nreqs=%d)", pkg_id(pkg), n_array_size(reqs));
for (i=0; i < n_array_size(reqs); i++) {
struct capreq *req = n_array_nth(reqs, i);
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/install3/misc.c?r1=1.7&r2=1.8&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/install3/obsoletes.c?r1=1.4&r2=1.5&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/install3/requirements.c?r1=1.7&r2=1.8&f=u
More information about the pld-cvs-commit
mailing list