#include <stdio.h>
#include <stdlib.h>
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 struct MacroEntry_s * | MacroEntry |
typedef struct MacroContext_s * | MacroContext |
typedef enum rpmCompressedMagic_e | rpmCompressedMagic |
Enumerations | |
enum | rpmCompressedMagic_e { COMPRESSED_NOT = 0, COMPRESSED_OTHER = 1, COMPRESSED_BZIP2 = 2, COMPRESSED_ZIP = 3, COMPRESSED_LZMA = 4 } |
Functions | |
void | rpmDumpMacroTable (MacroContext mc, FILE *fp) |
Print macros to file stream. | |
int | rpmGlob (const char *patterns, int *argcPtr, const char ***argvPtr) |
Return URL path(s) from a (URL prefixed) pattern glob. | |
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. | |
int | rpmLoadMacroFile (MacroContext mc, const char *fn) |
Load macro context from a macro file. | |
void | rpmInitMacros (MacroContext mc, const char *macrofiles) |
Initialize 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 |
Definition at line 53 of file rpmmacro.h.
Referenced by ftsCacheUpdate(), and rpmcliAllArgCallback().
#define RMIL_DEFAULT -15 |
Markers for sources of macros added throughout rpm.
Definition at line 49 of file rpmmacro.h.
Referenced by main(), rpmtsOpenSDB(), setDefaults(), setPathDefault(), and setVarDefault().
#define RMIL_GLOBAL 0 |
Definition at line 57 of file rpmmacro.h.
#define RMIL_MACROFILES -13 |
Definition at line 50 of file rpmmacro.h.
#define RMIL_OLDSPEC -1 |
#define RMIL_RPMRC -11 |
#define RMIL_SPEC -3 |
Definition at line 55 of file rpmmacro.h.
Referenced by addSource(), doScript(), doSetupMacro(), handlePreambleTag(), and parseSpec().
#define RMIL_TARBALL -5 |
typedef struct MacroContext_s * MacroContext |
typedef struct MacroEntry_s * MacroEntry |
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 |
COMPRESSED_LZMA | lzma can handle |
Definition at line 174 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 1873 of file macro.c.
Referenced by addSource(), buildForTarget(), doReadRC(), doScript(), doSetupMacro(), handlePreambleTag(), main(), makeGPGSignature(), makePGPSignature(), parseSpec(), rpmPlatform(), rpmrc_AddMacro(), rpmtsOpenSDB(), setDefaults(), setPathDefault(), and setVarDefault().
void delMacro | ( | MacroContext | mc, | |
const char * | n | |||
) |
Delete macro from context.
mc | macro context (NULL uses global context). | |
n | macro name |
Definition at line 1899 of file macro.c.
Referenced by doScript(), handlePreambleTag(), makeGPGSignature(), makePGPSignature(), parseSpec(), rpmrc_DelMacro(), and rpmtsOpenSDB().
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 1838 of file macro.c.
Referenced by addFileToTagAux(), copyNextLineFromOFI(), and processPackageFiles().
int isCompressed | ( | const char * | file, | |
rpmCompressedMagic * | compressed | |||
) |
char* rpmCleanPath | ( | char * | path | ) |
Canonicalize file path.
path | path to canonicalize (in-place) |
Definition at line 2183 of file macro.c.
Referenced by doLookup(), relocateFileList(), and rpmQueryVerify().
int rpmDefineMacro | ( | MacroContext | mc, | |
const char * | macro, | |||
int | level | |||
) |
Define macro in context.
mc | macro context (NULL uses global context). | |
macro | macro name, options, body | |
level | macro recursion level (0 is entry API) |
Definition at line 1915 of file macro.c.
Referenced by ftsCacheUpdate(), and rpmcliAllArgCallback().
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 207 of file macro.c.
References _, MacroEntry_s::body, MacroContext_s::firstFree, MacroEntry_s::level, MacroContext_s::macroTable, MacroEntry_s::name, MacroEntry_s::opts, rpmGlobalMacroContext, and MacroEntry_s::used.
char* rpmExpand | ( | const char * | arg, | |
... | ||||
) |
Return (malloc'ed) concatenated macro expansion(s).
arg | macro(s) to expand (NULL terminates list) |
Definition at line 2133 of file macro.c.
Referenced by checkForValidArchitectures(), checkPassPhrase(), cpio_doio(), db3New(), defaultMachine(), doPrimary(), doScript(), doSetupMacro(), expandMacro(), initGlobs(), main(), makeGPGSignature(), makePGPSignature(), open_dso(), packageBinaries(), parseForRegexLang(), parseForSimple(), parseSpec(), processSourceFiles(), rdToken(), readLine(), rpmcliAllArgCallback(), rpmcliImportPubkeys(), rpmcliQuery(), rpmfcExec(), rpmfcExpandAppend(), rpmGetPassPhrase(), rpmgiNext(), rpmgiOpen(), rpmLookupSignatureType(), rpmPlatform(), rpmRollback(), rpmts_IDTXglob(), rpmtsFindPubkey(), rpmtsSolve(), skipFiles(), urlFind(), 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 2156 of file macro.c.
Referenced by build(), genCpioListAndHeader(), main(), parseRCPOT(), parseSpec(), processPackageFiles(), relocateFileList(), rpmcliQuery(), rpmcliVerify(), rpmdbInit(), rpmErase(), rpmfcELF(), rpmInstall(), rpmLeadVersion(), rpmRollback(), rpmts_Create(), rpmts_init(), rpmtsCreate(), rpmtsOpenSDB(), rpmtsRun(), and skipFiles().
void rpmFreeMacros | ( | MacroContext | mc | ) |
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 2302 of file macro.c.
Referenced by buildForTarget(), db3close(), db3open(), db_init(), doScript(), doSetupMacro(), handlePreambleTag(), makeTempFile(), processPackageFiles(), rpmInstall(), and rpmInstallSourcePackage().
const char* rpmGetPath | ( | const char * | path, | |
... | ||||
) |
Return (malloc'ed) expanded, canonicalized, file path.
path | macro(s) to expand (NULL terminates list) |
Definition at line 2271 of file macro.c.
Referenced by addFileToTagAux(), addSource(), buildForTarget(), db3close(), db3open(), doPatch(), doReadRC(), doRmSource(), doUntar(), genCpioListAndHeader(), main(), packageBinaries(), packageSources(), parseFiles(), parseForSimple(), parseSpec(), processPackageFiles(), processSourceFiles(), readIcon(), rpmDetectPGPVersion(), rpmfiNew(), rpmInstall(), rpmQueryVerify(), rpmsxParse(), rpmts_Run(), rpmtsOpenDB(), rpmtsOpenSDB(), and setPathDefault().
int rpmGlob | ( | const char * | patterns, | |
int * | argcPtr, | |||
const char *** | argvPtr | |||
) |
Return URL path(s) from a (URL prefixed) pattern glob.
patterns | glob pattern |
*argcPtr | no. of paths | |
*argvPtr | array of paths (malloc'd contiguous blob) |
Definition at line 1694 of file macro.c.
References _free(), getenv(), Glob(), Glob_error(), Glob_pattern_p(), Globfree(), setlocale, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), xmalloc(), XpoptParseArgvString(), xrealloc(), and xstrdup().
Referenced by IDTXglob(), rpmgiGlobArgv(), rpmGraph(), rpmInstall(), and rpmReadPackageManifest().
void rpmInitMacros | ( | MacroContext | mc, | |
const char * | macrofiles | |||
) |
int rpmLoadMacroFile | ( | MacroContext | mc, | |
const char * | fn | |||
) |
void rpmLoadMacros | ( | MacroContext | mc, | |
int | level | |||
) |