lib/rpmrollback.c File Reference

#include "system.h"
#include <rpmio.h>
#include <rpmcli.h>
#include "rpmdb.h"
#include "rpmds.h"
#include "manifest.h"
#include "misc.h"
#include "rpmgi.h"
#include "debug.h"

Include dependency graph for rpmrollback.c:

Go to the source code of this file.

Defines

#define _RPMTE_INTERNAL
#define _RPMTS_INTERNAL
#define _RPMTS_PRINT

Functions

static int IDTintcmp (const void *a, const void *b)
IDTX IDTXfree (IDTX idtx)
 Destroy id index.
IDTX IDTXnew (void)
 Create id index.
IDTX IDTXgrow (IDTX idtx, int need)
 Insure that index has room for "need" elements.
IDTX IDTXsort (IDTX idtx)
 Sort tag (instance,value) pairs.
IDTX IDTXload (rpmts ts, rpmTag tag, uint32_t rbtid)
 Load tag (instance,value) pairs from rpm databse, and return sorted id index.
IDTX IDTXglob (rpmts ts, const char *globstr, rpmTag tag, uint32_t rbtid)
 Load tag (instance,value) pairs from packages, and return sorted id index.
static int cmpArgvStr (rpmts ts, const char *lname, const char **AV, int AC, const char *B)
 Search for string B in argv array AV.
static int findErases (rpmts ts, rpmte p, unsigned thistid, IDT ip, int niids)
 Find (and add to transaction set) all erase elements with matching blink.
int rpmRollback (rpmts ts, QVA_t ia, const char **argv)
 Rollback transactions, erasing new, reinstalling old, package(s).

Variables

static int reverse = -1


Detailed Description

Definition in file rpmrollback.c.


Define Documentation

#define _RPMTE_INTERNAL

Definition at line 8 of file rpmrollback.c.

#define _RPMTS_INTERNAL

Definition at line 9 of file rpmrollback.c.

#define _RPMTS_PRINT

Definition at line 10 of file rpmrollback.c.


Function Documentation

static int cmpArgvStr ( rpmts  ts,
const char *  lname,
const char **  AV,
int  AC,
const char *  B 
) [static]

Search for string B in argv array AV.

Parameters:
ts transaction set
lname type of link
AV argv array
AC no. of args
B string
Returns:
1 if found, 0 not found, -1 error

Definition at line 234 of file rpmrollback.c.

References RPMPROB_NOREPACKAGE, rpmpsAppend(), rpmpsFree(), and rpmtsProblems().

Referenced by findErases().

static int findErases ( rpmts  ts,
rpmte  p,
unsigned  thistid,
IDT  ip,
int  niids 
) [static]

Find (and add to transaction set) all erase elements with matching blink.

In addition, recreate any added transaction element linkages.

XXX rp->h should have FLINK{HDRID,PKGID,NEVRA} populated. XXX ip->h should have BLINK{HDRID,PKGID,NEVRA} populated. XXX p = ts->teInstall is added transaction element from rp->h.

Parameters:
ts transaction set (ts->teInstall set to last added pkg)
p most recently added install element (NULL skips linking)
thistid current transaction id
ip currently installed package(s) to be erased
niids no. of currently installed package(s)
Returns:
-1 on error, otherwise no. of erase elemnts added

Definition at line 279 of file rpmrollback.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, cmpArgvStr(), D_, IDT_s::done, IDT_s::h, headerGet(), IDT_s::instance, _HE_s::p, rpmlog(), RPMLOG_DEBUG, RPMTE_CHAIN_END, rpmteChain(), rpmtsAddEraseElement(), _HE_s::tag, IDT_s::u32, and IDT_s::val.

Referenced by rpmRollback().

static int IDTintcmp ( const void *  a,
const void *  b 
) [static]

Definition at line 32 of file rpmrollback.c.

References reverse.

Referenced by IDTXsort().

IDTX IDTXfree ( IDTX  idtx  ) 

Destroy id index.

Parameters:
idtx id index
Returns:
NULL always

Definition at line 40 of file rpmrollback.c.

References _free(), IDT_s::h, headerFree(), IDTindex_s::idt, IDT_s::key, and IDTindex_s::nidt.

Referenced by rpmRollback(), rpmts_IDTXglob(), and rpmts_IDTXload().

IDTX IDTXglob ( rpmts  ts,
const char *  globstr,
rpmTag  tag,
uint32_t  rbtid 
)

Load tag (instance,value) pairs from packages, and return sorted id index.

Parameters:
ts transaction set
globstr glob expression
tag rpm tag
rbtid rollback goal
Returns:
id index

Definition at line 137 of file rpmrollback.c.

References _, _free(), alloca(), IDT_s::done, Fclose(), Ferror(), Fopen(), Fstrerror(), IDT_s::h, headerFree(), headerGet(), headerGetOrigin(), headerIsEntry(), headerLink(), IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, IDT_s::key, IDTindex_s::nidt, _HE_s::p, rpmDataType_u::ptr, rpmgiEscapeSpaces(), rpmGlob(), rpmlog(), RPMLOG_ERR, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), _HE_s::tag, IDT_s::u32, rpmDataType_u::ui32p, and IDT_s::val.

Referenced by rpmRollback(), and rpmts_IDTXglob().

IDTX IDTXgrow ( IDTX  idtx,
int  need 
)

Insure that index has room for "need" elements.

Parameters:
idtx id index
need additional no. of elements needed
Returns:
id index (with room for "need" elements)

Definition at line 64 of file rpmrollback.c.

References IDTindex_s::alloced, IDTindex_s::delta, IDTindex_s::idt, IDTXnew(), IDTindex_s::nidt, IDTindex_s::size, and xrealloc().

Referenced by IDTXglob(), and IDTXload().

IDTX IDTXload ( rpmts  ts,
rpmTag  tag,
uint32_t  rbtid 
)

Load tag (instance,value) pairs from rpm databse, and return sorted id index.

Parameters:
ts transaction set
tag rpm tag
rbtid rollback goal
Returns:
id index

Definition at line 88 of file rpmrollback.c.

References _free(), alloca(), IDT_s::done, IDT_s::h, headerGet(), headerLink(), IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, IDT_s::key, IDTindex_s::nidt, _HE_s::p, rpmDataType_u::ptr, rpmdbFreeIterator(), rpmdbGetIteratorOffset(), rpmdbNextIterator(), rpmdbSetIteratorRE(), rpmtsInitIterator(), _HE_s::tag, IDT_s::u32, rpmDataType_u::ui32p, and IDT_s::val.

Referenced by rpmRollback(), and rpmts_IDTXload().

IDTX IDTXnew ( void   ) 

Create id index.

Returns:
new id index

Definition at line 56 of file rpmrollback.c.

References IDTindex_s::delta, IDTindex_s::size, and xcalloc().

Referenced by IDTXgrow().

IDTX IDTXsort ( IDTX  idtx  ) 

Sort tag (instance,value) pairs.

Parameters:
idtx id index
Returns:
id index

Definition at line 81 of file rpmrollback.c.

References IDTindex_s::idt, IDTintcmp(), IDTindex_s::nidt, and IDTindex_s::size.

Referenced by IDTXglob(), and IDTXload().


Variable Documentation

int reverse = -1 [static]

Definition at line 28 of file rpmrollback.c.


Generated on Mon Sep 28 13:41:58 2009 for rpm by  doxygen 1.5.9