rpmgi.h File Reference
RPMGI Generalized Iterator API.
`#include <fts.h>`
`#include <argv.h>`
`#include <rpmtypes.h>`
`#include <rpmds.h>`
`#include <rpmte.h>`
`#include <rpmts.h>`
Include dependency graph for rpmgi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Typedefs

typedef enum rpmgiFlags_e | rpmgiFlags

## Enumerations

enum | rpmgiFlags_e { RPMGI_NONE = 0, RPMGI_TSADD = (1 << 0), RPMGI_TSORDER = (1 << 1), RPMGI_NOGLOB = (1 << 2), RPMGI_NOMANIFEST = (1 << 3), RPMGI_NOHEADER = (1 << 4), RPMGI_ERASING = (1 << 5) }

## Variables

int | _rpmgi_debug
rpmgiFlags | giFlags

## RPMGI

#define | rpmgiUnlink(_gi, _msg) ((rpmgi)rpmioUnlinkPoolItem((rpmioItem)(_gi), _msg, __FILE__, __LINE__))
#define | rpmgiLink(_gi, _msg) ((rpmgi)rpmioLinkPoolItem((rpmioItem)(_gi), _msg, __FILE__, __LINE__))
#define | rpmgiFree(_gi) ((rpmgi)rpmioFreePoolItem((rpmioItem)(_gi), __FUNCTION__, __FILE__, __LINE__))
rpmgi | rpmgiUnlink (rpmgi gi, const char *msg)
| Unreference a generalized iterator instance. More...
rpmgi | rpmgiLink (rpmgi gi, const char *msg)
| Reference a generalized iterator instance. More...
rpmgi | rpmgiFree (rpmgi gi)
| Destroy a generalized iterator. More...
rpmgi | rpmgiNew (rpmts ts, int tag, const void *keyp, size_t keylen)
| Return a generalized iterator. More...
rpmRC | rpmgiNext (rpmgi gi)
| Perform next iteration step. More...
rpmgiFlags | rpmgiGetFlags (rpmgi gi)
| Return current iteration flags. More...
const char * | rpmgiHdrPath (rpmgi gi)
| Return current header path. More...
Header | rpmgiHeader (rpmgi gi)
| Return current iteration header. More...
rpmts | rpmgiTs (rpmgi gi)
| Return current iteration transaction set. More...
const char * | rpmgiEscapeSpaces (const char *s)
| Escape isspace(3) characters in string. More...
rpmRC | rpmgiSetArgs (rpmgi gi, ARGV_t argv, int ftsOpts, rpmgiFlags flags)
| Load iterator args. More...
Header | rpmgiReadHeader (rpmgi gi, const char *path)
| Return header from package. More...

## Macro Definition Documentation

#define rpmgiFree | ( |  | _gi | ) | ((rpmgi)rpmioFreePoolItem((rpmioItem)(_gi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 129 of file rpmgi.h.

#define rpmgiLink | ( |  | _gi,
|  |  | _msg
| ) |  | ((rpmgi)rpmioLinkPoolItem((rpmioItem)(_gi), _msg, __FILE__, __LINE__))

Definition at line 118 of file rpmgi.h.

#define rpmgiUnlink | ( |  | _gi,
|  |  | _msg
| ) |  | ((rpmgi)rpmioUnlinkPoolItem((rpmioItem)(_gi), _msg, __FILE__, __LINE__))

Definition at line 106 of file rpmgi.h.

## Typedef Documentation

typedef enum rpmgiFlags_e rpmgiFlags

## Enumeration Type Documentation

enum rpmgiFlags_e

Enumerator
RPMGI_NONE |
RPMGI_TSADD |
RPMGI_TSORDER |
RPMGI_NOGLOB |
RPMGI_NOMANIFEST |
RPMGI_NOHEADER |
RPMGI_ERASING |

Definition at line 24 of file rpmgi.h.

## Function Documentation

const char* rpmgiEscapeSpaces | ( | const char * | s | ) |

Escape isspace(3) characters in string.

Parameters

  s | string

Returns
  escaped string

Definition at line 330 of file rpmgi.c.

References xmalloc().

Referenced by IDTXglob(), and rpmgiGlobArgv().

rpmgi rpmgiFree | ( | rpmgi | gi | ) |

Destroy a generalized iterator.

Parameters

  gi | generalized iterator

Returns
  NULL on last dereference

Referenced by main(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmgiFlags rpmgiGetFlags | ( | rpmgi | gi | ) |

Return current iteration flags.

Parameters

  gi | generalized iterator

Returns
  flags

Definition at line 816 of file rpmgi.c.

References RPMGI_NONE.

Referenced by rpmcliArgIter().

const char* rpmgiHdrPath | ( | rpmgi | gi | ) |

Return current header path.

Parameters

  gi | generalized iterator

Returns
  header path

Definition at line 821 of file rpmgi.c.

Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

Header rpmgiHeader | ( | rpmgi | gi | ) |

Return current iteration header.

Parameters

  gi | generalized iterator

Returns
  header

Definition at line 826 of file rpmgi.c.

Referenced by rpmcliInstall(), and rpmgiShowMatches().

rpmgi rpmgiLink | ( | rpmgi | gi,
|  | const char * | msg
| ) |  |

Reference a generalized iterator instance.

Parameters

  gi | generalized iterator
  msg |

Returns
  new generalized iterator reference

Referenced by rpmgiNew().

rpmgi rpmgiNew | ( | rpmts | ts,
|  | int | tag,
|  | const void * | keyp,
|  | size_t | keylen
| ) |  |

Return a generalized iterator.

Parameters

  ts | transaction set
  tag | rpm tag
  keyp | key data (NULL for sequential access)
  keylen | key data length (0 will use strlen(keyp))

Returns
  new iterator

Definition at line 505 of file rpmgi.c.

References rpmgiGetPool(), rpmgiLink(), rpmtsLink(), rpmtsOrder(), and xcalloc().

Referenced by main(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmRC rpmgiNext | ( | rpmgi | gi | ) |

Perform next iteration step.

Parameters

  gi | generalized iterator

Returns
  RPMRC_OK on success, RPMRC_NOTFOUND on EOI

Definition at line 546 of file rpmgi.c.

References _, _free(), _query_hdlist_path, _rpmgi_debug, Fclose(), Fts_close(), Fts_open(), headerFree(), headerGetInstance(), headerLink(), rpmdbBlockDBI(), RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, RPMDEPS_FLAG_DEPLOOPS, rpmExpand(), RPMGI_ERASING, RPMGI_NOHEADER, RPMGI_TSADD, RPMGI_TSORDER, rpmgiInitFilter(), rpmgiLoadNextKey(), rpmgiLoadReadHeader(), rpmgiOpen(), rpmgiWalkReadHeader(), rpmIsVerbose, rpmlog(), RPMLOG_ERR, RPMLOG_INFO, rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmpkgRead(), rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_BASENAMES, RPMTAG_PROVIDENAME, rpmteHeader(), rpmteType(), rpmtsAddEraseElement(), rpmtsAddInstallElement(), rpmtsCheck(), rpmtsDFlags(), rpmtsGetRdb(), rpmtsiFree(), rpmtsiInit(), rpmtsiNext(), rpmtsProblems(), rpmtsSetDFlags(), rpmtsSetGoal(), tagName(), TR_ADDED, TR_REMOVED, TSM_ERASE, TSM_INSTALL, and xstrdup().

Referenced by main(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmgiShowMatches(), and rpmReSign().

Header rpmgiReadHeader | ( | rpmgi | gi,
|  | const char * | path
| ) |  |

Return header from package.

Parameters

  gi | generalized iterator
  path | file path

Returns
  header (NULL on failure)

Definition at line 133 of file rpmgi.c.

References Fclose(), headerFree(), rpmgiOpen(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, and rpmReadPackageFile().

Referenced by rpmcliInstall(), rpmgiLoadReadHeader(), and rpmgiWalkReadHeader().

rpmRC rpmgiSetArgs | ( | rpmgi | gi,
|  | ARGV_t | argv,
|  | int | ftsOpts,
|  | rpmgiFlags | flags
| ) |  |

Load iterator args.

Parameters

  gi | generalized iterator
  argv | arg list
  ftsOpts | fts(3) flags
  flags | iterator flags

Returns
  RPMRC_OK on success

Definition at line 840 of file rpmgi.c.

References rpmgiGlobArgv(), and RPMRC_FAIL.

Referenced by main(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().

rpmts rpmgiTs | ( | rpmgi | gi | ) |

Return current iteration transaction set.

Parameters

  gi | generalized iterator

Returns
  transaction set

Definition at line 833 of file rpmgi.c.

rpmgi rpmgiUnlink | ( | rpmgi | gi,
|  | const char * | msg
| ) |  |

Unreference a generalized iterator instance.

Parameters

  gi | generalized iterator
  msg |

Returns
  NULL on last dereference

## Variable Documentation

int _rpmgi_debug

Definition at line 37 of file rpmgi.c.

rpmgiFlags giFlags

Definition at line 42 of file rpmgi.c.

Referenced by main(), and rpmcliArgIter().