Go to the source code of this file.
Data Structures | |
struct | MacroEntry_s |
struct | MacroContext_s |
Defines | |
#define | RMIL_DEFAULT -15 |
Markers for sources of macros added throughout rpm. | |
#define | RMIL_MACROFILES -13 |
#define | RMIL_RPMRC -11 |
#define | RMIL_CMDLINE -7 |
#define | RMIL_TARBALL -5 |
#define | RMIL_SPEC -3 |
#define | RMIL_OLDSPEC -1 |
#define | RMIL_GLOBAL 0 |
Typedefs | |
typedef MacroEntry_s * | MacroEntry |
typedef MacroContext_s * | MacroContext |
typedef enum rpmCompressedMagic_e | rpmCompressedMagic |
Enumerations | |
enum | rpmCompressedMagic_e { COMPRESSED_NOT = 0, COMPRESSED_OTHER = 1, COMPRESSED_BZIP2 = 2, COMPRESSED_ZIP = 3 } |
Functions | |
void | rpmDumpMacroTable (MacroContext mc, FILE *fp) |
Print macros to file stream. | |
int | expandMacros (void *spec, MacroContext mc, char *sbuf, size_t slen) |
Expand macro into buffer. | |
void | addMacro (MacroContext mc, const char *n, const char *o, const char *b, int level) |
Add macro to context. | |
void | delMacro (MacroContext mc, const char *n) |
Delete macro from context. | |
int | rpmDefineMacro (MacroContext mc, const char *macro, int level) |
Define macro in context. | |
void | rpmLoadMacros (MacroContext mc, int level) |
Load macros from specific context into global context. | |
void | rpmInitMacros (MacroContext mc, const char *macrofiles) |
Initialize global macro context from set of macrofile(s). | |
void | rpmFreeMacros (MacroContext mc) |
Destroy macro context. | |
int | isCompressed (const char *file, rpmCompressedMagic *compressed) |
Return type of compression used in file. | |
char * | rpmExpand (const char *arg,...) |
Return (malloc'ed) concatenated macro expansion(s). | |
char * | rpmCleanPath (char *path) |
Canonicalize file path. | |
const char * | rpmGetPath (const char *path,...) |
Return (malloc'ed) expanded, canonicalized, file path. | |
const char * | rpmGenPath (const char *urlroot, const char *urlmdir, const char *urlfile) |
Merge 3 args into path, any or all of which may be a url. | |
int | rpmExpandNumeric (const char *arg) |
Return macro expansion as a numeric value. | |
Variables | |
MacroContext | rpmGlobalMacroContext |
MacroContext | rpmCLIMacroContext |
const char * | macrofiles |
List of macro files to read when configuring rpm. |
Definition in file rpmmacro.h.
#define RMIL_CMDLINE -7 |
#define RMIL_DEFAULT -15 |
Markers for sources of macros added throughout rpm.
Definition at line 46 of file rpmmacro.h.
Referenced by doAddMacro(), main(), setDefaults(), setPathDefault(), and setVarDefault().
#define RMIL_GLOBAL 0 |
#define RMIL_MACROFILES -13 |
#define RMIL_OLDSPEC -1 |
#define RMIL_RPMRC -11 |
Definition at line 48 of file rpmmacro.h.
Referenced by doReadRC(), parseSpec(), and rpmRebuildTargetVars().
#define RMIL_SPEC -3 |
Definition at line 52 of file rpmmacro.h.
Referenced by addSource(), doScript(), doSetupMacro(), handlePreambleTag(), and parseSpec().
#define RMIL_TARBALL -5 |
typedef struct MacroContext_s * MacroContext |
The structure used to store the set of macros in a context.
typedef struct MacroEntry_s * MacroEntry |
The structure used to store a macro.
typedef enum rpmCompressedMagic_e rpmCompressedMagic |
enum rpmCompressedMagic_e |
COMPRESSED_NOT | not compressed |
COMPRESSED_OTHER | gzip can handle |
COMPRESSED_BZIP2 | bzip2 can handle |
COMPRESSED_ZIP | unzip can handle |
Definition at line 151 of file rpmmacro.h.
void addMacro | ( | MacroContext | mc, | |
const char * | n, | |||
const char * | o, | |||
const char * | b, | |||
int | level | |||
) |
Add macro to context.
mc | macro context (NULL uses global context). | |
n | macro name | |
o | macro paramaters | |
b | macro body | |
level | macro recursion level (0 is entry API) |
Definition at line 1490 of file macro.c.
References expandMacroTable(), findEntry(), MacroContext_s::firstFree, MacroContext_s::macrosAllocated, MacroContext_s::macroTable, pushMacro(), rpmGlobalMacroContext, and sortMacroTable().
Referenced by addSource(), buildForTarget(), doAddMacro(), doDefine(), doReadRC(), doScript(), doSetupMacro(), expandMacro(), grabArgs(), handlePreambleTag(), main(), makeGPGSignature(), makePGPSignature(), parseSpec(), rpmLoadMacros(), rpmRebuildTargetVars(), setDefaults(), setPathDefault(), setVarDefault(), verifyGPGSignature(), and verifyPGPSignature().
void delMacro | ( | MacroContext | mc, | |
const char * | n | |||
) |
Delete macro from context.
mc | macro context (NULL uses global context). | |
n | macro name |
Definition at line 1516 of file macro.c.
References findEntry(), popMacro(), rpmGlobalMacroContext, and sortMacroTable().
Referenced by doDelMacro(), doScript(), doUndefine(), handlePreambleTag(), makeGPGSignature(), makePGPSignature(), parseSpec(), rpmRebuildTargetVars(), verifyGPGSignature(), and verifyPGPSignature().
int expandMacros | ( | void * | spec, | |
MacroContext | mc, | |||
char * | sbuf, | |||
size_t | slen | |||
) |
Expand macro into buffer.
spec | cookie (unused) | |
mc | macro context (NULL uses global context). |
sbuf | input macro to expand, output expansion |
slen | size of buffer |
Definition at line 1451 of file macro.c.
References _, alloca(), expandMacro(), print_expand_trace, print_macro_trace, RPMERR_BADSPEC, rpmError, and rpmGlobalMacroContext.
Referenced by addFileToTagAux(), copyNextLine(), processPackageFiles(), rpmExpand(), and rpmGetPath().
int isCompressed | ( | const char * | file, | |
rpmCompressedMagic * | compressed | |||
) |
Return type of compression used in file.
file | name of file |
compressed | address of compression type |
Definition at line 1668 of file macro.c.
References _, COMPRESSED_BZIP2, COMPRESSED_NOT, COMPRESSED_OTHER, COMPRESSED_ZIP, Fclose(), Ferror(), Fopen(), Fread(), Fstrerror(), RPMERR_BADSPEC, and rpmError.
Referenced by buildForTarget(), doFoo(), doPatch(), and doUntar().
char* rpmCleanPath | ( | char * | path | ) |
Canonicalize file path.
path | path to canonicalize (in-place) |
Definition at line 1770 of file macro.c.
References begin.
Referenced by doLookup(), openDatabase(), rpmdbMoveDatabase(), rpmdbRemoveDatabase(), rpmGetPath(), and rpmQueryVerify().
int rpmDefineMacro | ( | MacroContext | mc, | |
const char * | macro, | |||
int | level | |||
) |
Define macro in context.
mc | macro context (NULL uses global context). | |
n | macro name, options, body | |
level | macro recursion level (0 is entry API) |
Definition at line 1532 of file macro.c.
References alloca(), doDefine(), and rpmGlobalMacroContext.
Referenced by main(), rpmdbRebuild(), and rpmInitMacros().
void rpmDumpMacroTable | ( | MacroContext | mc, | |
FILE * | fp | |||
) |
Print macros to file stream.
mc | macro context (NULL uses global context). | |
fp | file stream (NULL uses stderr). |
Definition at line 200 of file macro.c.
References MacroContext_s::firstFree, MacroContext_s::macroTable, and rpmGlobalMacroContext.
Referenced by expandMacro(), and rpmShowRC().
char* rpmExpand | ( | const char * | arg, | |
... | ||||
) |
Return (malloc'ed) concatenated macro expansion(s).
arg | macro(s) to expand (NULL terminates list) |
Definition at line 1720 of file macro.c.
References expandMacros(), stpcpy(), and xstrdup().
Referenced by checkForValidArchitectures(), checkPassPhrase(), cpio_doio(), dbiTagsInit(), doPrimary(), doScript(), doSetupMacro(), fillOutMainPackage(), i18nTag(), ignoreDep(), main(), makeGPGSignature(), makePGPSignature(), newRpmdb(), packageBinaries(), parseForRegexLang(), parseForRegexMultiLib(), parseSpec(), rdToken(), readLine(), rpmdbSetIteratorRE(), rpmExpandNumeric(), rpmGetPassPhrase(), rpmLookupSignatureType(), rpmReadConfigFiles(), rpmRollback(), runScript(), skipFiles(), urlFind(), verifyGPGSignature(), verifyPGPSignature(), and writeRPM().
int rpmExpandNumeric | ( | const char * | arg | ) |
Return macro expansion as a numeric value.
Boolean values ('Y' or 'y' returns 1, 'N' or 'n' returns 0) are permitted as well. An undefined macro returns 0.
arg | macro to expand |
Definition at line 1743 of file macro.c.
References _free(), and rpmExpand().
Referenced by dbiOpen(), genCpioListAndHeader(), main(), newRpmdb(), openDatabase(), parseRCPOT(), parseSpec(), processPackageFiles(), rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), rpmdbVerify(), rpmLeadVersion(), and skipFiles().
void rpmFreeMacros | ( | MacroContext | mc | ) |
Destroy macro context.
mc | macro context (NULL uses global context). |
Definition at line 1641 of file macro.c.
References _free(), MacroEntry_s::body, MacroContext_s::firstFree, MacroContext_s::macroTable, MacroEntry_s::name, MacroEntry_s::opts, MacroEntry_s::prev, and rpmGlobalMacroContext.
const char* rpmGenPath | ( | const char * | urlroot, | |
const char * | urlmdir, | |||
const char * | urlfile | |||
) |
Merge 3 args into path, any or all of which may be a url.
The leading part of the first URL encountered is used for the result, other URL prefixes are discarded, permitting a primitive form of URL inheiritance.
urlroot | root URL (often path to chroot, or NULL) | |
urlmdir | directory URL (often a directory, or NULL) | |
urlfile | file URL (often a file, or NULL) |
Definition at line 1889 of file macro.c.
References _debug, _free(), alloca(), file, rpmGetPath(), URL_IS_DASH, and urlPath().
Referenced by buildForTarget(), db1close(), db1open(), db3close(), db3open(), db_init(), doScript(), doSetupMacro(), handlePreambleTag(), makeTempFile(), processBinaryFile(), processPackageFiles(), psmStage(), and rpmInstall().
const char* rpmGetPath | ( | const char * | path, | |
... | ||||
) |
Return (malloc'ed) expanded, canonicalized, file path.
path | macro(s) to expand (NULL terminates list) |
Definition at line 1858 of file macro.c.
References expandMacros(), rpmCleanPath(), stpcpy(), and xstrdup().
Referenced by addFileToTagAux(), addSource(), buildForTarget(), checkSpec(), db3close(), db3open(), doPatch(), doReadRC(), doRmSource(), doUntar(), newRpmdb(), packageBinaries(), packageSources(), parseFiles(), parseSpec(), processPackageFiles(), processSourceFiles(), psmStage(), readIcon(), rpmdbRebuild(), rpmDetectPGPVersion(), rpmErase(), rpmGenPath(), rpmGetFilesystemUsage(), rpmInstall(), setPathDefault(), verifyGPGSignature(), and verifyPGPSignature().
void rpmInitMacros | ( | MacroContext | mc, | |
const char * | macrofiles | |||
) |
Initialize global macro context from set of macrofile(s).
mc | (unused) | |
macrofiles | colon separated list of macro files (NULL does nothing) |
Definition at line 1568 of file macro.c.
References _free(), Fclose(), Ferror(), Fopen(), getenv(), max_macro_depth, rdcl(), RMIL_CMDLINE, RMIL_MACROFILES, rpmCLIMacroContext, rpmDefineMacro(), rpmGlobalMacroContext, rpmLoadMacros(), SKIPBLANK, and xstrdup().
Referenced by rpmReadRC().
void rpmLoadMacros | ( | MacroContext | mc, | |
int | level | |||
) |
Load macros from specific context into global context.
mc | macro context (NULL does nothing). | |
level | macro recursion level (0 is entry API) |
Definition at line 1547 of file macro.c.
References addMacro(), MacroEntry_s::body, MacroContext_s::firstFree, MacroContext_s::macroTable, MacroEntry_s::name, MacroEntry_s::opts, and rpmGlobalMacroContext.
Referenced by rpmInitMacros().