#include "system.h"
#include <signal.h>
#include <rpmbuild.h>
#include <argv.h>
#include <rpmfc.h>
#include <rpmns.h>
#include <rpmds.h>
#include <rpmfi.h>
#include <rpmts.h>
#include <rpmdb.h>
#include "debug.h"
Include dependency graph for rpmfc.c:
Go to the source code of this file.
Data Structures | |
struct | rpmfcApplyTbl_s |
struct | DepMsg_s |
Defines | |
#define | _RPMEVR_INTERNAL |
#define | _RPMFC_INTERNAL |
#define | _RPMNS_INTERNAL |
#define | _RPMDS_INTERNAL |
#define | _suffix(_s, _x) (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x))) |
Typedefs | |
typedef rpmfcApplyTbl_s * | rpmfcApplyTbl |
typedef DepMsg_s * | DepMsg_t |
Functions | |
static int | rpmfcExpandAppend (ARGV_t *argvp, const ARGV_t av) |
static StringBuf | getOutputFrom (const char *dir, ARGV_t argv, const char *writePtr, int writeBytesLeft, int failNonZero) |
Return output from helper script. | |
int | rpmfcExec (ARGV_t av, StringBuf sb_stdin, StringBuf *sb_stdoutp, int failnonzero) |
Return helper output. | |
static int | rpmfcSaveArg (ARGV_t *argvp, const char *key) |
static char * | rpmfcFileDep (char *buf, int ix, rpmds ds) |
static regex_t * | rpmfcExpandRegexps (const char *str, int *count) |
static int | rpmfcMatchRegexps (regex_t *regexps, int count, const char *str, char deptype) |
static regex_t * | rpmfcFreeRegexps (regex_t *regexps, int count) |
static int | rpmfcHelper (rpmfc fc, unsigned char deptype, const char *nsdep, regex_t *noauto, int noauto_c) |
Run per-interpreter dependency helper. | |
int | rpmfcColoring (const char *fmstr) |
Return file color given file(1) string. | |
void | rpmfcPrint (const char *msg, rpmfc fc, FILE *fp) |
Print results of file classification. | |
rpmfc | rpmfcFree (rpmfc fc) |
Destroy a file classifier. | |
rpmfc | rpmfcNew (void) |
Create a file classifier. | |
static int | rpmfcSCRIPT (rpmfc fc) |
Extract script dependencies. | |
static int | rpmfcMergePR (void *context, rpmds ds) |
Merge provides/requires dependencies into a rpmfc container. | |
static int | rpmfcMONO (rpmfc fc) |
Extract .NET dependencies. | |
static int | rpmfcELF (rpmfc fc) |
Extract Elf dependencies. | |
static int | rpmfcFindRequiredPackages (rpmfc fc) |
int | rpmfcApply (rpmfc fc) |
Build file/package dependency dictionary and mappings. | |
int | rpmfcClassify (rpmfc fc, ARGV_t argv, int_16 *fmode) |
static void | printDeps (Header h) |
Print dependencies in a header. | |
static int | rpmfcGenerateDependsHelper (const Spec spec, Package pkg, rpmfi fi) |
static int | rpmfcGenerateScriptletDeps (const Spec spec, Package pkg) |
int | rpmfcGenerateDepends (void *specp, void *pkgp) |
Generate package dependencies. | |
Variables | |
static struct rpmfcTokens_s | rpmfcTokens [] |
static struct rpmfcApplyTbl_s | rpmfcApplyTable [] |
XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication. | |
static struct DepMsg_s | depMsgs [] |
static DepMsg_t | DepMsgs = depMsgs |
static struct DepMsg_s | scriptMsgs [] |
static DepMsg_t | ScriptMsgs = scriptMsgs |
#define _suffix | ( | _s, | |||
_x | ) | (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x))) |
Referenced by rpmfcClassify(), and rpmInitMacros().
typedef struct rpmfcApplyTbl_s * rpmfcApplyTbl |
static void printDeps | ( | Header | h | ) | [static] |
Print dependencies in a header.
h | header |
Definition at line 1480 of file rpmfc.c.
References DepMsgs, DepMsg_s::ftag, DepMsg_s::mask, DepMsg_s::msg, DepMsg_s::ntag, rpmdsDNEVR(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsNew(), rpmdsNext(), RPMMESS_NORMAL, rpmMessage, and DepMsg_s::xor.
Referenced by rpmfcGenerateDepends().
int rpmfcApply | ( | rpmfc | fc | ) |
Build file/package dependency dictionary and mappings.
fc | file classifier |
Definition at line 1095 of file rpmfc.c.
References _, rpmfcApplyTbl_s::colormask, rpmfcApplyTbl_s::func, rpmExpand(), RPMFC_PYTHON, rpmfcApplyTable, rpmfcExpandRegexps(), RPMMESS_DEBUG, RPMMESS_NORMAL, and rpmMessage.
Referenced by main(), and rpmfcGenerateDepends().
Definition at line 1255 of file rpmfc.c.
References _, _free(), _suffix, argiAdd(), argvAdd(), argvCount(), argvFree(), argvSearch(), errno, RPMERR_EXEC, rpmError, rpmExpand(), RPMFC_INCLUDE, RPMFC_WHITE, rpmfcColoring(), rpmfcSaveArg(), RPMMESS_DEBUG, rpmMessage, S_IFSOCK, and urlPath().
Referenced by main(), and rpmfcGenerateDepends().
int rpmfcColoring | ( | const char * | fmstr | ) |
Return file color given file(1) string.
fmstr | file(1) string |
Definition at line 613 of file rpmfc.c.
References RPMFC_BLACK, RPMFC_INCLUDE, and rpmfcTokens.
Referenced by rpmfcClassify().
static int rpmfcELF | ( | rpmfc | fc | ) | [static] |
Extract Elf dependencies.
fc | file classifier |
Definition at line 961 of file rpmfc.c.
References rpmdsELF(), RPMELF_FLAG_SKIPPROVIDES, RPMELF_FLAG_SKIPREQUIRES, and rpmfcMergePR().
Return helper output.
av | helper argv (with possible macros) | |
sb_stdin | helper input |
*sb_stdoutp | helper output |
failnonzero | IS non-zero helper exit status a failure? |
Definition at line 209 of file rpmfc.c.
References _free(), argvAppend(), argvFree(), freeStringBuf(), getOutputFrom(), getStringBuf(), rpmExpand(), and rpmfcExpandAppend().
Referenced by checkFiles(), rpmfcGenerateDependsHelper(), rpmfcGenerateScriptletDeps(), and rpmfcHelper().
Definition at line 27 of file rpmfc.c.
References argvCount(), rpmExpand(), and xrealloc().
Referenced by rpmfcExec().
static regex_t* rpmfcExpandRegexps | ( | const char * | str, | |
int * | count | |||
) | [static] |
Definition at line 314 of file rpmfc.c.
References _, _free(), rpmExpand(), RPMMESS_NORMAL, and rpmMessage.
Referenced by rpmfcApply(), and rpmfcFindRequiredPackages().
static char* rpmfcFileDep | ( | char * | buf, | |
int | ix, | |||
rpmds | ds | |||
) | [static] |
Definition at line 288 of file rpmfc.c.
References rpmdsEVR(), rpmdsFlags(), rpmdsN(), rpmdsTagN(), RPMTAG_PROVIDENAME, and RPMTAG_REQUIRENAME.
Referenced by rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().
static int rpmfcFindRequiredPackages | ( | rpmfc | fc | ) | [static] |
Definition at line 992 of file rpmfc.c.
References _, argvCount(), headerGetEntry(), rpmdbFreeIterator(), rpmdbGetIteratorCount(), rpmdbNextIterator(), rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfcExpandRegexps(), rpmfcFreeRegexps(), RPMMESS_DEBUG, RPMMESS_NORMAL, rpmMessage, RPMTAG_NAME, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, rpmtsCreate(), rpmtsFree(), and rpmtsInitIterator().
Destroy a file classifier.
fc | file classifier |
Definition at line 705 of file rpmfc.c.
References _free(), argiFree(), argvFree(), freeStringBuf(), and rpmdsFree().
Referenced by main(), and rpmfcGenerateDepends().
static regex_t* rpmfcFreeRegexps | ( | regex_t * | regexps, | |
int | count | |||
) | [static] |
Definition at line 371 of file rpmfc.c.
References _free().
Referenced by rpmfcFindRequiredPackages().
int rpmfcGenerateDepends | ( | void * | specp, | |
void * | pkgp | |||
) |
Generate package dependencies.
specp | spec file control | |
pkgp | package control |
Definition at line 1699 of file rpmfc.c.
References _free(), _rpmfc_debug, argiCount(), argiData(), argvCount(), argvData(), argvFree(), Package_s::autoProv, Package_s::autoReq, Package_s::cpioList, Package_s::ds, Package_s::header, headerAddEntry(), headerRemoveEntry(), DepMsg_s::msg, printDeps(), Spec_s::rootURL, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, rpmdsCount(), rpmdsEVR(), rpmdsFree(), rpmdsMerge(), rpmdsN(), rpmdsNew(), rpmdsSingle(), rpmExpandNumeric(), rpmfcApply(), rpmfcClassify(), rpmfcFree(), rpmfcGenerateDependsHelper(), rpmfcGenerateScriptletDeps(), rpmfcNew(), rpmfcPrint(), rpmfiFC(), rpmfiFFlags(), rpmfiFMode(), rpmfiFN(), rpmfiInit(), RPMFILE_CONFIG, rpmfiNext(), rpmGenPath(), RPMSENSE_EQUAL, RPMTAG_CLASSDICT, RPMTAG_DEPENDSDICT, RPMTAG_FILECLASS, RPMTAG_FILECOLORS, RPMTAG_FILEDEPENDSN, RPMTAG_FILEDEPENDSX, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, urlPath(), xcalloc(), and xstrdup().
Referenced by processBinaryFiles().
Definition at line 1526 of file rpmfc.c.
References _, _free(), Spec_s::_parseRCPOT, appendLineStringBuf, DepMsg_s::argv, Package_s::autoProv, Package_s::autoReq, DepMsgs, freeStringBuf(), DepMsg_s::ftag, getStringBuf(), DepMsg_s::msg, newStringBuf(), DepMsg_s::ntag, RPMERR_EXEC, rpmError, rpmExpand(), rpmfcExec(), rpmfiFN(), rpmfiInit(), rpmfiNext(), RPMMESS_NORMAL, rpmMessage, RPMTAG_PROVIDEFLAGS, and RPMTAG_REQUIREFLAGS.
Referenced by rpmfcGenerateDepends().
Definition at line 1630 of file rpmfc.c.
References Spec_s::_parseRCPOT, appendLineStringBuf, DepMsg_s::argv, freeStringBuf(), DepMsg_s::ftag, getStringBuf(), Package_s::header, headerGetEntryMinMemory(), DepMsg_s::mask, DepMsg_s::msg, newStringBuf(), DepMsg_s::ntag, rpmfcExec(), ScriptMsgs, stpcpy(), stripTrailingBlanksStringBuf(), truncStringBuf(), and DepMsg_s::vtag.
Referenced by rpmfcGenerateDepends().
static int rpmfcHelper | ( | rpmfc | fc, | |
unsigned char | deptype, | |||
const char * | nsdep, | |||
regex_t * | noauto, | |||
int | noauto_c | |||
) | [static] |
Run per-interpreter dependency helper.
fc | file classifier | |
deptype | 'P' == Provides:, 'R' == Requires:, helper | |
nsdep | class name for interpreter (e.g. "perl") | |
noauto | _noauto* regexps | |
noauto_c | # of _noauto* regexps |
Definition at line 389 of file rpmfc.c.
References appendLineStringBuf, argvCount(), argvFree(), argvSplit(), freeStringBuf(), getStringBuf(), newStringBuf(), rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfcExec(), rpmfcFileDep(), rpmfcMatchRegexps(), rpmfcSaveArg(), RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and snprintf().
Referenced by rpmfcMONO().
static int rpmfcMatchRegexps | ( | regex_t * | regexps, | |
int | count, | |||
const char * | str, | |||
char | deptype | |||
) | [static] |
Definition at line 356 of file rpmfc.c.
References _, RPMMESS_DEBUG, RPMMESS_NORMAL, and rpmMessage.
Referenced by rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().
static int rpmfcMergePR | ( | void * | context, | |
rpmds | ds | |||
) | [static] |
Merge provides/requires dependencies into a rpmfc container.
context | merge dependency set(s) container | |
ds | dependency set to merge |
Definition at line 887 of file rpmfc.c.
References _rpmfc_debug, rpmdsMerge(), rpmdsTagN(), rpmfcFileDep(), rpmfcMatchRegexps(), rpmfcSaveArg(), RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and tagName().
Referenced by rpmfcELF().
static int rpmfcMONO | ( | rpmfc | fc | ) | [static] |
Extract .NET dependencies.
fc | file classifier |
Definition at line 932 of file rpmfc.c.
References rpmfcHelper().
rpmfc rpmfcNew | ( | void | ) |
Create a file classifier.
Definition at line 730 of file rpmfc.c.
References xcalloc().
Referenced by main(), and rpmfcGenerateDepends().
void rpmfcPrint | ( | const char * | msg, | |
rpmfc | fc, | |||
FILE * | fp | |||
) |
Print results of file classification.
msg | message prefix (NULL for none) | |
fc | file classifier | |
fp | output file handle (NULL for stderr) |
Definition at line 628 of file rpmfc.c.
References rpmdsCount(), rpmdsDNEVR(), rpmdsNext(), rpmdsSetIx(), and RPMFC_BLACK.
Referenced by main(), and rpmfcGenerateDepends().
static int rpmfcSaveArg | ( | ARGV_t * | argvp, | |
const char * | key | |||
) | [static] |
Definition at line 273 of file rpmfc.c.
References argvAdd(), argvSearch(), and argvSort().
Referenced by rpmfcClassify(), rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().
static int rpmfcSCRIPT | ( | rpmfc | fc | ) | [static] |
Extract script dependencies.
fc | file classifier |
Definition at line 741 of file rpmfc.c.
References rpmdsFree(), rpmdsMerge(), rpmdsSingle(), RPMFC_PERL, RPMFC_PHP, RPMFC_PYTHON, rpmfcFileDep(), rpmfcMatchRegexps(), rpmfcSaveArg(), and RPMTAG_REQUIRENAME.
Definition at line 1474 of file rpmfc.c.
Referenced by printDeps(), and rpmfcGenerateDependsHelper().
struct rpmfcApplyTbl_s rpmfcApplyTable[] [static] |
Initial value:
{ { rpmfcELF, RPMFC_ELF }, { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP) }, { rpmfcMONO, RPMFC_MONO }, { NULL, 0 } }
Definition at line 985 of file rpmfc.c.
Referenced by rpmfcApply().
struct rpmfcTokens_s rpmfcTokens[] [static] |
DepMsg_t ScriptMsgs = scriptMsgs [static] |
struct DepMsg_s scriptMsgs[] [static] |
Initial value:
{ { "Requires(pre)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, RPMTAG_PREINPROG, RPMTAG_PREIN, RPMTAG_REQUIREFLAGS, RPMSENSE_SCRIPT_PRE, 0 }, { "Requires(post)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, RPMTAG_POSTINPROG, RPMTAG_POSTIN, RPMTAG_REQUIREFLAGS, RPMSENSE_SCRIPT_POST, 0 }, { "Requires(preun)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, RPMTAG_PREUNPROG, RPMTAG_PREUN, RPMTAG_REQUIREFLAGS, RPMSENSE_SCRIPT_PREUN, 0 }, { "Requires(postun)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, RPMTAG_POSTUNPROG, RPMTAG_POSTUN, RPMTAG_REQUIREFLAGS, RPMSENSE_SCRIPT_POSTUN, 0 }, { NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 } }