rpm
4.5
|
Go to the source code of this file.
Data Structures | |
struct | MacroEntry_s |
struct | MacroContext_s |
Macros | |
#define | RMIL_DEFAULT -15 |
Markers for sources of macros added throughout rpm. More... | |
#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_LZOP = 4, COMPRESSED_LZMA = 5, COMPRESSED_XZ = 6 } |
Functions | |
void | rpmDumpMacroTable (MacroContext mc, FILE *fp) |
Print macros to file stream. More... | |
int | rpmGlob (const char *patterns, int *argcPtr, const char ***argvPtr) |
Return URL path(s) from a (URL prefixed) pattern glob. More... | |
int | expandMacros (void *spec, MacroContext mc, char *sbuf, size_t slen) |
Expand macro into buffer. More... | |
void | addMacro (MacroContext mc, const char *n, const char *o, const char *b, int level) |
Add macro to context. More... | |
void | delMacro (MacroContext mc, const char *n) |
Delete macro from context. More... | |
int | rpmDefineMacro (MacroContext mc, const char *macro, int level) |
Define macro in context. More... | |
void | rpmLoadMacros (MacroContext mc, int level) |
Load macros from specific context into global context. More... | |
int | rpmLoadMacroFile (MacroContext mc, const char *fn) |
Load macro context from a macro file. More... | |
void | rpmInitMacros (MacroContext mc, const char *macrofiles) |
Initialize macro context from set of macrofile(s). More... | |
void | rpmFreeMacros (MacroContext mc) |
Destroy macro context. More... | |
int | isCompressed (const char *file, rpmCompressedMagic *compressed) |
Return type of compression used in file. More... | |
char * | rpmExpand (const char *arg,...) |
Return (malloc'ed) concatenated macro expansion(s). More... | |
char * | rpmCleanPath (char *path) |
Canonicalize file path. More... | |
const char * | rpmGetPath (const char *path,...) |
Return (malloc'ed) expanded, canonicalized, file path. More... | |
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. More... | |
int | rpmExpandNumeric (const char *arg) |
Return macro expansion as a numeric value. More... | |
Variables | |
MacroContext | rpmGlobalMacroContext |
MacroContext | rpmCLIMacroContext |
const char * | rpmMacrofiles |
List of macro files to read when configuring rpm. More... | |
#define RMIL_CMDLINE -7 |
Definition at line 50 of file rpmmacro.h.
Referenced by rpmcliAllArgCallback(), and rpmInitMacros().
#define RMIL_DEFAULT -15 |
Markers for sources of macros added throughout rpm.
Definition at line 46 of file rpmmacro.h.
Referenced by rpmtsOpenSDB(), setDefaults(), setPathDefault(), and setVarDefault().
#define RMIL_GLOBAL 0 |
Definition at line 54 of file rpmmacro.h.
Referenced by expandMacro().
#define RMIL_MACROFILES -13 |
Definition at line 47 of file rpmmacro.h.
Referenced by rpmLoadMacroFile().
#define RMIL_OLDSPEC -1 |
Definition at line 53 of file rpmmacro.h.
Referenced by handlePreambleTag().
#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(), doSetupMacro(), handlePreambleTag(), parsePreamble(), and parseSpec().
#define RMIL_TARBALL -5 |
Definition at line 51 of file rpmmacro.h.
typedef struct MacroContext_s * MacroContext |
typedef struct MacroEntry_s * MacroEntry |
typedef enum rpmCompressedMagic_e rpmCompressedMagic |
enum rpmCompressedMagic_e |
Definition at line 167 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 1977 of file macro.c.
References _, expandMacroTable(), findEntry(), MacroContext_s::firstFree, MacroEntry_s::flags, MacroContext_s::macrosAllocated, MacroContext_s::macroTable, name, pushMacro(), RPMERR_BADSPEC, rpmError, rpmGlobalMacroContext, and sortMacroTable().
Referenced by addSource(), doDefine(), doReadRC(), doSetupMacro(), expandMacro(), grabArgs(), handlePreambleTag(), headerMacrosLoad(), makeGPGSignature(), makePGPSignature(), parsePreamble(), parseSpec(), rpmLoadMacros(), rpmPlatform(), rpmrc_AddMacro(), rpmRebuildTargetVars(), 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 2016 of file macro.c.
References findEntry(), popMacro(), rpmGlobalMacroContext, and sortMacroTable().
Referenced by delMacroAll(), doUndefine(), handlePreambleTag(), headerMacrosUnload(), makeGPGSignature(), makePGPSignature(), parseSpec(), rpmrc_DelMacro(), rpmRebuildTargetVars(), 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 1942 of file macro.c.
References _, alloca(), MacroBuf_s::depth, MacroBuf_s::expand_trace, expandMacro(), MacroBuf_s::macro_trace, MacroBuf_s::mc, MacroBuf_s::nb, print_expand_trace, print_macro_trace, RPMERR_BADSPEC, rpmError, rpmGlobalMacroContext, MacroBuf_s::s, MacroBuf_s::spec, and MacroBuf_s::t.
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 2210 of file macro.c.
References _, COMPRESSED_BZIP2, COMPRESSED_LZMA, COMPRESSED_LZOP, COMPRESSED_NOT, COMPRESSED_OTHER, COMPRESSED_XZ, COMPRESSED_ZIP, Fclose(), Ferror(), Fopen(), Fread(), Fstrerror(), RPMERR_BADSPEC, and rpmError.
char* rpmCleanPath | ( | char * | path | ) |
Canonicalize file path.
path | path to canonicalize (in-place) |
Definition at line 2350 of file macro.c.
Referenced by db3open(), doLookup(), relocateFileList(), rpmdbMoveDatabase(), rpmdbRemoveDatabase(), rpmGetPath(), rpmioAccess(), 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 2044 of file macro.c.
References alloca(), doDefine(), MacroBuf_s::mc, and rpmGlobalMacroContext.
Referenced by rpmcliAllArgCallback(), rpmdbRebuild(), and rpmLoadMacroFile().
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 219 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.
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 2284 of file macro.c.
References _macro_BUFSIZ, expandMacros(), stpcpy(), xmalloc(), xrealloc(), and xstrdup().
Referenced by addChangelog(), archScore(), checkFiles(), checkForValidArchitectures(), checkPassPhrase(), cpio_doio(), dbiTagsInit(), defaultMachine(), doPrimary(), doSetupMacro(), expandMacro(), fillOutMainPackage(), formatValue(), headerMacrosLoad(), headerMacrosUnload(), i18nTag(), ignoreDep(), makeGPGSignature(), makePGPSignature(), Open(), open_dso(), packageBinaries(), parseBuildInstallClean(), parseForRegexLang(), parseForSimple(), parseSpec(), processSourceFiles(), rdToken(), readLine(), Realpath(), rpmcliAllArgCallback(), rpmcliImportPubkeys(), rpmcliQuery(), rpmdbNew(), rpmdbSetIteratorRE(), rpmdsCpuinfo(), rpmdsGetconf(), rpmdsLdconfig(), rpmdsPipe(), rpmdsSysinfo(), rpmExpandNumeric(), rpmfcApply(), rpmfcClassify(), rpmfcExec(), rpmfcExpandAppend(), rpmfcExpandRegexps(), rpmfcGenerateDependsHelper(), rpmGetPassPhrase(), rpmgiNext(), rpmgiOpen(), rpmLookupSignatureType(), rpmMachineScore(), rpmnsParse(), rpmPlatform(), rpmReadConfigFiles(), rpmReadRC(), rpmRollback(), rpmShowRC(), rpmts_IDTXglob(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsFindPubkey(), rpmtsRollback(), rpmtsSolve(), runInstScript(), runScript(), skipFiles(), statFormat(), unsatisfiedDepend(), 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 2323 of file macro.c.
References _free(), and rpmExpand().
Referenced by addChangelog(), checkFiles(), checkPackageDeps(), dbiOpen(), doIcon(), genCpioListAndHeader(), main(), parseSpec(), processPackageFiles(), relocateFileList(), rpmcliQuery(), rpmcliVerify(), rpmdbInit(), rpmdbNew(), rpmdbOpen(), rpmdbRebuild(), rpmdbVerify(), rpmdsELF(), rpmErase(), rpmfcGenerateDepends(), rpmInstall(), rpmLeadVersion(), rpmRollback(), rpmts_Create(), rpmts_init(), rpmtsCreate(), rpmtsOpenSDB(), rpmtsRollback(), rpmtsRun(), skipFiles(), and unsatisfiedDepend().
void rpmFreeMacros | ( | MacroContext | mc | ) |
Destroy macro context.
mc | macro context (NULL uses global context). |
Definition at line 2183 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.
Referenced by main(), rpmcliFini(), and rpmspecQuery().
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 2473 of file macro.c.
References _free(), alloca(), file, rpmGetPath(), URL_IS_DASH, and urlPath().
Referenced by addSource(), checkSpec(), db3close(), db3open(), db_init(), doIcon(), doPatch(), doSetupMacro(), doUntar(), handlePreambleTag(), makeTempFile(), prepFetch(), processBinaryFile(), processMetadataFile(), processPackageFiles(), rpmdsNew(), rpmfcGenerateDepends(), rpmInstall(), rpmInstallSourcePackage(), and rpmpsmStage().
const char* rpmGetPath | ( | const char * | path, |
... | |||
) |
Return (malloc'ed) expanded, canonicalized, file path.
path | macro(s) to expand (NULL terminates list) |
Definition at line 2441 of file macro.c.
References _macro_BUFSIZ, alloca(), expandMacros(), rpmCleanPath(), stpcpy(), and xstrdup().
Referenced by addFileToTagAux(), Chroot(), db3close(), db3open(), doPatch(), doReadRC(), doUntar(), genCpioListAndHeader(), initSourceHeader(), packageBinaries(), packageSources(), parseFiles(), parseForSimple(), parseSpec(), processPackageFiles(), Realpath(), rpmdbExportInfo(), rpmdbNew(), rpmdbRebuild(), rpmdbURIPath(), rpmDetectPGPVersion(), rpmdsSysinfo(), rpmfiBuildREContexts(), rpmfiNew(), rpmGenPath(), rpmGetFilesystemUsage(), rpmInstall(), rpmpsmStage(), rpmQueryVerify(), rpmsxParse(), rpmts_Run(), rpmtsCreate(), rpmtsOpenDB(), rpmtsOpenSDB(), runScript(), setPathDefault(), str2uuid(), and unsatisfiedDepend().
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 1798 of file macro.c.
References _free(), 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(), processBinaryFile(), rpmgiGlobArgv(), rpmInitMacros(), rpmInstall(), and rpmReadPackageManifest().
void rpmInitMacros | ( | MacroContext | mc, |
const char * | macrofiles | ||
) |
Initialize macro context from set of macrofile(s).
mc | macro context |
macrofiles | colon separated list of macro files (NULL does nothing) |
Definition at line 2112 of file macro.c.
References _free(), _suffix, RMIL_CMDLINE, rpmGlob(), rpmGlobalMacroContext, rpmLoadMacroFile(), rpmLoadMacros(), xmalloc(), and xstrdup().
Referenced by rpmReadRC().
int rpmLoadMacroFile | ( | MacroContext | mc, |
const char * | fn | ||
) |
Load macro context from a macro file.
mc | (unused) |
fn | macro file name |
Definition at line 2078 of file macro.c.
References _macro_BUFSIZ, _MAX_MACRO_DEPTH, alloca(), Fclose(), Ferror(), Fopen(), max_macro_depth, rdcl(), RMIL_MACROFILES, rpmDefineMacro(), and SKIPBLANK.
Referenced by expandMacro(), and rpmInitMacros().
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 2057 of file macro.c.
References addMacro(), MacroEntry_s::body, MacroContext_s::firstFree, MacroContext_s::macroTable, MacroEntry_s::name, and MacroEntry_s::opts.
Referenced by rpmInitMacros().
MacroContext rpmCLIMacroContext |
MacroContext rpmGlobalMacroContext |