rpm  5.4.10
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
rpmal.c File Reference
#include "system.h"
#include <rpmio.h>
#include <rpmiotypes.h>
#include <rpmbf.h>
#include <rpmtag.h>
#include <rpmtypes.h>
#include <rpmds.h>
#include <rpmal.h>
#include "debug.h"
Include dependency graph for rpmal.c:

Go to the source code of this file.

Data Structures

struct  availablePackage_s
 Info about a single package to be installed. More...
struct  availableIndexEntry_s
 A single available item (e.g. More...
struct  availableIndex_s
 Index of all available items. More...
struct  rpmal_s
 Set of available packages, items, and directories. More...

Macros

#define _RPMDS_INTERNAL

Typedefs

typedef struct availablePackage_savailablePackage
typedef struct
availableIndexEntry_s
availableIndexEntry
typedef struct availableIndex_savailableIndex

Enumerations

enum  indexEntryType_e { IET_PROVIDES = 1 }

Functions

static alNum alKey2Num (const rpmal al, alKey pkgKey)
static alKey alNum2Key (const rpmal al, alNum pkgNum)
static void rpmalFreeIndex (rpmal al)
 Destroy available item index.
static void rpmalFini (void *_al)
static rpmal rpmalGetPool (rpmioPool pool)
rpmal rpmalNew (int delta)
 Initialize available list.
void rpmalDel (rpmal al, alKey pkgKey)
 Delete package from available list.
alKey rpmalAdd (rpmal *alistp, alKey pkgKey, fnpyKey key, rpmds provides, rpmfi fi, rpmuint32_t tscolor)
 Add package to available list.
static int indexcmp (const void *one, const void *two)
 Compare two available index entries by name (qsort/bsearch).
void rpmalAddProvides (rpmal al, alKey pkgKey, rpmds provides, rpmuint32_t tscolor)
 Add package provides to available list index.
void rpmalMakeIndex (rpmal al)
 Generate index for available list.
fnpyKeyrpmalAllFileSatisfiesDepend (const rpmal al, const rpmds ds, alKey *keyp)
 Check added package file lists for package(s) that provide a file.
fnpyKeyrpmalAllSatisfiesDepend (const rpmal al, const rpmds ds, alKey *keyp)
 Check added package file lists for package(s) that have a provide.
fnpyKey rpmalSatisfiesDepend (const rpmal al, const rpmds ds, alKey *keyp)
 Check added package file lists for first package that has a provide.

Variables

int _rpmal_debug = 0
rpmioPool _rpmalPool

Detailed Description

Definition in file rpmal.c.

Macro Definition Documentation

#define _RPMDS_INTERNAL

Definition at line 14 of file rpmal.c.

Typedef Documentation

Definition at line 69 of file rpmal.c.

Definition at line 49 of file rpmal.c.

Definition at line 20 of file rpmal.c.

Enumeration Type Documentation

Enumerator:
IET_PROVIDES 

A Provides: dependency.

Definition at line 52 of file rpmal.c.

Function Documentation

static alNum alKey2Num ( const rpmal  al,
alKey  pkgKey 
)
inlinestatic

Definition at line 102 of file rpmal.c.

Referenced by rpmalAdd(), rpmalAddProvides(), rpmalAllSatisfiesDepend(), and rpmalDel().

static alKey alNum2Key ( const rpmal  al,
alNum  pkgNum 
)
inlinestatic

Definition at line 114 of file rpmal.c.

Referenced by rpmalAllFileSatisfiesDepend(), and rpmalMakeIndex().

static int indexcmp ( const void *  one,
const void *  two 
)
static

Compare two available index entries by name (qsort/bsearch).

Parameters
one1st available index entry
two2nd available index entry
Returns
result of comparison

Definition at line 261 of file rpmal.c.

References availableIndexEntry_s::entry, and availableIndexEntry_s::entryLen.

Referenced by rpmalAllSatisfiesDepend(), and rpmalMakeIndex().

alKey rpmalAdd ( rpmal alistp,
alKey  pkgKey,
fnpyKey  key,
rpmds  provides,
rpmfi  fi,
rpmuint32_t  tscolor 
)

Add package to available list.

Parameters
alistpaddress of available list
pkgKeypackage key, RPMAL_NOMATCH to force an append
keyassociated file name/python object
providesprovides dependency set
fifile info set
tscolortransaction color bits
Returns
available package index

Definition at line 213 of file rpmal.c.

References alKey2Num(), rpmal_s::alloced, availablePackage_s::bf, rpmal_s::delta, availablePackage_s::key, rpmal_s::list, availablePackage_s::provides, RPMAL_NOMATCH, rpmalDel(), rpmalFreeIndex(), rpmalNew(), rpmdsLink(), rpmfiFNBF(), rpmal_s::size, availablePackage_s::tscolor, and xrealloc.

Referenced by rpmal_Add(), and rpmtsAddInstallElement().

void rpmalAddProvides ( rpmal  al,
alKey  pkgKey,
rpmds  provides,
rpmuint32_t  tscolor 
)

Add package provides to available list index.

Parameters
alavailable list
pkgKeypackage key
providesadded package provides
tscolortransaction color bits

Definition at line 277 of file rpmal.c.

References alKey2Num(), availableIndexEntry_s::entry, availableIndexEntry_s::entryIx, availableIndexEntry_s::entryLen, IET_PROVIDES, availableIndex_s::index, rpmal_s::index, availableIndex_s::k, availableIndexEntry_s::pkgKey, rpmdsColor(), rpmdsInit(), rpmdsIx(), rpmdsNext(), availableIndex_s::size, rpmal_s::size, and availableIndexEntry_s::type.

Referenced by rpmal_AddProvides(), and rpmalMakeIndex().

fnpyKey* rpmalAllFileSatisfiesDepend ( const rpmal  al,
const rpmds  ds,
alKey keyp 
)

Check added package file lists for package(s) that provide a file.

Parameters
alavailable list
dsdependency set
Return values
keypadded package key pointer (or NULL)
Returns
associated package key(s), NULL if none

Definition at line 350 of file rpmal.c.

References _, alNum2Key(), availablePackage_s::bf, availablePackage_s::key, rpmal_s::list, RPMAL_NOMATCH, rpmdsN(), rpmdsNotify(), rpmal_s::size, and xrealloc.

Referenced by rpmalAllSatisfiesDepend().

fnpyKey* rpmalAllSatisfiesDepend ( const rpmal  al,
const rpmds  ds,
alKey keyp 
)

Check added package file lists for package(s) that have a provide.

Parameters
alavailable list
dsdependency set
Return values
keypadded package key pointer (or NULL)
Returns
associated package key(s), NULL if none

Definition at line 391 of file rpmal.c.

References _, _free(), alKey2Num(), alloca(), availableIndexEntry_s::entry, availableIndexEntry_s::entryIx, availableIndexEntry_s::entryLen, IET_PROVIDES, availableIndex_s::index, rpmal_s::index, indexcmp(), availablePackage_s::key, rpmal_s::list, availableIndexEntry_s::pkgKey, availablePackage_s::provides, RPMAL_NOMATCH, rpmalAllFileSatisfiesDepend(), rpmdsCompare(), rpmdsN(), rpmdsNext(), rpmdsNotify(), rpmdsSetIx(), availableIndex_s::size, availableIndexEntry_s::type, and xrealloc.

Referenced by checkPackageDeps(), rpmalSatisfiesDepend(), and rpmtsAvailable().

void rpmalDel ( rpmal  al,
alKey  pkgKey 
)

Delete package from available list.

Parameters
alavailable list
pkgKeypackage key

Definition at line 194 of file rpmal.c.

References alKey2Num(), availablePackage_s::bf, rpmal_s::list, availablePackage_s::provides, and rpmdsFree().

Referenced by rpmal_Del(), and rpmalAdd().

static void rpmalFini ( void *  _al)
static
static void rpmalFreeIndex ( rpmal  al)
static

Destroy available item index.

Parameters
alavailable list

Definition at line 130 of file rpmal.c.

References _free(), availableIndex_s::index, rpmal_s::index, and availableIndex_s::size.

Referenced by rpmalAdd(), and rpmalFini().

static rpmal rpmalGetPool ( rpmioPool  pool)
static

Definition at line 162 of file rpmal.c.

References rpmal_s::_item, _rpmal_debug, _rpmalPool, rpmalFini(), rpmioGetPool(), and rpmioNewPool().

Referenced by rpmalNew().

void rpmalMakeIndex ( rpmal  al)
rpmal rpmalNew ( int  delta)

Initialize available list.

Parameters
deltano. of entries to add on each realloc
Returns
al new available list

Definition at line 178 of file rpmal.c.

References rpmal_s::alloced, rpmal_s::delta, availableIndex_s::index, rpmal_s::index, rpmal_s::list, rpmalGetPool(), rpmalLink(), availableIndex_s::size, rpmal_s::size, and xcalloc().

Referenced by rpmalAdd().

fnpyKey rpmalSatisfiesDepend ( const rpmal  al,
const rpmds  ds,
alKey keyp 
)

Check added package file lists for first package that has a provide.

Todo:
Eliminate.
Parameters
alavailable list
dsdependency set
Return values
keypadded package key pointer (or NULL)
Returns
associated package key, NULL if none

Definition at line 480 of file rpmal.c.

References rpmalAllSatisfiesDepend().

Referenced by unsatisfiedDepend().

Variable Documentation

int _rpmal_debug = 0

Definition at line 31 of file rpmal.c.

Referenced by rpmalGetPool().

rpmioPool _rpmalPool

Definition at line 160 of file rpmal.c.

Referenced by rpmalGetPool().