rpm  5.4.10
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
rpmrc.c File Reference
#include "system.h"
#include <stdarg.h>
#include <rpmio.h>
#include <rpmcb.h>
#include <mire.h>
#include <argv.h>
#include <rpmlua.h>
#include <rpmluaext.h>
#include <rpmmacro.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include <rpmevr.h>
#include <rpmds.h>
#include <rpmcli.h>
#include <rpmsyck.h>
#include "debug.h"
Include dependency graph for rpmrc.c:

Go to the source code of this file.

Data Structures

struct  machCacheEntry_s
 
struct  machCache_s
 
struct  machEquivInfo_s
 
struct  machEquivTable_s
 
struct  defaultEntry_s
 
struct  canonEntry_s
 
struct  tableType_s
 
struct  cpu_vendor_os_gnu
 

Macros

#define __power_pc()   0
 
#define _RPMIOB_INTERNAL   /* XXX for rpmiobSlurp */
 
#define _MIRE_INTERNAL
 
#define _RPMEVR_INTERNAL
 
#define _RPMDS_INTERNAL
 
#define RPM_MACHTABLE_COUNT   4
 
#define OS   0
 
#define ARCH   1
 
#define _TOPDIRMACRO   "%{_topdir}/"
 

Typedefs

typedef const char * cptr_t
 
typedef struct machCacheEntry_smachCacheEntry
 
typedef struct machCache_smachCache
 
typedef struct machEquivInfo_smachEquivInfo
 
typedef struct machEquivTable_smachEquivTable
 
typedef struct defaultEntry_sdefaultEntry
 
typedef struct canonEntry_scanonEntry
 
typedef struct tableType_stableType
 
typedef struct cpu_vendor_os_gnuCVOG_t
 

Enumerations

enum  rpm_machtable_e { RPM_MACHTABLE_INSTARCH = 0, RPM_MACHTABLE_INSTOS = 1, RPM_MACHTABLE_BUILDARCH = 2, RPM_MACHTABLE_BUILDOS = 3 }
 Build and install arch/os table identifiers. More...
 

Functions

static void rpmRebuildTargetVars (const char **target, const char **canontarget)
 
static machCacheEntry machCacheFindEntry (const machCache cache, const char *key)
 
static void machAddEquiv (machEquivTable table, const char *name, int distance)
 
static void machCacheEntryVisit (machCache cache, machEquivTable table, const char *name, int distance)
 
static void rebuildCompatTables (int type, const char *name)
 
static canonEntry lookupInCanonTable (const char *name, const canonEntry table, int tableLen)
 
static const char * lookupInDefaultTable (const char *name, const defaultEntry table, int tableLen)
 
static void addMacroDefault (const char *macroname, const char *val, const char *body)
 
static void setPathDefault (const char *macroname, const char *subdir)
 
static void setDefaults (void)
 
static int parseCVOG (const char *str, CVOG_t *cvogp)
 
static rpmRC rpmPlatform (const char *platform)
 Read and configure /etc/rpm/platform patterns. More...
 
int rpmPlatformScore (const char *platform, void *mi_re, int mi_nre)
 
static void defaultMachine (const char **arch, const char **os)
 
static void rpmSetTables (int archTable, int osTable)
 
static void rpmSetMachine (const char *arch, const char *os)
 
static void getMachineInfo (int type, const char **name, int *num)
 
void rpmFreeRpmrc (void)
 
static int rpmReadRC (const char *macrofiles)
 Read macro configuration file(s). More...
 
int rpmReadConfigFiles (const char *file, const char *target)
 
int rpmShowRC (FILE *fp)
 

Variables

static const char * configTarget = NULL
 
static const char * platform = SYSCONFIGDIR "/platform"
 
void * platpat = NULL
 
int nplatpat = 0
 
rpmds cpuinfoP
 
static struct tableType_s tables [4]
 
static cptr_t current [2]
 
static int currTables [2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH }
 
static int defaultsInitialized = 0
 
static const char * ___build_pre
 

Macro Definition Documentation

§ __power_pc

#define __power_pc ( )    0

Definition at line 8 of file rpmrc.c.

§ _MIRE_INTERNAL

#define _MIRE_INTERNAL

Definition at line 14 of file rpmrc.c.

§ _RPMDS_INTERNAL

#define _RPMDS_INTERNAL

Definition at line 26 of file rpmrc.c.

§ _RPMEVR_INTERNAL

#define _RPMEVR_INTERNAL

Definition at line 23 of file rpmrc.c.

§ _RPMIOB_INTERNAL

#define _RPMIOB_INTERNAL   /* XXX for rpmiobSlurp */

Definition at line 11 of file rpmrc.c.

§ _TOPDIRMACRO

#define _TOPDIRMACRO   "%{_topdir}/"

Referenced by setPathDefault().

§ ARCH

#define ARCH   1

§ OS

#define OS   0

Definition at line 124 of file rpmrc.c.

Referenced by rpmFreeRpmrc(), rpmRebuildTargetVars(), rpmSetMachine(), rpmSetTables(), and rpmShowRC().

§ RPM_MACHTABLE_COUNT

#define RPM_MACHTABLE_COUNT   4

No. of arch/os tables.

Definition at line 61 of file rpmrc.c.

Referenced by rpmFreeRpmrc().

Typedef Documentation

§ canonEntry

typedef struct canonEntry_s * canonEntry

§ cptr_t

typedef const char* cptr_t

Definition at line 63 of file rpmrc.c.

§ CVOG_t

typedef struct cpu_vendor_os_gnu * CVOG_t

§ defaultEntry

typedef struct defaultEntry_s * defaultEntry

§ machCache

typedef struct machCache_s * machCache

§ machCacheEntry

typedef struct machCacheEntry_s * machCacheEntry

§ machEquivInfo

typedef struct machEquivInfo_s * machEquivInfo

§ machEquivTable

typedef struct machEquivTable_s * machEquivTable

§ tableType

typedef struct tableType_s * tableType

Enumeration Type Documentation

§ rpm_machtable_e

Build and install arch/os table identifiers.

Deprecated:
Eliminate from API.
Todo:
Eliminate in rpm-5.1.
Enumerator
RPM_MACHTABLE_INSTARCH 

Install platform architecture.

RPM_MACHTABLE_INSTOS 

Install platform operating system.

RPM_MACHTABLE_BUILDARCH 

Build platform architecture.

RPM_MACHTABLE_BUILDOS 

Build platform operating system.

Definition at line 55 of file rpmrc.c.

Function Documentation

§ addMacroDefault()

static void addMacroDefault ( const char *  macroname,
const char *  val,
const char *  body 
)
static

Definition at line 271 of file rpmrc.c.

References addMacro(), and RMIL_DEFAULT.

Referenced by setDefaults().

§ defaultMachine()

static void defaultMachine ( const char **  arch,
const char **  os 
)
static

§ getMachineInfo()

static void getMachineInfo ( int  type,
const char **  name,
int *  num 
)
static

§ lookupInCanonTable()

static canonEntry lookupInCanonTable ( const char *  name,
const canonEntry  table,
int  tableLen 
)
static

Definition at line 241 of file rpmrc.c.

Referenced by getMachineInfo().

§ lookupInDefaultTable()

static const char* lookupInDefaultTable ( const char *  name,
const defaultEntry  table,
int  tableLen 
)
static

Definition at line 258 of file rpmrc.c.

References defaultEntry_s::defName, and machCacheEntry_s::name.

Referenced by rpmSetMachine().

§ machAddEquiv()

static void machAddEquiv ( machEquivTable  table,
const char *  name,
int  distance 
)
static

§ machCacheEntryVisit()

static void machCacheEntryVisit ( machCache  cache,
machEquivTable  table,
const char *  name,
int  distance 
)
static

§ machCacheFindEntry()

static machCacheEntry machCacheFindEntry ( const machCache  cache,
const char *  key 
)
static

Definition at line 150 of file rpmrc.c.

References machCache_s::cache, machCacheEntry_s::name, and machCache_s::size.

Referenced by machCacheEntryVisit().

§ parseCVOG()

static int parseCVOG ( const char *  str,
CVOG_t cvogp 
)
static

§ rebuildCompatTables()

static void rebuildCompatTables ( int  type,
const char *  name 
)
static

§ rpmFreeRpmrc()

void rpmFreeRpmrc ( void  )

§ rpmPlatform()

static rpmRC rpmPlatform ( const char *  platform)
static

§ rpmPlatformScore()

int rpmPlatformScore ( const char *  platform,
void *  mi_re,
int  mi_nre 
)

Definition at line 653 of file rpmrc.c.

References mireRegexec(), nplatpat, and platpat.

Referenced by archScore(), getMachineInfo(), platformScore(), and rpmtsAddInstallElement().

§ rpmReadConfigFiles()

int rpmReadConfigFiles ( const char *  file,
const char *  target 
)

§ rpmReadRC()

static int rpmReadRC ( const char *  macrofiles)
static

Read macro configuration file(s).

Returns
0 on success

Definition at line 1073 of file rpmrc.c.

References _free(), defaultsInitialized, rpmExpand(), rpmInitMacros(), and setDefaults().

Referenced by rpmReadConfigFiles().

§ rpmRebuildTargetVars()

static void rpmRebuildTargetVars ( const char **  target,
const char **  canontarget 
)
static

§ rpmSetMachine()

static void rpmSetMachine ( const char *  arch,
const char *  os 
)
static

§ rpmSetTables()

static void rpmSetTables ( int  archTable,
int  osTable 
)
static
Deprecated:
Use addMacro to set target* macros.
Todo:
Eliminate in rpm-5.1. #
Note
Only used by build code.
Parameters
archTable
osTable

Definition at line 817 of file rpmrc.c.

References ARCH, currTables, defaultMachine(), OS, and rebuildCompatTables().

Referenced by rpmRebuildTargetVars().

§ rpmShowRC()

int rpmShowRC ( FILE *  fp)

§ setDefaults()

static void setDefaults ( void  )
static

Definition at line 320 of file rpmrc.c.

References addMacro(), addMacroDefault(), RMIL_DEFAULT, setPathDefault(), USRPREFIX, and VARPREFIX.

Referenced by rpmReadRC().

§ setPathDefault()

static void setPathDefault ( const char *  macroname,
const char *  subdir 
)
static

Definition at line 281 of file rpmrc.c.

References _TOPDIRMACRO, addMacro(), alloca(), and RMIL_DEFAULT.

Referenced by setDefaults().

Variable Documentation

§ ___build_pre

const char* ___build_pre
static
Initial value:
= "\n\
RPM_SOURCE_DIR=\"%{_sourcedir}\"\n\
RPM_BUILD_DIR=\"%{_builddir}\"\n\
RPM_OPT_FLAGS=\"%{optflags}\"\n\
RPM_ARCH=\"%{_arch}\"\n\
RPM_OS=\"%{_os}\"\n\
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\n\
RPM_DOC_DIR=\"%{_docdir}\"\n\
export RPM_DOC_DIR\n\
RPM_PACKAGE_NAME=\"%{name}\"\n\
RPM_PACKAGE_VERSION=\"%{version}\"\n\
RPM_PACKAGE_RELEASE=\"%{release}\"\n\
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\n\
%{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\n\
export RPM_BUILD_ROOT\n}\
"

Definition at line 296 of file rpmrc.c.

§ configTarget

const char* configTarget = NULL
static

Definition at line 38 of file rpmrc.c.

Referenced by defaultMachine(), and rpmReadConfigFiles().

§ cpuinfoP

rpmds cpuinfoP

Definition at line 857 of file depends.c.

Referenced by rpmnsClean(), rpmPlatform(), rpmShowRC(), and unsatisfiedDepend().

§ current

cptr_t current[2]
static

Definition at line 128 of file rpmrc.c.

Referenced by getMachineInfo(), rpmFreeRpmrc(), rpmSetMachine(), and rpmShowRC().

§ currTables

int currTables[2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH }
static

Definition at line 131 of file rpmrc.c.

Referenced by getMachineInfo(), rebuildCompatTables(), rpmSetMachine(), and rpmSetTables().

§ defaultsInitialized

int defaultsInitialized = 0
static

Definition at line 134 of file rpmrc.c.

Referenced by rpmFreeRpmrc(), and rpmReadRC().

§ nplatpat

int nplatpat = 0

§ platform

const char* platform = SYSCONFIGDIR "/platform"
static

Definition at line 41 of file rpmrc.c.

Referenced by archScore(), defaultMachine(), parseSpec(), platformScore(), and rpmtsAddInstallElement().

§ platpat

void* platpat = NULL

§ tables

struct tableType_s tables[4]
static
Initial value:
= {
{ "arch", 1, 0 },
{ "os", 1, 0 },
{ "buildarch", 0, 1 },
{ "buildos", 0, 1 }
}

Definition at line 116 of file rpmrc.c.