Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

rpmio/rpmmacro.h File Reference

More...

Go to the source code of this file.

Compounds

struct  MacroContext
struct  MacroEntry

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  MacroEntry
typedef struct MacroContext  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. More...

int expandMacros (void *spec, MacroContext *mc, char *sbuf, size_t sbuflen)
 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 context into global context. 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 *root, const char *mdir, const char *file)
 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...


Detailed Description

Definition in file rpmmacro.h.


Define Documentation

#define RMIL_CMDLINE   -7
 

Definition at line 32 of file rpmmacro.h.

#define RMIL_DEFAULT   -15
 

Markers for sources of macros added throughout rpm.

Definition at line 28 of file rpmmacro.h.

#define RMIL_GLOBAL   0
 

Definition at line 36 of file rpmmacro.h.

#define RMIL_MACROFILES   -13
 

Definition at line 29 of file rpmmacro.h.

#define RMIL_OLDSPEC   -1
 

Definition at line 35 of file rpmmacro.h.

#define RMIL_RPMRC   -11
 

Definition at line 30 of file rpmmacro.h.

#define RMIL_SPEC   -3
 

Definition at line 34 of file rpmmacro.h.

#define RMIL_TARBALL   -5
 

Definition at line 33 of file rpmmacro.h.


Typedef Documentation

typedef struct MacroContext MacroContext
 

The structure used to store the set of macros in a context.

typedef struct MacroEntry MacroEntry
 

The structure used to store a macro.

typedef enum rpmCompressedMagic_e rpmCompressedMagic
 


Enumeration Type Documentation

enum rpmCompressedMagic_e
 

Enumeration values:
COMPRESSED_NOT   not compressed
COMPRESSED_OTHER   gzip can handle
COMPRESSED_BZIP2   bzip2 can handle
COMPRESSED_ZIP   unzip can handle

Definition at line 110 of file rpmmacro.h.


Function Documentation

void addMacro ( MacroContext * mc,
const char * n,
const char * o,
const char * b,
int level )
 

Add macro to context.

Deprecated:
Use rpmDefineMacro().
Parameters:
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 1331 of file macro.c.

Referenced by RMIL_GLOBAL(), addSource(), buildForTarget(), doAddMacro(), doDefine(), doReadRC(), doScript(), doSetupMacro(), expandMacro(), grabArgs(), handlePreambleTag(), main(), parseSpec(), rpmInstallLoadMacros(), rpmLoadMacros(), rpmRebuildTargetVars(), setDefaults(), setPathDefault(), and setVarDefault().

void delMacro ( MacroContext * mc,
const char * n )
 

Delete macro from context.

Parameters:
mc   macro context (NULL uses global context).
n   macro name

Definition at line 1354 of file macro.c.

Referenced by RMIL_GLOBAL(), doDelMacro(), doScript(), doUndefine(), handlePreambleTag(), parseSpec(), and rpmRebuildTargetVars().

int expandMacros ( void * spec,
MacroContext * mc,
char * sbuf,
size_t sbuflen )
 

Expand macro into buffer.

Deprecated:
Use rpmExpand().
Todo:
Eliminate from API.
Parameters:
spec   cookie (unused)
mc   macro context (NULL uses global context).
Return values:
sbuf   input macro to expand, output expansion
Parameters:
sbuflen   size of buffer
Returns:
0 on success

Definition at line 1295 of file macro.c.

Referenced by RMIL_GLOBAL(), addFileToTagAux(), copyNextLine(), processPackageFiles(), rpmExpand(), and rpmGetPath().

int isCompressed ( const char * file,
rpmCompressedMagic * compressed )
 

Return type of compression used in file.

Parameters:
file   name of file
Return values:
compressed   address of compression type
Returns:
0 on success, 1 on I/O error

Definition at line 1490 of file macro.c.

Referenced by buildForTarget(), doFoo(), doPatch(), and doUntar().

char* rpmCleanPath ( char * path )
 

Canonicalize file path.

Parameters:
path   path to canonicalize (in-place)
Returns:
canonicalized path (malloc'ed)

Definition at line 1590 of file macro.c.

Referenced by doLookup(), removeBinaryPackage(), rpmGetPath(), rpmQueryVerify(), rpmdbMoveDatabase(), and rpmdbRemoveDatabase().

int rpmDefineMacro ( MacroContext * mc,
const char * macro,
int level )
 

Define macro in context.

Parameters:
mc   macro context (NULL uses global context).
n   macro name, options, body
level   macro recursion level (0 is entry API)
Returns:
Todo:
Document.

Definition at line 1370 of file macro.c.

Referenced by RMIL_GLOBAL(), main(), and rpmInitMacros().

void rpmDumpMacroTable ( MacroContext * mc,
FILE * fp )
 

Print macros to file stream.

Parameters:
mc   macro context (NULL uses global context).
fp   file stream

Definition at line 159 of file macro.c.

Referenced by RMIL_GLOBAL(), expandMacro(), and rpmShowRC().

char* rpmExpand ( const char * arg,
... )
 

Return (malloc'ed) concatenated macro expansion(s).

Parameters:
arg   macro(s) to expand (NULL terminates list)
Returns:
macro expansion (malloc'ed)

Definition at line 1541 of file macro.c.

Referenced by checkForValidArchitectures(), checkPassPhrase(), cpio_doio(), dbiTagsInit(), doPrimary(), doScript(), doSetupMacro(), fillOutMainPackage(), generateDepends(), i18nTag(), main(), makeGPGSignature(), makePGPSignature(), packageBinaries(), parseForRegexLang(), parseForRegexMultiLib(), parseSpec(), rdToken(), readLine(), rpmExpandNumeric(), rpmGetPassPhrase(), rpmLookupSignatureType(), rpmReadConfigFiles(), 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.

Parameters:
arg   macro to expand
Returns:
numeric value

Definition at line 1563 of file macro.c.

Referenced by dbiOpen(), genCpioListAndHeader(), main(), newRpmdb(), parseRCPOT(), parseSpec(), processPackageFiles(), rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and skipFiles().

void rpmFreeMacros ( MacroContext * mc )
 

Destroy macro context.

Parameters:
mc   macro context (NULL uses global context).

Definition at line 1467 of file macro.c.

Referenced by RMIL_GLOBAL(), build(), and main().

const char* rpmGenPath ( const char * root,
const char * mdir,
const char * file )
 

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's are discarded, permitting a primitive form of inheiritance.

Parameters:
root   root URL (often path to chroot, or NULL)
mdir   directory URL (often a directory, or NULL)
file   file URL (often a file, or NULL)
Returns:
expanded, merged, canonicalized path (malloc'ed)

Definition at line 1699 of file macro.c.

Referenced by buildForTarget(), db1close(), db1open(), doScript(), doSetupMacro(), handlePreambleTag(), installSources(), makeTempFile(), processBinaryFile(), processPackageFiles(), and rpmInstall().

const char* rpmGetPath ( const char * path,
... )
 

Return (malloc'ed) expanded, canonicalized, file path.

Parameters:
path   macro(s) to expand (NULL terminates list)
Returns:
canonicalized path (malloc'ed)

Definition at line 1670 of file macro.c.

Referenced by addFileToTagAux(), addSource(), buildForTarget(), checkSpec(), doPatch(), doReadRC(), doRmSource(), doUntar(), newRpmdb(), packageBinaries(), packageSources(), parseFiles(), parseForSimple(), parseSpec(), processPackageFiles(), processSourceFiles(), readIcon(), rpmDetectPGPVersion(), rpmErase(), rpmGenPath(), rpmGetFilesystemUsage(), rpmInstall(), rpmdbRebuild(), setPathDefault(), verifyGPGSignature(), and verifyPGPSignature().

void rpmInitMacros ( MacroContext * mc,
const char * macrofiles )
 

Initialize macro context from set of macrofile(s).

Parameters:
mc   macro context (NULL uses global context).
macrofiles   colon separated list of macro files (NULL does nothing)

Definition at line 1401 of file macro.c.

Referenced by RMIL_GLOBAL(), and rpmReadRC().

void rpmLoadMacros ( MacroContext * mc,
int level )
 

Load macros from context into global context.

Parameters:
mc   macro context (NULL does nothing).
level   macro recursion level (0 is entry API)

Definition at line 1382 of file macro.c.

Referenced by RMIL_GLOBAL(), and rpmInitMacros().


Generated at Mon May 21 08:53:43 2001 for rpm by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001