#include "system.h"
#include <signal.h>
#include <rpmio.h>
#include <rpmiotypes.h>
#include <rpmlog.h>
#include <rpmurl.h>
#include <rpmmg.h>
#include <argv.h>
#include <mire.h>
#include <rpmtag.h>
#include <rpmbuild.h>
#include <rpmns.h>
#include <rpmfc.h>
#include <rpmds.h>
#include <rpmfi.h>
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | rpmfcApplyTbl_s |
struct | DepMsg_s |
Defines | |
#define | _MIRE_INTERNAL |
#define | _RPMEVR_INTERNAL |
#define | _RPMNS_INTERNAL |
#define | _RPMFC_INTERNAL |
#define | _RPMDS_INTERNAL |
#define | _suffix(_s, _x) (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x))) |
Typedefs | |
typedef struct rpmfcApplyTbl_s * | rpmfcApplyTbl |
typedef struct DepMsg_s * | DepMsg_t |
Functions | |
static int | rpmfcExpandAppend (ARGV_t *argvp, const ARGV_t av) |
static rpmiob | getOutputFrom (const char *dir, ARGV_t argv, const char *writePtr, size_t writeBytesLeft, int failNonZero) |
Return output from helper script. | |
int | rpmfcExec (ARGV_t av, rpmiob iob_stdin, rpmiob *iob_stdoutp, int failnonzero) |
static int | rpmfcSaveArg (ARGV_t *argvp, const char *key) |
static char * | rpmfcFileDep (char *buf, size_t ix, rpmds ds) |
static void * | rpmfcExpandRegexps (const char *str, int *nmirep) |
static int | rpmfcMatchRegexps (void *mires, int nmire, const char *str, char deptype) |
static void * | rpmfcFreeRegexps (void *mires, int nmire) |
static int | rpmfcHelper (rpmfc fc, unsigned char deptype, const char *nsdep) |
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. | |
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 | rpmfcELF (rpmfc fc) |
Extract Elf dependencies. | |
rpmRC | rpmfcApply (rpmfc fc) |
Build file/package dependency dictionary and mappings. | |
rpmRC | rpmfcClassify (rpmfc fc, ARGV_t argv, rpmuint16_t *fmode) |
static void | printDeps (Header h) |
Print dependencies in a header. | |
static rpmRC | rpmfcGenerateDependsHelper (const Spec spec, Package pkg, rpmfi fi) |
static int | rpmfcGenerateScriptletDeps (const Spec spec, Package pkg) |
rpmRC | rpmfcGenerateDepends (void *specp, void *pkgp) |
Generate package dependencies. | |
static void | rpmfcFini (void *_fc) |
static rpmfc | rpmfcGetPool (rpmioPool pool) |
rpmfc | rpmfcNew (void) |
Create a file classifier. | |
Variables | |
static int | _filter_values = 1 |
static int | _filter_execs = 1 |
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 |
rpmioPool | _rpmfcPool = NULL |
#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 rpmiob getOutputFrom | ( | const char * | dir, |
ARGV_t | argv, | ||
const char * | writePtr, | ||
size_t | writeBytesLeft, | ||
int | failNonZero | ||
) | [static] |
Return output from helper script.
dir | directory to run in (or NULL) |
argv | program and arguments to run |
writePtr | bytes to feed to script on stdin (or NULL) |
writeBytesLeft | no. of bytes to feed to script on stdin |
failNonZero | is script failure an error? |
Definition at line 69 of file rpmfc.c.
References _, _free(), argvJoin(), Chdir(), D_, errno, EXIT_FAILURE, rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, and unsetenv().
Referenced by rpmfcExec().
static void printDeps | ( | Header | h ) | [static] |
Print dependencies in a header.
h | header |
Definition at line 1327 of file rpmfc.c.
References DepMsg_s::ftag, DepMsg_s::mask, DepMsg_s::msg, DepMsg_s::ntag, rpmdsDNEVR(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsNew(), rpmdsNext(), rpmlog(), RPMLOG_NOTICE, and DepMsg_s::xor.
Referenced by rpmfcGenerateDepends().
Build file/package dependency dictionary and mappings.
fc | file classifier |
Definition at line 950 of file rpmfc.c.
References _, _filter_execs, argiAdd(), argiCount(), argvCount(), rpmfcApplyTbl_s::colormask, D_, rpmfcApplyTbl_s::func, mireRegexec(), rpmdsFind(), rpmdsFree(), rpmdsSingle(), rpmfcExpandRegexps(), rpmfcFreeRegexps(), rpmlog(), RPMLOG_DEBUG, RPMLOG_NOTICE, and RPMRC_OK.
Referenced by main(), and rpmfcGenerateDepends().
rpmRC rpmfcClassify | ( | rpmfc | fc, |
ARGV_t | argv, | ||
rpmuint16_t * | fmode | ||
) |
Definition at line 1114 of file rpmfc.c.
References _free(), _rpmfc_debug, _suffix, argiAdd(), argvAdd(), argvCount(), argvFree(), argvSearch(), D_, ftype(), rpmExpand(), rpmfcColoring(), rpmfcSaveArg(), rpmlog(), RPMLOG_DEBUG, rpmmgFile(), rpmmgFree(), rpmmgNew(), RPMRC_OK, 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 633 of file rpmfc.c.
References RPMFC_BLACK, and rpmfcTokens.
Referenced by rpmfcClassify().
static int rpmfcELF | ( | rpmfc | fc ) | [static] |
Extract Elf dependencies.
fc | file classifier |
Definition at line 918 of file rpmfc.c.
References rpmdsELF(), RPMELF_FLAG_SKIPPROVIDES, RPMELF_FLAG_SKIPREQUIRES, and rpmfcMergePR().
Definition at line 225 of file rpmfc.c.
References _free(), argvAppend(), argvFree(), getOutputFrom(), rpmExpand(), rpmfcExpandAppend(), rpmiobFree(), rpmiobLen(), and rpmiobStr().
Referenced by checkUnpackagedFiles(), rpmfcGenerateDependsHelper(), rpmfcGenerateScriptletDeps(), and rpmfcHelper().
Definition at line 40 of file rpmfc.c.
References argvCount(), rpmExpand(), and xrealloc().
Referenced by rpmfcExec().
static void* rpmfcExpandRegexps | ( | const char * | str, |
int * | nmirep | ||
) | [static] |
Definition at line 330 of file rpmfc.c.
References _, _free(), mireAppend(), mireFree(), rpmExpand(), rpmlog(), RPMLOG_NOTICE, and RPMMIRE_REGEX.
Referenced by rpmfcApply().
static char* rpmfcFileDep | ( | char * | buf, |
size_t | ix, | ||
rpmds | ds | ||
) | [static] |
Definition at line 300 of file rpmfc.c.
References rpmdsEVR(), rpmdsFlags(), rpmdsN(), and rpmdsTagN().
Referenced by rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().
static void rpmfcFini | ( | void * | _fc ) | [static] |
Definition at line 1817 of file rpmfc.c.
References argiFree(), argvFree(), rpmdsFree(), and rpmiobFree().
Referenced by rpmfcGetPool().
static void* rpmfcFreeRegexps | ( | void * | mires, |
int | nmire | ||
) | [static] |
rpmRC rpmfcGenerateDepends | ( | void * | specp, |
void * | pkgp | ||
) |
Generate package dependencies.
specp | spec file control |
pkgp | package control |
Definition at line 1550 of file rpmfc.c.
References _free(), _rpmfc_debug, alloca(), argiCount(), argiData(), rpmDataType_u::argv, argvCount(), argvData(), argvFree(), Package_s::autoProv, Package_s::autoReq, _HE_s::c, Package_s::cpioList, Package_s::ds, Package_s::header, headerDel(), headerPut(), DepMsg_s::msg, _HE_s::p, printDeps(), rpmDataType_u::ptr, Spec_s::rootURL, RPM_STRING_ARRAY_TYPE, RPM_UINT32_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(), RPMRC_OK, RPMSENSE_EQUAL, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, urlPath(), xcalloc(), and xstrdup().
Referenced by processBinaryFiles().
Definition at line 1375 of file rpmfc.c.
References _, _free(), Spec_s::_parseRCPOT, DepMsg_s::argv, Package_s::autoProv, Package_s::autoReq, DepMsg_s::ftag, DepMsg_s::msg, DepMsg_s::ntag, rpmExpand(), rpmfcExec(), rpmfiFN(), rpmfiInit(), rpmfiNext(), rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmiobStr(), rpmlog(), RPMLOG_ERR, RPMLOG_NOTICE, RPMRC_FAIL, and RPMRC_OK.
Referenced by rpmfcGenerateDepends().
Definition at line 1480 of file rpmfc.c.
References _free(), Spec_s::_parseRCPOT, alloca(), DepMsg_s::argv, DepMsg_s::ftag, Package_s::header, headerGet(), DepMsg_s::mask, DepMsg_s::msg, DepMsg_s::ntag, _HE_s::p, rpmDataType_u::ptr, rpmfcExec(), rpmiobAppend(), rpmiobEmpty(), rpmiobFree(), rpmiobNew(), rpmiobRTrim(), rpmiobStr(), stpcpy(), rpmDataType_u::str, _HE_s::tag, and DepMsg_s::vtag.
Referenced by rpmfcGenerateDepends().
Definition at line 1846 of file rpmfc.c.
References _rpmfc_debug, _rpmfcPool, rpmfcFini(), rpmioGetPool(), and rpmioNewPool().
Referenced by rpmfcNew().
static int rpmfcHelper | ( | rpmfc | fc, |
unsigned char | deptype, | ||
const char * | nsdep | ||
) | [static] |
Run per-interpreter dependency helper.
fc | file classifier |
deptype | 'P' == Provides:, 'R' == Requires:, helper |
nsdep | class name for interpreter (e.g. "perl") |
Definition at line 406 of file rpmfc.c.
References _filter_values, argvCount(), argvFree(), argvSplit(), rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfcExec(), rpmfcFileDep(), rpmfcMatchRegexps(), rpmfcSaveArg(), rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmiobStr(), RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, and snprintf().
Referenced by rpmfcSCRIPT().
static int rpmfcMatchRegexps | ( | void * | mires, |
int | nmire, | ||
const char * | str, | ||
char | deptype | ||
) | [static] |
Definition at line 371 of file rpmfc.c.
References _, D_, mireRegexec(), rpmlog(), RPMLOG_DEBUG, and RPMLOG_NOTICE.
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 869 of file rpmfc.c.
References _filter_values, _rpmfc_debug, rpmdsMerge(), rpmdsTagN(), rpmfcFileDep(), rpmfcMatchRegexps(), rpmfcSaveArg(), and tagName().
Referenced by rpmfcELF().
rpmfc rpmfcNew | ( | void | ) |
Create a file classifier.
Definition at line 1860 of file rpmfc.c.
References rpmfcGetPool(), and rpmfcLink().
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 648 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 285 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 730 of file rpmfc.c.
References _filter_values, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfcFileDep(), rpmfcHelper(), rpmfcMatchRegexps(), and rpmfcSaveArg().
int _filter_execs = 1 [static] |
Definition at line 36 of file rpmfc.c.
Referenced by rpmfcApply().
int _filter_values = 1 [static] |
Definition at line 34 of file rpmfc.c.
Referenced by rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().
rpmioPool _rpmfcPool = NULL |
Definition at line 1844 of file rpmfc.c.
Referenced by rpmfcGetPool().
struct rpmfcApplyTbl_s rpmfcApplyTable[] [static] |
{ { rpmfcELF, RPMFC_ELF }, { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO) }, { NULL, 0 } }
XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication.
struct rpmfcTokens_s rpmfcTokens[] [static] |
Definition at line 533 of file rpmfc.c.
Referenced by rpmfcColoring().
struct DepMsg_s scriptMsgs[] [static] |
{ { "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 } }
DepMsg_t ScriptMsgs = scriptMsgs [static] |