rpmrollback.c File Reference
RPMCLI.
`#include "system.h"`
`#include <rpmio.h>`
`#include <rpmiotypes.h>`
`#include <rpmcb.h>`
`#include <argv.h>`
`#include <rpmtypes.h>`
`#include <rpmtag.h>`
`#include <pkgio.h>`
`#include <rpmdb.h>`
`#include <rpmds.h>`
`#include "manifest.h"`
`#include "misc.h"`
`#include <rpmgi.h>`
`#include <rpmcli.h>`
`#include <rpmrollback.h>`
`#include "debug.h"`
Include dependency graph for rpmrollback.c:

Go to the source code of this file.

## Macros

#define | _RPMTE_INTERNAL /* XXX findErases needs rpmte internals. */
#define | _RPMTS_INTERNAL /* XXX ts->teErase, ts->probs */
#define | _RPMTS_PRINT
#define | _RPMROLLBACK_INTERNAL

## Functions

static int | IDTintcmp (const void *a, const void *b)
IDTX | IDTXfree (IDTX idtx)
IDTX | IDTXnew (void)
IDTX | IDTXgrow (IDTX idtx, int need)
IDTX | IDTXsort (IDTX idtx)
IDTX | IDTXload (rpmts ts, rpmTag tag, rpmuint32_t rbtid)
IDTX | IDTXglob (rpmts ts, const char *globstr, rpmTag tag, rpmuint32_t rbtid)
static int | cmpArgvStr (rpmts ts, const char *lname, const char **AV, int AC, const char *B)
| Search for string B in argv array AV. More...
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. More...
int | rpmRollback (rpmts ts, QVA_t ia, const char **argv)

## Variables

static int | reverse = -1

## Macro Definition Documentation

#define _RPMROLLBACK_INTERNAL

Definition at line 27 of file rpmrollback.c.

#define _RPMTE_INTERNAL /* XXX findErases needs rpmte internals. */

Definition at line 21 of file rpmrollback.c.

#define _RPMTS_INTERNAL /* XXX ts->teErase, ts->probs */

Definition at line 22 of file rpmrollback.c.

#define _RPMTS_PRINT

Definition at line 23 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 247 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

< End of chain marker.

Definition at line 292 of file rpmrollback.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, cmpArgvStr(), D_, headerGet(), _HE_s::p, rpmlog(), RPMLOG_DEBUG, RPMTAG_BLINKHDRID, RPMTAG_BLINKNEVRA, RPMTAG_BLINKPKGID, RPMTE_CHAIN_END, rpmteChain(), rpmtsAddEraseElement(), and _HE_s::tag.

Referenced by rpmRollback().

static int IDTintcmp | ( | const void * | a,
|  | const void * | b
| ) |  |

static

Definition at line 43 of file rpmrollback.c.

References reverse.

Referenced by IDTXsort().

IDTX IDTXfree | ( | IDTX | idtx | ) |

Definition at line 51 of file rpmrollback.c.

References _free(), and headerFree().

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

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

Definition at line 149 of file rpmrollback.c.

References _, _free(), alloca(), Fclose(), Ferror(), Fopen(), Fstrerror(), headerFree(), headerGet(), headerGetOrigin(), headerIsEntry(), headerLink(), IDTXgrow(), IDTXsort(), _HE_s::p, rpmDataType_u::ptr, rpmgiEscapeSpaces(), rpmGlob(), rpmlog(), RPMLOG_ERR, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), RPMTAG_ARCH, RPMTAG_SOURCERPM, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by rpmRollback(), and rpmts_IDTXglob().

IDTX IDTXgrow | ( | IDTX | idtx,
|  | int | need
| ) |  |

Definition at line 76 of file rpmrollback.c.

References IDTXnew(), and xrealloc().

Referenced by IDTXglob(), and IDTXload().

IDTX IDTXload | ( | rpmts | ts,
|  | rpmTag | tag,
|  | rpmuint32_t | rbtid
| ) |  |

Definition at line 100 of file rpmrollback.c.

References _free(), alloca(), headerGet(), headerLink(), IDTXgrow(), IDTXsort(), _HE_s::p, rpmDataType_u::ptr, rpmmiAddPattern(), rpmmiFree(), rpmmiInstance(), rpmmiNext(), RPMMIRE_DEFAULT, RPMTAG_NAME, rpmtsInitIterator(), _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by rpmRollback(), and rpmts_IDTXload().

IDTX IDTXnew | ( | void |  | ) |

Definition at line 68 of file rpmrollback.c.

References xcalloc().

Referenced by IDTXgrow().

IDTX IDTXsort | ( | IDTX | idtx | ) |

Definition at line 93 of file rpmrollback.c.

References IDTintcmp().

Referenced by IDTXglob(), and IDTXload().

int rpmRollback | ( | rpmts | ts,
|  | QVA_t | ia,
|  | const char ** | argv
| ) |  |

Todo:
  Transaction handling, more, needs work.

Definition at line 398 of file rpmrollback.c.

References _, _free(), _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, D_, rpmQVKArguments_s::depFlags, findErases(), headerFree(), IDTXfree(), IDTXglob(), IDTXload(), INSTALL_ERASE, INSTALL_FRESHEN, INSTALL_INSTALL, INSTALL_LABEL, INSTALL_UPGRADE, rpmQVKArguments_s::installInterfaceFlags, rpmQVKArguments_s::no_rollback_links, rpmQVKArguments_s::numrbtidExcludes, rpmQVKArguments_s::probFilter, rpmQVKArguments_s::qva_flags, rpmQVKArguments_s::rbCheck, rpmQVKArguments_s::rbOrder, rpmQVKArguments_s::rbRun, rpmQVKArguments_s::rbtid, rpmQVKArguments_s::rbtidExcludes, rpmQVKArguments_s::relocations, rpmcliInstallProblems(), rpmcliPackagesTotal, rpmExpand(), rpmExpandNumeric(), rpmIsDebug, rpmIsVerbose, rpmlog(), RPMLOG_DEBUG, RPMLOG_NOTICE, RPMPROB_FILTER_OLDPACKAGE, rpmpsFree(), rpmShowProgress(), RPMTAG_INSTALLTID, RPMTAG_REMOVETID, RPMTRANS_TYPE_ROLLBACK, rpmtsAddInstallElement(), rpmtsClean(), rpmtsEmpty(), rpmtsSetDFlags(), rpmtsSetFlags(), rpmtsSetNotifyCallback(), rpmtsSetType(), rpmtsSetVSFlags(), RPMVSF_NEEDPAYLOAD, RPMVSF_NOHDRCHK, rpmQVKArguments_s::transFlags, VERIFY_DIGEST, VERIFY_HDRCHK, VERIFY_SIGNATURE, and vsflags.

Referenced by main(), rpmts_Rollback(), and rpmtsRollback().

## Variable Documentation

int reverse = -1

static

Definition at line 39 of file rpmrollback.c.

Referenced by IDTintcmp().