Di_package

## Data Structures

struct | di_package
| Package. More...
struct | di_package_dependency
| Package dependency. More...
struct | di_package_version
| Package version. More...

## Enumerations

enum | di_package_priority { di_package_priority_extra = 1 , di_package_priority_optional , di_package_priority_standard , di_package_priority_important , di_package_priority_required }
enum | di_package_status { di_package_status_undefined = 0 , di_package_status_not_installed , di_package_status_unpacked , di_package_status_installed , di_package_status_half_configured , di_package_status_config_files }
enum | di_package_status_want { di_package_status_want_unknown = 0 , di_package_status_want_install , di_package_status_want_hold , di_package_status_want_deinstall , di_package_status_want_purge }
enum | di_package_type { di_package_type_non_existent = 0 , di_package_type_virtual_package , di_package_type_real_package }

enum

di_package_dependency_type {
di_package_dependency_type_replaces = 1 , di_package_dependency_type_provides , di_package_dependency_type_depends , di_package_dependency_type_pre_depends ,
di_package_dependency_type_recommends , di_package_dependency_type_suggests , di_package_dependency_type_conflicts , di_package_dependency_type_enhances ,
di_package_dependency_type_reverse_provides = 0x100 , di_package_dependency_type_reverse_enhances
}

## Functions

void | di_package_destroy (di_package *package)
static di_package * | di_package_alloc (di_packages_allocator *allocator)
static di_package_dependency * | di_package_dependency_alloc (di_packages_allocator *allocator)
void | di_package_version_free (di_package_version *version)
int | di_package_version_compare (const di_package_version *a, const di_package_version *b)
di_package_version * | di_package_version_parse (di_package *package)
int | di_package_array_text_from (const char *const *array, const char *text)
static di_package_priority | di_package_priority_text_from (const char *text)
static di_package_status_want | di_package_status_want_text_from (const char *text)
static di_package_status | di_package_status_text_from (const char *text)
static const char * | di_package_priority_text_to (const di_package_priority priority)
static const char * | di_package_status_want_text_to (const di_package_status_want status)
static const char * | di_package_status_text_to (const di_package_status status)
int | internal_di_package_array_text_from_rstring (const char *const *array, const di_rstring *text)
static di_package_priority | internal_di_package_priority_text_from_rstring (const di_rstring *text)
static di_package_status_want | internal_di_package_status_want_text_from_rstring (const di_rstring *text)
static di_package_status | internal_di_package_status_text_from_rstring (const di_rstring *text)

## Variables

const char *const | di_package_priority_text []
const char *const | di_package_status_want_text []
const char *const | di_package_status_text []
di_destroy_notify | internal_di_package_destroy_func

## Detailed Description

## Enumeration Type Documentation

## di_package_dependency_type

enum di_package_dependency_type

Type of dependency

Enumerator
di_package_dependency_type_replaces | Replaces field
di_package_dependency_type_provides | Provides field
di_package_dependency_type_depends | Depends field
di_package_dependency_type_pre_depends | Pre-Depends field
di_package_dependency_type_recommends | Recommends field
di_package_dependency_type_suggests | Suggests field
di_package_dependency_type_conflicts | Conflicts field
di_package_dependency_type_enhances | Enhances field
di_package_dependency_type_reverse_provides |
di_package_dependency_type_reverse_enhances |

{
di_package_dependency_type_replaces = 1,
di_package_dependency_type_provides,
di_package_dependency_type_depends,
di_package_dependency_type_pre_depends,
di_package_dependency_type_recommends,
di_package_dependency_type_suggests,
di_package_dependency_type_conflicts,
di_package_dependency_type_enhances,
di_package_dependency_type_reverse_provides = 0x100,
di_package_dependency_type_reverse_enhances,
};
di_package_dependency_type_pre_depends
@ di_package_dependency_type_pre_depends
Definition package.h:129
di_package_dependency_type_reverse_enhances
@ di_package_dependency_type_reverse_enhances
Definition package.h:135
di_package_dependency_type_replaces
@ di_package_dependency_type_replaces
Definition package.h:126
di_package_dependency_type_conflicts
@ di_package_dependency_type_conflicts
Definition package.h:132
di_package_dependency_type_provides
@ di_package_dependency_type_provides
Definition package.h:127
di_package_dependency_type_depends
@ di_package_dependency_type_depends
Definition package.h:128
di_package_dependency_type_enhances
@ di_package_dependency_type_enhances
Definition package.h:133
di_package_dependency_type_suggests
@ di_package_dependency_type_suggests
Definition package.h:131
di_package_dependency_type_recommends
@ di_package_dependency_type_recommends
Definition package.h:130
di_package_dependency_type_reverse_provides
@ di_package_dependency_type_reverse_provides
Definition package.h:134

## di_package_priority

enum di_package_priority

Priority field

{
di_package_priority_extra = 1,
di_package_priority_optional,
di_package_priority_standard,
di_package_priority_important,
di_package_priority_required,
};

## di_package_status

enum di_package_status

Status field, third part

{
di_package_status_undefined = 0,
di_package_status_not_installed,
di_package_status_unpacked,
di_package_status_installed,
di_package_status_half_configured,
di_package_status_config_files,
};

## di_package_status_want

enum di_package_status_want

Status field, first part

{
di_package_status_want_unknown = 0,
di_package_status_want_install,
di_package_status_want_hold,
di_package_status_want_deinstall,
di_package_status_want_purge,
};

## di_package_type

enum di_package_type

type of package

Enumerator
di_package_type_non_existent | Non existing package
di_package_type_virtual_package | Virtual package
di_package_type_real_package | Real package

{
di_package_type_non_existent = 0,
di_package_type_virtual_package,
di_package_type_real_package,
};
di_package_type_virtual_package
@ di_package_type_virtual_package
Definition package.h:88
di_package_type_real_package
@ di_package_type_real_package
Definition package.h:89
di_package_type_non_existent
@ di_package_type_non_existent
Definition package.h:87

## Function Documentation

## di_package_alloc()

static di_package * di_package_alloc | ( | di_packages_allocator * | allocator | ) |

inline static

{
return di_mem_chunk_alloc0 (allocator->package_mem_chunk);
}
di_mem_chunk_alloc0
void * di_mem_chunk_alloc0(di_mem_chunk *mem_chunk)
Definition mem_chunk.c:156
di_packages_allocator::package_mem_chunk
di_mem_chunk * package_mem_chunk
Definition packages.h:54

## di_package_array_text_from()

int di_package_array_text_from | ( | const char *const * | array,
|  | const char * | text
| ) |  |

{
const di_rstring temp = { (char *) text, strlen (text) };
return internal_di_package_array_text_from_rstring (array, &temp);
}
di_rstring
raw string
Definition string.h:38

## di_package_dependency_alloc()

static di_package_dependency * di_package_dependency_alloc | ( | di_packages_allocator * | allocator | ) |

inline static

{
return di_mem_chunk_alloc0 (allocator->package_dependency_mem_chunk);
}
di_packages_allocator::package_dependency_mem_chunk
di_mem_chunk * package_dependency_mem_chunk
Definition packages.h:55

## di_package_destroy()

void di_package_destroy | ( | di_package * | package | ) |

{
di_free (package->package);
di_free (package->section);
di_free (package->maintainer);
di_free (package->architecture);
di_free (package->version);
di_free (package->filename);
di_free (package->sha256);
di_free (package->short_description);
di_free (package->description);
memset (package, 0, sizeof (di_package));
}
di_free
void di_free(void *mem)
Definition mem.c:60
di_package
Package.
Definition package.h:96
di_package::maintainer
char * maintainer
Definition package.h:109
di_package::section
char * section
Definition package.h:107
di_package::version
char * version
Definition package.h:111
di_package::architecture
char * architecture
Definition package.h:110
di_package::description
char * description
Definition package.h:117
di_package::short_description
char * short_description
Definition package.h:116
di_package::sha256
char * sha256
Definition package.h:115
di_package::filename
char * filename
Definition package.h:113
di_package::package
char * package
Definition package.h:99

## di_package_priority_text_from()

static di_package_priority di_package_priority_text_from | ( | const char * | text | ) |

inline static

{
return di_package_array_text_from (di_package_priority_text, text);
}

## di_package_priority_text_to()

static const char * di_package_priority_text_to | ( | const di_package_priority | priority | ) |

inline static

{
return di_package_priority_text[priority];
}

## di_package_status_text_from()

static di_package_status di_package_status_text_from | ( | const char * | text | ) |

inline static

{
return di_package_array_text_from (di_package_status_text, text);
}

## di_package_status_text_to()

static const char * di_package_status_text_to | ( | const di_package_status | status | ) |

inline static

{
return di_package_status_text[status];
}

## di_package_status_want_text_from()

static di_package_status_want di_package_status_want_text_from | ( | const char * | text | ) |

inline static

{
return di_package_array_text_from (di_package_status_want_text, text);
}

## di_package_status_want_text_to()

static const char * di_package_status_want_text_to | ( | const di_package_status_want | status | ) |

inline static

{
return di_package_status_want_text[status];
}

## di_package_version_compare()

int di_package_version_compare | ( | const di_package_version * | a,
|  | const di_package_version * | b
| ) |  |

{
int r;
if (a->epoch > b->epoch)
return 1;
if (a->epoch < b->epoch)
return -1;
r = verrevcmp(a->upstream, b->upstream);
if (r != 0)
return r;
return verrevcmp(a->debian_revision, b->debian_revision);
}
di_package_version::upstream
char * upstream
Definition package.h:153
di_package_version::epoch
unsigned long epoch
Definition package.h:152
di_package_version::debian_revision
char * debian_revision
Definition package.h:154

## di_package_version_free()

void di_package_version_free | ( | di_package_version * | version | ) |

{
di_free (version);
}

## di_package_version_parse()

di_package_version * di_package_version_parse | ( | di_package * | package | ) |

{
di_package_version *version;
char *hyphen, *colon, *eepochcolon, *string;
const char *end;
unsigned long epoch;
if (!package->version)
return NULL;
version = di_new0 (di_package_version, 1);
string = package->version;
end = string + strlen (string);
colon = strchr (string, ':');
if (colon) {
epoch = strtoul (package->version, &eepochcolon, 10);
if (colon != eepochcolon)
return 0;
if (!*++colon)
return 0;
string = colon;
version->epoch = epoch;
}
hyphen = strrchr (string, '-');
if (hyphen)
{
version->upstream = di_stradup (string, hyphen - string);
version->debian_revision = di_stradup (hyphen + 1, end - hyphen - 1);
}
else
version->upstream = di_stradup (string, end - string);
return version;
}
di_new0
#define di_new0(struct_type, n_structs)
Definition mem.h:79
di_stradup
char * di_stradup(const char *s, size_t n)
Definition string.c:45
di_package_version
Package version.
Definition package.h:151

## internal_di_package_array_text_from_rstring()

int internal_di_package_array_text_from_rstring | ( | const char *const * | array,
|  | const di_rstring * | text
| ) |  |

{
int i;
for (i = 1; array[i]; i++)
if (strncmp (array[i], text->string, text->size) == 0)
{
return i;
}
return 0;
}
di_rstring::size
di_ksize_t size
Definition string.h:40
di_rstring::string
char * string
Definition string.h:39

## internal_di_package_priority_text_from_rstring()

static di_package_priority internal_di_package_priority_text_from_rstring | ( | const di_rstring * | text | ) |

inline static

{
return internal_di_package_array_text_from_rstring (di_package_priority_text, text);
}

## internal_di_package_status_text_from_rstring()

static di_package_status internal_di_package_status_text_from_rstring | ( | const di_rstring * | text | ) |

inline static

{
return internal_di_package_array_text_from_rstring (di_package_status_text, text);
}

## internal_di_package_status_want_text_from_rstring()

static di_package_status_want internal_di_package_status_want_text_from_rstring | ( | const di_rstring * | text | ) |

inline static

{
return internal_di_package_array_text_from_rstring (di_package_status_want_text, text);
}

## Variable Documentation

## di_package_priority_text

const char* const di_package_priority_text[]

extern

{
"unspecified",
"extra", /* == di_package_priority_extra */
"optional", /* == di_package_priority_optional */
"standard", /* == di_package_priority_standard */
"important", /* == di_package_priority_important */
"required", /* == di_package_priority_required */
NULL
};

## di_package_status_text

const char* const di_package_status_text[]

extern

{
"undefined", /* == di_package_status_undefined */
"not-installed", /* == di_package_status_not_installed */
"unpacked", /* == di_package_status_unpacked */
"installed", /* == di_package_status_installed */
"half-configured", /* == di_package_status_half_configured */
"config-files", /* == di_package_status_config_files */
NULL
};

## di_package_status_want_text

const char* const di_package_status_want_text[]

extern

{
"unknown", /* == di_package_status_want_unknown */
"install", /* == di_package_status_want_install */
"hold", /* == di_package_status_want_hold */
"deinstall", /* == di_package_status_want_deinstall */
"purge", /* == di_package_status_want_purge */
NULL
};

## internal_di_package_destroy_func

di_destroy_notify internal_di_package_destroy_func

Destroys a di_package struct

Referenced by di_packages_alloc().