This patch basically adds a dependency (for ordering purposes)
as if every erased packages had a Requires: on whatever package(s)
caused the erasure.

That should ensure install-before-erase always.

The patch has been tested with a 127 pkg transaction that had
13 loops, and install-before-erase behavior as preserved.

All dependency loops are now displayed as errors too. I'm way tired of trying
to guess whether a loop exists.

73 de Jeff

On Oct 22, 2008, at 10:07 PM, Jeff Johnson wrote:

 RPM Package Manager, CVS Repository
 http://rpm5.org/cvs/
____________________________________________________________________________

 Server: rpm5.org                         Name:   Jeff Johnson
 Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
 Module: rpm                              Date:   23-Oct-2008 04:07:15
 Branch: HEAD                             Handle: 2008102302071500

 Modified files:
   rpm                     CHANGES
   rpm/lib                 depends.c

 Log:
   - jbj: add a relation to to force install-before-erase.
   - jbj: display dependency loops as an error for now.

 Summary:
   Revision    Changes     Path
   1.2621      +2  -0      rpm/CHANGES
   1.422       +19 -1      rpm/lib/depends.c
____________________________________________________________________________

 patch -p0 <<'@@ .'
 Index: rpm/CHANGES
= = = = = = ======================================================================
 $ cvs diff -u -r1.2620 -r1.2621 CHANGES
 --- rpm/CHANGES        19 Oct 2008 16:50:03 -0000      1.2620
 +++ rpm/CHANGES        23 Oct 2008 02:07:15 -0000      1.2621
 @@ -1,5 +1,7 @@

  5.2a2 -> 5.2a3:
 +    - jbj: add a relation to to force install-before-erase.
 +    - jbj: display dependency loops as an error for now.
      - rpm.org: add %{_default_patch_fuzz} macro for patch --fuzz
      - afb: make buildroot path configurable, but keep old defaults
      - rpm.org: add %{_buildrootdir} macro for use with %{buildroot}
 @@ .
 patch -p0 <<'@@ .'
 Index: rpm/lib/depends.c
= = = = = = ======================================================================
 $ cvs diff -u -r1.421 -r1.422 depends.c
 --- rpm/lib/depends.c  14 Oct 2008 03:55:08 -0000      1.421
 +++ rpm/lib/depends.c  23 Oct 2008 02:07:15 -0000      1.422
 @@ -2400,6 +2400,24 @@
        }
        }

 +      /* Ensure that erasures follow installs during upgrades. */
+ if (rpmteType(p) == TR_REMOVED && p->flink.Pkgid && p- >flink.Pkgid[0]) {
 +
 +      qi = rpmtsiInit(ts);
 +      while ((q = rpmtsiNext(qi, TR_ADDED)) != NULL) {
 +          if (strcmp(q->pkgid, p->flink.Pkgid[0]))
 +              continue;
 +          requires = rpmdsFromPRCO(q->PRCO, RPMTAG_NAME);
 +          if (requires != NULL) {
 +              /* XXX disable erased arrow reversal. */
 +              p->type = TR_ADDED;
 +              (void) addRelation(ts, p, selected, requires);
 +              p->type = TR_REMOVED;
 +          }
 +      }
 +      qi = rpmtsiFree(qi);
 +      }
 +
        if (_autobits != 0xffffffff)
        {

 @@ -2612,7 +2630,7 @@
  #endif
                const char * dp;
int msglvl = (anaconda || (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS))
 -                      ? RPMLOG_WARNING : RPMLOG_DEBUG;
 +                      ? RPMLOG_WARNING : RPMLOG_ERR;
  ;

                /* Unchain predecessor loop. */
 @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [EMAIL PROTECTED]

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to