RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ rpminstall.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Wed 30 Jan 2008 - 23:26:56 CET
Message-Id: <20080130222656.8CBD9348471@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   30-Jan-2008 23:26:56
  Branch: HEAD                             Handle: 2008013022265600

  Modified files:
    rpm                     CHANGES
    rpm/lib                 rpminstall.c

  Log:
    - permit "-N-V-R.A" erasure args within install/upgrade transactions.

  Summary:
    Revision    Changes     Path
    1.2111      +1  -0      rpm/CHANGES
    1.190       +38 -0      rpm/lib/rpminstall.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2110 -r1.2111 CHANGES
  --- rpm/CHANGES	30 Jan 2008 21:39:29 -0000	1.2110
  +++ rpm/CHANGES	30 Jan 2008 22:26:56 -0000	1.2111
  @@ -1,4 +1,5 @@
   5.0.0 -> 5.1a1:
  +    - jbj: permit "-N-V-R.A" erasure args within install/upgrade transactions.
       - jbj: propagate the time a package was first installed through upgrades.
       - jbj: replace sr.po from translation project.
       - jbj: fix: rpmtsCheck() needs to return 1 when problems exist.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.189 -r1.190 rpminstall.c
  --- rpm/lib/rpminstall.c	3 Jan 2008 17:57:34 -0000	1.189
  +++ rpm/lib/rpminstall.c	30 Jan 2008 22:26:56 -0000	1.190
  @@ -306,6 +306,30 @@
   /*@=evalorder@*/
   }
   
  +static rpmRC rpmcliEraseElement(rpmts ts, const char * arg)
  +{
  +    rpmdbMatchIterator mi;
  +    Header h;
  +    rpmRC rc = RPMRC_OK;
  +    int xx;
  +
  +    mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0);
  +    if (mi == NULL)
  +	return RPMRC_NOTFOUND;
  +
  +    while ((h = rpmdbNextIterator(mi)) != NULL) {
  +	unsigned int recOffset = rpmdbGetIteratorOffset(mi);
  +
  +	if (recOffset == 0) {	/* XXX can't happen. */
  +	    rc = RPMRC_FAIL;
  +	    break;
  +	}
  +	xx = rpmtsAddEraseElement(ts, h, recOffset);
  +    }
  +    mi = rpmdbFreeIterator(mi);
  +
  +    return 0;
  +}
   
   /** @todo Generalize --freshen policies. */
   int rpmcliInstall(rpmts ts, QVA_t ia, const char ** argv)
  @@ -420,6 +444,20 @@
   	    continue;
   	}
   	fn = rpmgiHdrPath(gi);
  +	/* === Check for erasures within install transaction. */
  +	if (fn[0] == '-') {
  +	    switch (rpmcliEraseElement(ts, &fn[1])) {
  +	    case RPMRC_OK:
  +		break;
  +	    case RPMRC_NOTFOUND:
  +	    default:
  +		rpmlog(RPMLOG_ERR, _("package %s cannot be erased\n"), &fn[1]);
  +		numFailed++;
  +		goto exit;
  +		/*@notreached@*/ break;
  +	    }
  +	    continue;
  +	}
   
   	/* === Check for relocatable package. */
   	if (relocations) {
  @@ .
Received on Wed Jan 30 23:26:56 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.