Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

build/rpmfc.c File Reference

#include "system.h"
#include <signal.h>
#include <rpmbuild.h>
#include <argv.h>
#include <rpmfc.h>
#include <rpmds.h>
#include <rpmfi.h>
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  DepMsg_s
struct  rpmfcApplyTbl_s

Defines

#define _RPMDS_INTERNAL

Typedefs

typedef rpmfcApplyTbl_srpmfcApplyTbl
typedef DepMsg_sDepMsg_t

Functions

int rpmfcExpandAppend (ARGV_t *argvp, const ARGV_t av)
StringBuf getOutputFrom (const char *dir, ARGV_t argv, const char *writePtr, int writeBytesLeft, int failNonZero)
int rpmfcExec (ARGV_t av, StringBuf sb_stdin, StringBuf *sb_stdoutp, int failnonzero)
 Return helper output.

int rpmfcSaveArg (ARGV_t *argvp, const char *key)
char * rpmfcFileDep (char *buf, int ix, rpmds ds)
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.

rpmfc rpmfcFree (rpmfc fc)
 Destroy a file classifier.

rpmfc rpmfcNew (void)
 Create a file classifier.

int rpmfcSCRIPT (rpmfc fc)
 Extract script dependencies.

int rpmfcELF (rpmfc fc)
 Extract Elf dependencies.

int rpmfcApply (rpmfc fc)
 Build file/package dependency dictionary and mappings.

int rpmfcClassify (rpmfc fc, ARGV_t argv)
 Build file class dictionary and mappings.

void printDeps (Header h)
int rpmfcGenerateDependsHelper (const Spec spec, Package pkg, rpmfi fi)
int rpmfcGenerateDepends (const Spec spec, Package pkg)
 Generate package dependencies.


Variables

rpmfcTokens_s rpmfcTokens []
rpmfcApplyTbl_s rpmfcApplyTable []
DepMsg_s depMsgs []
DepMsg_t DepMsgs = depMsgs


Define Documentation

#define _RPMDS_INTERNAL
 

Definition at line 9 of file rpmfc.c.


Typedef Documentation

typedef struct DepMsg_s* DepMsg_t
 

Definition at line 1261 of file rpmfc.c.

Referenced by printDeps(), and rpmfcGenerateDependsHelper().

typedef struct rpmfcApplyTbl_s * rpmfcApplyTbl
 

Referenced by rpmfcApply().


Function Documentation

void printDeps Header  h  )  [static]
 

Definition at line 1331 of file rpmfc.c.

References DepMsg_t, DepMsgs, DepMsg_s::ftag, Header, int_32, DepMsg_s::mask, DepMsg_s::msg, DepMsg_s::ntag, rpmds, 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.

Parameters:
fc file classifier
Returns:
0 on success

Definition at line 1086 of file rpmfc.c.

References argiAdd(), argiCount(), argvCount(), rpmfcApplyTbl_s::colormask, rpmfc_s::ddict, rpmfc_s::ddictx, rpmfc_s::fcolor, rpmfc_s::fddictn, rpmfc_s::fddictx, rpmfc_s::fn, rpmfcApplyTbl_s::func, int_32, rpmfc_s::ix, rpmfc_s::provides, rpmfc_s::requires, rpmds, rpmdsFind(), rpmdsFree(), rpmdsSingle(), rpmfc, rpmfcApplyTable, rpmfcApplyTbl, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and ARGI_s::vals.

Referenced by main(), and rpmfcGenerateDepends().

int rpmfcClassify rpmfc  fc,
ARGV_t  argv
 

Build file class dictionary and mappings.

Parameters:
fc file classifier
argv files to classify
Returns:
0 on success

Definition at line 1175 of file rpmfc.c.

References argiAdd(), argv, ARGV_t, argvAdd(), argvCount(), argvFree(), argvSearch(), rpmfc_s::cdict, default_magicfile, rpmfc_s::fcdictx, rpmfc_s::fcolor, rpmfc_s::fddictn, rpmfc_s::fddictx, rpmfc_s::fknown, fmagic, fmagicProcess(), fmagicSetup(), rpmfc_s::fn, rpmfc_s::fwhite, global_fmagic, rpmfc_s::ix, fmagic_s::magicfile, rpmfc_s::nfiles, fmagic_s::nob, fmagic_s::obp, fmagic_s::obuf, rpmfc, RPMFC_INCLUDE, RPMFC_WHITE, rpmfcColoring(), rpmfcSaveArg(), RPMMESS_DEBUG, and rpmMessage.

Referenced by main(), and rpmfcGenerateDepends().

int rpmfcColoring const char *  fmstr  ) 
 

Return file color given file(1) string.

Parameters:
fmstr file(1) string
Returns:
file color

Definition at line 546 of file rpmfc.c.

References rpmfcTokens_s::colors, RPMFC_BLACK, RPMFC_INCLUDE, rpmfcToken, rpmfcTokens, and rpmfcTokens_s::token.

Referenced by rpmfcClassify().

int rpmfcELF rpmfc  fc  )  [static]
 

Extract Elf dependencies.

Parameters:
fc file classifier
Returns:
0 on success

Definition at line 769 of file rpmfc.c.

References _free(), rpmfc_s::ddict, EI_CLASS, ELFCLASS64, ET_EXEC, rpmfc_s::fn, int_32, rpmfc_s::ix, rpmfc_s::provides, rpmfc_s::requires, rpmds, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmExpandNumeric(), rpmfc, rpmfcFileDep(), rpmfcSaveArg(), RPMSENSE_FIND_PROVIDES, RPMSENSE_FIND_REQUIRES, RPMTAG_PROVIDENAME, RPMTAG_PROVIDES, RPMTAG_REQUIRENAME, rpmfc_s::skipProv, rpmfc_s::skipReq, stpcpy(), and xstrdup().

int rpmfcExec ARGV_t  av,
StringBuf  sb_stdin,
StringBuf sb_stdoutp,
int  failnonzero
 

Return helper output.

Parameters:
av helper argv (with possible macros)
sb_stdin helper input
Return values:
*sb_stdoutp helper output
Parameters:
failnonzero IS non-zero helper exit status a failure?

Definition at line 235 of file rpmfc.c.

References _free(), ARGV_t, argvAppend(), argvFree(), freeStringBuf(), getOutputFrom(), getStringBuf(), poptParseArgvString(), rpmExpand(), rpmfcExpandAppend(), and StringBuf.

Referenced by checkFiles(), rpmfcGenerateDependsHelper(), and rpmfcHelper().

int rpmfcExpandAppend ARGV_t argvp,
const ARGV_t  av
[static]
 

Definition at line 24 of file rpmfc.c.

References argv, ARGV_t, argvCount(), rpmExpand(), and xrealloc().

Referenced by rpmfcExec().

char* rpmfcFileDep char *  buf,
int  ix,
rpmds  ds
[static]
 

Definition at line 312 of file rpmfc.c.

References int_32, rpmds, rpmdsEVR(), rpmdsFlags(), rpmdsN(), rpmdsTagN(), RPMTAG_PROVIDENAME, and RPMTAG_REQUIRENAME.

Referenced by rpmfcELF(), rpmfcHelper(), and rpmfcSCRIPT().

rpmfc rpmfcFree rpmfc  fc  ) 
 

Destroy a file classifier.

Parameters:
fc file classifier
Returns:
NULL always

Definition at line 638 of file rpmfc.c.

References _free(), argiFree(), argvFree(), rpmfc_s::cdict, rpmfc_s::ddict, rpmfc_s::ddictx, rpmfc_s::fcdictx, rpmfc_s::fcolor, rpmfc_s::fddictn, rpmfc_s::fddictx, rpmfc_s::fn, freeStringBuf(), rpmfc_s::provides, rpmfc_s::requires, rpmdsFree(), rpmfc, rpmfc_s::sb_java, rpmfc_s::sb_perl, and rpmfc_s::sb_python.

Referenced by main(), and rpmfcGenerateDepends().

int rpmfcGenerateDepends const Spec  spec,
Package  pkg
 

Generate package dependencies.

Parameters:
spec spec file control
pkg package control
Returns:
0 on success

Definition at line 1454 of file rpmfc.c.

References _rpmfc_debug, argiCount(), argiData(), ARGV_t, argvCount(), argvData(), argvFree(), Package_s::autoProv, Package_s::autoReq, rpmfc_s::cdict, Package_s::cpioList, rpmfc_s::ddictx, Package_s::ds, rpmfc_s::fcdictx, rpmfc_s::fcolor, rpmfc_s::fddictn, rpmfc_s::fddictx, rpmfc_s::fknown, Package_s::header, headerAddEntry(), headerRemoveEntry(), int_32, rpmfc_s::nfiles, Package, printDeps(), rpmfc_s::provides, rpmfc_s::requires, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, rpmds, rpmdsCount(), rpmdsEVR(), rpmdsFree(), rpmdsMerge(), rpmdsN(), rpmdsNew(), rpmdsSingle(), rpmExpandNumeric(), rpmfc, rpmfcApply(), rpmfcClassify(), rpmfcFree(), rpmfcGenerateDependsHelper(), rpmfcNew(), rpmfcPrint(), rpmfi, rpmfiFC(), rpmfiFFlags(), rpmfiFN(), rpmfiInit(), RPMFILE_CONFIG, rpmfileAttrs, rpmfiNext(), RPMSENSE_CONFIG, 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, rpmfc_s::skipProv, rpmfc_s::skipReq, Spec, rpmfc_s::tracked, xcalloc(), and xstrdup().

Referenced by processBinaryFiles().

int rpmfcGenerateDependsHelper const Spec  spec,
Package  pkg,
rpmfi  fi
[static]
 

Definition at line 1376 of file rpmfc.c.

References _, _free(), appendLineStringBuf, DepMsg_s::argv, Package_s::autoProv, Package_s::autoReq, DepMsg_t, DepMsgs, freeStringBuf(), DepMsg_s::ftag, getStringBuf(), DepMsg_s::msg, newStringBuf(), DepMsg_s::ntag, Package, parseRCPOT(), RPMERR_EXEC, rpmError, rpmExpand(), rpmfcExec(), rpmfi, rpmfiFN(), rpmfiInit(), rpmfiNext(), RPMMESS_NORMAL, rpmMessage, RPMSENSE_FIND_PROVIDES, RPMSENSE_FIND_REQUIRES, RPMTAG_PROVIDEFLAGS, RPMTAG_REQUIREFLAGS, Spec, and StringBuf.

Referenced by rpmfcGenerateDepends().

int rpmfcHelper rpmfc  fc,
unsigned char  deptype,
const char *  nsdep
[static]
 

Run per-interpreter dependency helper.

Parameters:
fc file classifier
deptype 'P' == Provides:, 'R' == Requires:, helper
nsdep class name for interpreter (e.g. "perl")
Returns:
0 on success

Definition at line 345 of file rpmfc.c.

References appendLineStringBuf, ARGV_t, argvCount(), argvFree(), argvSplit(), rpmfc_s::ddict, rpmfc_s::fn, freeStringBuf(), getStringBuf(), int_32, rpmfc_s::ix, newStringBuf(), rpmfc_s::provides, rpmfc_s::requires, rpmds, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfc, rpmfcExec(), rpmfcFileDep(), rpmfcSaveArg(), RPMSENSE_EQUAL, RPMSENSE_FIND_PROVIDES, RPMSENSE_FIND_REQUIRES, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_RPMLIB, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, rpmfc_s::skipProv, rpmfc_s::skipReq, snprintf(), StringBuf, and rpmfc_s::tracked.

Referenced by rpmfcSCRIPT().

rpmfc rpmfcNew void   ) 
 

Create a file classifier.

Returns:
new file classifier

Definition at line 662 of file rpmfc.c.

References rpmfc, and xcalloc().

Referenced by main(), and rpmfcGenerateDepends().

void rpmfcPrint const char *  msg,
rpmfc  fc,
FILE *  fp
 

Print results of file classification.

Todo:
Remove debugging routine.
Parameters:
msg message prefix (NULL for none)
fc file classifier
fp output file handle (NULL for stderr)

Definition at line 561 of file rpmfc.c.

References rpmfc_s::cdict, rpmfc_s::ddictx, rpmfc_s::fcdictx, rpmfc_s::fcolor, rpmfc_s::fddictn, rpmfc_s::fddictx, rpmfc_s::fn, rpmfc_s::nfiles, rpmfc_s::provides, rpmfc_s::requires, rpmdsCount(), rpmdsDNEVR(), rpmdsNext(), rpmdsSetIx(), rpmfc, RPMFC_BLACK, and ARGI_s::vals.

Referenced by main(), and rpmfcGenerateDepends().

int rpmfcSaveArg ARGV_t argvp,
const char *  key
[static]
 

Definition at line 299 of file rpmfc.c.

References ARGV_t, argvAdd(), argvSearch(), and argvSort().

Referenced by rpmfcClassify(), rpmfcELF(), rpmfcHelper(), and rpmfcSCRIPT().

int rpmfcSCRIPT rpmfc  fc  )  [static]
 

Extract script dependencies.

Parameters:
fc file classifier
Returns:
0 on success

Definition at line 673 of file rpmfc.c.

References rpmfc_s::ddict, rpmfc_s::fcolor, rpmfc_s::fn, rpmfc_s::ix, rpmfc_s::requires, rpmds, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmfc, RPMFC_MODULE, RPMFC_PERL, RPMFC_PYTHON, rpmfcFileDep(), rpmfcHelper(), rpmfcSaveArg(), RPMSENSE_FIND_REQUIRES, RPMTAG_REQUIRENAME, and ARGI_s::vals.


Variable Documentation

DepMsg_t DepMsgs = depMsgs [static]
 

Definition at line 1327 of file rpmfc.c.

Referenced by printDeps(), and rpmfcGenerateDependsHelper().

struct DepMsg_s depMsgs[] [static]
 

Definition at line 1280 of file rpmfc.c.

struct rpmfcApplyTbl_s rpmfcApplyTable[] [static]
 

Initial value:

 {
    { rpmfcELF,         RPMFC_ELF },
    { rpmfcSCRIPT,      (RPMFC_SCRIPT|RPMFC_PERL) },
    { NULL, 0 }
}

Definition at line 1080 of file rpmfc.c.

Referenced by rpmfcApply().

struct rpmfcTokens_s rpmfcTokens[] [static]
 

Definition at line 465 of file rpmfc.c.

Referenced by rpmfcColoring().


Generated on Thu Oct 6 10:43:13 2005 for rpm by doxygen 1.3.5