Change the problem data arrangement for dependency problems
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 11:20:17 +0000 (13:20 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 11:24:00 +0000 (13:24 +0200)
- pkgNEVR in problems is now always the NEVR of the transaction element
  triggering the problem, and altNEVR is the other affected package,
  dependency string is stored in the problem string attribute
- no user visible changed, except for somebody crazy enough to try to
  do something other than print the problem message strings
- we wouldn't really need to strdup() the pkgNEVR in problems now,
  but leaving that alone for the moment...

lib/rpmprob.c
lib/rpmte.c
python/rpm/transaction.py

index 225e4b9..5412ca7 100644 (file)
@@ -158,18 +158,18 @@ char * rpmProblemString(rpmProblem prob)
        break;
     case RPMPROB_REQUIRES:
        rc = rasprintf(&buf, _("%s is needed by %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+               prob->str1,
+               (prob->num1 ? "" : _("(installed) ")), altNEVR);
        break;
     case RPMPROB_CONFLICT:
        rc = rasprintf(&buf, _("%s conflicts with %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+               prob->str1,
+               (prob->num1 ? "" : _("(installed) ")), altNEVR);
        break;
     case RPMPROB_OBSOLETES:
        rc = rasprintf(&buf, _("%s is obsoleted by %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+               prob->str1,
+               (prob->num1 ? "" : _("(installed) ")), altNEVR);
        break;
     default:
        rc = rasprintf(&buf,
index 10e9bee..43d42ac 100644 (file)
@@ -749,7 +749,7 @@ void rpmteAddProblem(rpmte te, rpmProblemType type,
     }
 }
 
-void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds,
+void rpmteAddDepProblem(rpmte te, const char * altNEVR, rpmds ds,
                        fnpyKey * suggestedKeys, int adding)
 {
     if (te != NULL) {
@@ -764,7 +764,7 @@ void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds,
        case 'R':       type = RPMPROB_REQUIRES;        break;
        }
 
-       appendProblem(te, type, pkgNEVR, key, DNEVR, NULL, adding);
+       appendProblem(te, type, rpmteNEVRA(te), key, altNEVR, DNEVR+2, adding);
     }
 }
 
index ba8c5b0..0e4272d 100644 (file)
@@ -113,11 +113,11 @@ class TransactionSet(_rpmts):
                 continue
 
             # strip arch, split to name, version, release
-            nevr = p.pkgNEVR.rsplit('.', 1)[0]
+            nevr = p.altNEVR.rsplit('.', 1)[0]
             n, v, r = nevr.rsplit('-', 2)
 
             # extract the dependency information
-            needs = p.altNEVR.split()[1:]
+            needs = p._str.split()[1:]
             needname = needs[0]
             needflags = rpm.RPMSENSE_ANY
             if len(needs) == 3: