#include "system.h"
#include <rpmio.h>
#include <rpmcb.h>
#include <rpmmacro.h>
#include <rpmlib.h>
#include <rpmte.h>
#include <pkgio.h>
#include <rpmgi.h>
#include <rpmdb.h>
#include "manifest.h"
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | _RPMGI_INTERNAL |
#define | _RPMTS_INTERNAL |
Functions | |
static const char * | ftsInfoStr (int fts_info) |
static FD_t | rpmgiOpen (const char *path, const char *fmode) |
Open a file after macro expanding path. | |
static rpmRC | rpmgiLoadManifest (rpmgi gi, const char *path) |
Load manifest into iterator arg list. | |
static Header | rpmgiReadHeader (rpmgi gi, const char *path) |
Return header from package. | |
static rpmRC | rpmgiLoadNextKey (rpmgi gi) |
Load next key from argv list. | |
static rpmRC | rpmgiLoadReadHeader (rpmgi gi) |
Read next header from package, lazily expanding manifests as found. | |
static rpmRC | rpmgiWalkPathFilter (rpmgi gi) |
Filter file tree walk path. | |
static rpmRC | rpmgiWalkReadHeader (rpmgi gi) |
Read header from next package, lazily walking file tree. | |
const char * | rpmgiEscapeSpaces (const char *s) |
Escape isspace(3) characters in string. | |
static rpmRC | rpmgiGlobArgv (rpmgi gi, ARGV_t argv) |
Append globbed arg list to iterator. | |
static rpmRC | rpmgiInitFilter (rpmgi gi) |
Return rpmdb match iterator with filters (if any) set. | |
rpmgi | XrpmgiUnlink (rpmgi gi, const char *msg, const char *fn, unsigned ln) |
rpmgi | XrpmgiLink (rpmgi gi, const char *msg, const char *fn, unsigned ln) |
rpmgi | rpmgiFree (rpmgi gi) |
Destroy a generalized iterator. | |
rpmgi | rpmgiNew (rpmts ts, int tag, const void *keyp, size_t keylen) |
Return a generalized iterator. | |
rpmRC | rpmgiNext (rpmgi gi) |
Perform next iteration step. | |
rpmgiFlags | rpmgiGetFlags (rpmgi gi) |
Return current iteration flags. | |
const char * | rpmgiHdrPath (rpmgi gi) |
Return current header path. | |
Header | rpmgiHeader (rpmgi gi) |
Return current iteration header. | |
rpmts | rpmgiTs (rpmgi gi) |
Return current iteration transaction set. | |
rpmRC | rpmgiSetArgs (rpmgi gi, ARGV_t argv, int ftsOpts, rpmgiFlags flags) |
Load iterator args. | |
Variables | |
int | _rpmgi_debug = 0 |
rpmgiFlags | giFlags = RPMGI_NONE |
static int | indent = 2 |
static const char * | ftsInfoStrings [] |
static const char * | _query_hdlist_path = "/usr/share/comps/%{_arch}/hdlist" |
Definition in file rpmgi.c.
static const char* ftsInfoStr | ( | int | fts_info | ) | [static] |
Definition at line 68 of file rpmgi.c.
References ftsInfoStrings.
Referenced by rpmfts_print(), and rpmgiWalkPathFilter().
const char* rpmgiEscapeSpaces | ( | const char * | s | ) |
Escape isspace(3) characters in string.
s | string |
Definition at line 327 of file rpmgi.c.
References xmalloc().
Referenced by IDTXglob(), and rpmgiGlobArgv().
Destroy a generalized iterator.
gi | generalized iterator |
Definition at line 477 of file rpmgi.c.
References _free(), argvFree(), Fclose(), Fts_close(), headerFree(), rpmdbFreeIterator(), rpmgiUnlink, rpmtsFree(), and rpmtsiFree.
Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().
rpmgiFlags rpmgiGetFlags | ( | rpmgi | gi | ) |
Return current iteration flags.
gi | generalized iterator |
Definition at line 821 of file rpmgi.c.
References RPMGI_NONE.
Referenced by rpmcliArgIter().
Append globbed arg list to iterator.
gi | generalized iterator | |
argv | arg list to be globbed (or NULL) |
Definition at line 357 of file rpmgi.c.
References _free(), argvAppend(), argvFree(), RPMDBI_ARGLIST, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMGI_NOGLOB, rpmgiEscapeSpaces(), rpmGlob(), and RPMRC_OK.
Referenced by rpmgiSetArgs().
const char* rpmgiHdrPath | ( | rpmgi | gi | ) |
Return current header path.
gi | generalized iterator |
Definition at line 826 of file rpmgi.c.
Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().
Return current iteration header.
gi | generalized iterator |
Definition at line 831 of file rpmgi.c.
Referenced by rpmcliInstall(), and rpmgiShowMatches().
Return rpmdb match iterator with filters (if any) set.
gi | generalized iterator |
Definition at line 401 of file rpmgi.c.
References _, _free(), _rpmgi_debug, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbSetIteratorRE(), rpmlog(), RPMLOG_NOTICE, RPMRC_FAIL, RPMRC_OK, RPMTAG_NAME, rpmtsInitIterator(), tagName(), tagValue(), and xstrdup().
Referenced by rpmgiNext().
Load manifest into iterator arg list.
gi | generalized iterator | |
path | file path |
Definition at line 114 of file rpmgi.c.
References Fclose(), rpmgiOpen(), RPMRC_FAIL, and rpmReadPackageManifest().
Referenced by rpmgiLoadReadHeader().
Load next key from argv list.
gi | generalized iterator |
Definition at line 170 of file rpmgi.c.
References RPMRC_NOTFOUND, and RPMRC_OK.
Referenced by rpmgiNext().
Read next header from package, lazily expanding manifests as found.
Errors, e.g. non-existent path in manifest, will terminate iteration.
Chained manifests lose an arg someplace.
gi | generalized iterator |
Definition at line 194 of file rpmgi.c.
References _free(), errno, headerFree(), headerLink(), RPMGI_NOHEADER, RPMGI_NOMANIFEST, rpmgiLoadManifest(), rpmgiReadHeader(), RPMRC_NOTFOUND, and RPMRC_OK.
Referenced by rpmgiNext().
Return a generalized iterator.
ts | transaction set | |
tag | rpm tag | |
keyp | key data (NULL for sequential access) | |
keylen | key data length (0 will use strlen(keyp)) |
Definition at line 516 of file rpmgi.c.
References rpmgiLink, rpmtsLink, rpmtsOrder(), and xcalloc().
Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().
Perform next iteration step.
gi | generalized iterator |
Definition at line 555 of file rpmgi.c.
References _, _free(), _query_hdlist_path, _rpmgi_debug, Fclose(), Fts_close(), Fts_open(), headerFree(), headerGetInstance(), headerLink(), rpmdbBlockDBI(), rpmdbFreeIterator(), rpmdbGetIteratorOffset(), RPMDBI_ADDED, RPMDBI_ARGLIST, RPMDBI_DEPENDS, RPMDBI_FTSWALK, RPMDBI_HDLIST, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbNextIterator(), RPMDEPS_FLAG_DEPLOOPS, rpmExpand(), RPMGI_ERASING, RPMGI_NOHEADER, RPMGI_TSADD, RPMGI_TSORDER, rpmgiInitFilter(), rpmgiLoadNextKey(), rpmgiLoadReadHeader(), rpmgiOpen(), rpmgiWalkReadHeader(), rpmIsVerbose, rpmlog(), RPMLOG_ERR, RPMLOG_INFO, 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 rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmgiShowMatches(), and rpmReSign().
static FD_t rpmgiOpen | ( | const char * | path, | |
const char * | fmode | |||
) | [static] |
Open a file after macro expanding path.
path | file path | |
fmode | open mode |
Definition at line 87 of file rpmgi.c.
References _, _free(), errno, Fclose(), Ferror(), Fopen(), Fstrerror(), rpmExpand(), rpmlog(), and RPMLOG_ERR.
Referenced by rpmgiLoadManifest(), rpmgiNext(), and rpmgiReadHeader().
Return header from package.
gi | generalized iterator | |
path | file path |
Definition at line 135 of file rpmgi.c.
References Fclose(), headerFree(), rpmgiOpen(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, and rpmReadPackageFile().
Referenced by rpmgiLoadReadHeader(), and rpmgiWalkReadHeader().
rpmRC rpmgiSetArgs | ( | rpmgi | gi, | |
ARGV_t | argv, | |||
int | ftsOpts, | |||
rpmgiFlags | flags | |||
) |
Load iterator args.
gi | generalized iterator | |
argv | arg list | |
ftsOpts | fts(3) flags | |
flags | iterator flags |
Definition at line 845 of file rpmgi.c.
References rpmgiGlobArgv(), and RPMRC_FAIL.
Referenced by rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), and rpmReSign().
Filter file tree walk path.
gi | generalized iterator |
Definition at line 242 of file rpmgi.c.
References _rpmgi_debug, FTS_D, FTS_DC, FTS_DEFAULT, FTS_DNR, FTS_DOT, FTS_DP, FTS_ERR, FTS_F, _ftsent::fts_info, FTS_INIT, _ftsent::fts_level, _ftsent::fts_name, _ftsent::fts_namelen, FTS_NS, FTS_NSOK, FTS_SL, FTS_SLNONE, FTS_W, ftsInfoStr(), indent, rpmlog(), RPMLOG_DEBUG, RPMRC_NOTFOUND, and RPMRC_OK.
Referenced by rpmgiWalkReadHeader().
Read header from next package, lazily walking file tree.
gi | generalized iterator |
Definition at line 291 of file rpmgi.c.
References Fts_read(), headerFree(), headerLink(), RPMGI_NOHEADER, rpmgiReadHeader(), rpmgiWalkPathFilter(), RPMRC_NOTFOUND, and RPMRC_OK.
Referenced by rpmgiNext().
Definition at line 466 of file rpmgi.c.
References _rpmgi_debug, and tagName().
Definition at line 455 of file rpmgi.c.
References _rpmgi_debug, and tagName().
const char* _query_hdlist_path = "/usr/share/comps/%{_arch}/hdlist" [static] |
int _rpmgi_debug = 0 |
Definition at line 32 of file rpmgi.c.
Referenced by rpmgiInitFilter(), rpmgiNext(), rpmgiWalkPathFilter(), XrpmgiLink(), and XrpmgiUnlink().
const char* ftsInfoStrings[] [static] |
Initial value:
{ "UNKNOWN", "D", "DC", "DEFAULT", "DNR", "DOT", "DP", "ERR", "F", "INIT", "NS", "NSOK", "SL", "SLNONE", "W", }
Definition at line 47 of file rpmgi.c.
Referenced by ftsInfoStr().
rpmgiFlags giFlags = RPMGI_NONE |
int indent = 2 [static] |
Definition at line 42 of file rpmgi.c.
Referenced by rpmfts_print(), rpmgiWalkPathFilter(), yamlstrcpy(), and yamlstrlen().