AptCache

AptCache — Access to the package cache.

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <apt.h>

#define             APT_CACHE_ERROR
enum                AptCacheError;


                    AptCache;
AptCache *          apt_cache_new                       (const gchar *filename,
                                                         GError **error);
gint32              apt_cache_get_format_version        (AptCache *cache);
const gchar *       apt_cache_get_system_name           (AptCache *cache);
gboolean            apt_cache_is_up_to_date             (AptCache *cache);
AptCache *          apt_cache_ref                       (AptCache *cache);
void                apt_cache_unref                     (AptCache *cache);
gsize               apt_cache_n_packages                (AptCache *cache);
gsize               apt_cache_n_indexes                 (AptCache *cache);
AptPackage *        apt_cache_get_package               (AptCache *cache,
                                                         gsize id);
AptIndex *          apt_cache_get_index                 (AptCache *cache,
                                                         guint8 id);
AptPackageIter *    apt_cache_iterator                  (AptCache *cache);

enum                AptCacheFindFlags;
AptPackageIter *    apt_cache_find                      (AptCache *cache,
                                                         const gchar *name,
                                                         AptCacheFindFlags flags);

enum                AptSelectionState;
enum                AptCurrentState;
enum                AptPackageFlags;

enum                AptMultiArch;
const gchar *       apt_multi_arch_to_string            (AptMultiArch multi_arch);

enum                AptPriority;
const gchar *       apt_priority_to_string              (AptPriority priority);

                    AptPackage;
void                apt_package_unref                   (AptPackage *package);
AptPackage *        apt_package_ref                     (AptPackage *package);
guint32             apt_package_get_id                  (AptPackage *package);
const gchar *       apt_package_get_name                (AptPackage *package);
const gchar *       apt_package_get_version             (AptPackage *package);
const gchar *       apt_package_get_architecture        (AptPackage *package);
AptMultiArch        apt_package_get_multi_arch          (AptPackage *package);
goffset             apt_package_get_size                (AptPackage *package);
goffset             apt_package_get_installed_size      (AptPackage *package);
const gchar *       apt_package_get_checksum            (AptPackage *package);
AptPriority         apt_package_get_priority            (AptPackage *package);
const gchar *       apt_package_get_section             (AptPackage *package);
AptDependency *     apt_package_get_dependency          (AptPackage *package,
                                                         gsize index);
gsize               apt_package_n_dependencies          (AptPackage *package);
AptProvides *       apt_package_get_provides            (AptPackage *package,
                                                         gsize index);
gsize               apt_package_n_provides              (AptPackage *package);
const gchar *       apt_package_get_source_name         (AptPackage *package);
const gchar *       apt_package_get_source_version      (AptPackage *package);
AptCurrentState     apt_package_get_current_state       (AptPackage *package);
AptSelectionState   apt_package_get_selection_state     (AptPackage *package);
AptPackageFlags     apt_package_get_flags               (AptPackage *package);
AptDescriptionIter * apt_package_get_descriptions       (AptPackage *package);

                    AptPackageIter;
AptPackage *        apt_package_iter_next_value         (AptPackageIter *iter);
void                apt_package_iter_free               (AptPackageIter *iter);

                    AptProvides;
void                apt_provides_unref                  (AptProvides *provides);
AptProvides *       apt_provides_ref                    (AptProvides *provides);
const gchar *       apt_provides_get_name               (AptProvides *provides);
const gchar *       apt_provides_get_version            (AptProvides *provides);

                    AptDependency;
void                apt_dependency_unref                (AptDependency *dependency);
AptDependency *     apt_dependency_ref                  (AptDependency *dependency);
const gchar *       apt_dependency_get_name             (AptDependency *dependency);
const gchar *       apt_dependency_get_version          (AptDependency *dependency);
const gchar *       apt_dependency_get_architecture     (AptDependency *dependency);
AptComparisonType   apt_dependency_get_comparison       (AptDependency *dependency);
AptDependencyType   apt_dependency_get_type             (AptDependency *dependency);
gboolean            apt_dependency_get_next_is_or       (AptDependency *dependency);

enum                AptComparisonType;
const gchar *       apt_comparison_type_to_string       (AptComparisonType type);

enum                AptDependencyType;
const gchar *       apt_dependency_type_to_string       (AptDependencyType type);
gint                apt_dependency_type_rate            (AptDependencyType type);

                    AptIndex;
enum                AptIndexFlags;
void                apt_index_unref                     (AptIndex *index);
AptIndex *          apt_index_ref                       (AptIndex *index);
const gchar *       apt_index_get_archive               (AptIndex *index);
const gchar *       apt_index_get_base_uri              (AptIndex *index);
const gchar *       apt_index_get_codename              (AptIndex *index);
const gchar *       apt_index_get_component             (AptIndex *index);
const gchar *       apt_index_get_filename              (AptIndex *index);
AptIndexFlags       apt_index_get_flags                 (AptIndex *index);
const gchar *       apt_index_get_label                 (AptIndex *index);
time_t              apt_index_get_mtime                 (AptIndex *index);
const gchar *       apt_index_get_origin                (AptIndex *index);
const gchar *       apt_index_get_site                  (AptIndex *index);
const gchar *       apt_index_get_type                  (AptIndex *index);
const gchar *       apt_index_get_version               (AptIndex *index);
gboolean            apt_index_is_up_to_date             (AptIndex *index);

                    AptDescription;
AptDescription *    apt_description_ref                 (AptDescription *description);
void                apt_description_unref               (AptDescription *description);
const gchar *       apt_description_get_filename        (AptDescription *description);
const gchar *       apt_description_get_language        (AptDescription *description);
const gchar *       apt_description_get_md5             (AptDescription *description);
goffset             apt_description_get_offset          (AptDescription *description);
guint8              apt_description_get_index_id        (AptDescription *description);

                    AptDescriptionIter;
void                apt_description_iter_free           (AptDescriptionIter *iter);
AptDescription *    apt_description_iter_next_value     (AptDescriptionIter *iter);

Description

The cache provides access to all packages known to APT and information about them.

Details

APT_CACHE_ERROR

#define APT_CACHE_ERROR apt_cache_error_quark ()

The error domain of the APT cache.


enum AptCacheError

typedef enum {
    APT_CACHE_ERROR_CORRUPT,
    APT_CACHE_ERROR_UNSUPPORTED
} AptCacheError;

Possible errors.

APT_CACHE_ERROR_CORRUPT

The cache file is corrupt.

APT_CACHE_ERROR_UNSUPPORTED

The cache file is in an unsupported format and needs to be recreated from scratch.

AptCache

typedef struct {
} AptCache;

AptCache is an opaque data structure and can only be accessed using the following functions.


apt_cache_new ()

AptCache *          apt_cache_new                       (const gchar *filename,
                                                         GError **error);

Open the cache file at the given location.

Maps the file at the given location into memory and deserializes it. If an error occured while mapping the file, the function returns NULL and sets error. In such a case, errors are most likely from the AptCacheError or GFileError domains.

filename :

The path to the file containing the cache.

error :

return location for a GError, or NULL

Returns :

a newly allocated AptCache which must be unref'd with apt_cache_unref(), or NULL if an error occured.

apt_cache_get_format_version ()

gint32              apt_cache_get_format_version        (AptCache *cache);

Returns the format version of the cache.

This integer is increased every time the format changes in an incompatible way.

cache :

An AptCache instance

Returns :

The format version.

apt_cache_get_system_name ()

const gchar *       apt_cache_get_system_name           (AptCache *cache);

Gets the system name stored in the cache, such as 'deb'.

cache :

An AptCache instance.

Returns :

A pointer to the system name. TODO: No system name yet

apt_cache_is_up_to_date ()

gboolean            apt_cache_is_up_to_date             (AptCache *cache);

Checks whether cache is up to date.

cache :

An AptCache

Returns :

TRUE if cache is up to date, FALSE otherwise.

apt_cache_ref ()

AptCache *          apt_cache_ref                       (AptCache *cache);

Increments the reference count of cache by one. It is safe to call this function from any thread.

cache :

An AptCache instance

Returns :

The passed in AptCache.

apt_cache_unref ()

void                apt_cache_unref                     (AptCache *cache);

Decrements the reference count of cache by one. If the reference count drops to 0, the object is freed.

cache :

An AptCache instance

apt_cache_n_packages ()

gsize               apt_cache_n_packages                (AptCache *cache);

Returns the number of packages available in the cache.

cache :

An AptCache instance.

Returns :

The number of packages in cache.

apt_cache_n_indexes ()

gsize               apt_cache_n_indexes                 (AptCache *cache);

Returns the number of indexes available in the cache.

cache :

An AptCache instance.

Returns :

The number of indexes in cache.

apt_cache_get_package ()

AptPackage *        apt_cache_get_package               (AptCache *cache,
                                                         gsize id);

Gets a package from the cache based on its ID.

cache :

An AptCache instance.

id :

The numeric identifier of the package.

Returns :

A reference to an AptPackage object.

apt_cache_get_index ()

AptIndex *          apt_cache_get_index                 (AptCache *cache,
                                                         guint8 id);

Gets a package from the cache based on its ID.

cache :

An AptCache instance.

id :

The numeric identifier of the package.

Returns :

A reference to an AptPackage object.

apt_cache_iterator ()

AptPackageIter *    apt_cache_iterator                  (AptCache *cache);

Provides an iterator over all packages in the cache.

cache :

An AptCache

Returns :

a newly allocated AptPackageIter.

enum AptCacheFindFlags

typedef enum {
    APT_CACHE_FIND_BY_BINARY = 1 << 0,
    APT_CACHE_FIND_BY_SOURCE = 1 << 1,
    APT_CACHE_FIND_BY_PROVIDES = 1 << 2,
    APT_CACHE_FIND_BY_DEPENDS = 1 << 3,
    APT_CACHE_FIND_INSTALLED_ONLY = 1 << 4
} AptCacheFindFlags;

Enum values that can be passed to apt_cache_find() as its third argument. You may freely combine those values using OR.

APT_CACHE_FIND_BY_BINARY

Find packages based on their name.

APT_CACHE_FIND_BY_SOURCE

Find packages based on the name of their source.

APT_CACHE_FIND_BY_PROVIDES

Find packages based on what they provide.

APT_CACHE_FIND_BY_DEPENDS

Find packages based on what they depend on.

APT_CACHE_FIND_INSTALLED_ONLY

Only find installed packages.

apt_cache_find ()

AptPackageIter *    apt_cache_find                      (AptCache *cache,
                                                         const gchar *name,
                                                         AptCacheFindFlags flags);

Finds all packages with the given name by looking them up in the internal hashtable and returns an AptPackageIter.

cache :

An AptCache instance

name :

The name of the package to be found.

flags :

The AptCacheFindFlags determining what to query.

Returns :

An AptPackageIter of all matching packages or NULL if none.

enum AptSelectionState

typedef enum {
    APT_SELECTION_STATE_UNKNOWN,
    APT_SELECTION_STATE_INSTALL,
    APT_SELECTION_STATE_HOLD,
    APT_SELECTION_STATE_DEINSTALL,
    APT_SELECTION_STATE_PURGE
} AptSelectionState;

Enum values that describe the state the user wants the package to be in. They are taken directly from the manual page of dpkg. If the lower package manager has no notion of config files, it shall treat "purge" and "deinstall" identically.

APT_SELECTION_STATE_UNKNOWN

The state is not set.

APT_SELECTION_STATE_INSTALL

The package shall be installed.

APT_SELECTION_STATE_HOLD

The package shall not be modified.

APT_SELECTION_STATE_DEINSTALL

The package shall be deinstalled, excluding its configuration files.

APT_SELECTION_STATE_PURGE

The package shall be deleted, including its configuration files.

enum AptCurrentState

typedef enum {
    APT_CURRENT_STATE_NOT_INSTALLED,
    APT_CURRENT_STATE_CONFIG_FILES,
    APT_CURRENT_STATE_HALF_INSTALLED,
    APT_CURRENT_STATE_UNPACKED,
    APT_CURRENT_STATE_HALF_CONFIGURED,
    APT_CURRENT_STATE_TRIGGERS_AWAITED,
    APT_CURRENT_STATE_TRIGGERS_PENDING,
    APT_CURRENT_STATE_INSTALLED
} AptCurrentState;

Enum values that describe the current state of the package. The values have been derived from the manual page of dpkg.

APT_CURRENT_STATE_NOT_INSTALLED

The package is not installed.

APT_CURRENT_STATE_CONFIG_FILES

Only configuration files exist.

APT_CURRENT_STATE_HALF_INSTALLED

Installation has started.

APT_CURRENT_STATE_UNPACKED

The files of the package are unpacked.

APT_CURRENT_STATE_HALF_CONFIGURED

Not totally configured.

APT_CURRENT_STATE_TRIGGERS_AWAITED

The package awaits triggers.

APT_CURRENT_STATE_TRIGGERS_PENDING

The package has been triggered.

APT_CURRENT_STATE_INSTALLED

The package is completely installed.

enum AptPackageFlags

typedef enum {
    APT_PACKAGE_REINST_REQUIRED = 1 << 0,
    APT_PACKAGE_AUTO = 1 << 1
} AptPackageFlags;

Some flags which may be attached to a package.

APT_PACKAGE_REINST_REQUIRED

The package is broken and must be reinstalled.

APT_PACKAGE_AUTO

The package is automatically installed.

enum AptMultiArch

typedef enum {
    APT_MULTI_ARCH_NONE,
    APT_MULTI_ARCH_SAME,
    APT_MULTI_ARCH_FOREIGN,
    APT_MULTI_ARCH_ALLOWED
} AptMultiArch;

Enum values that determine how a package may engage in multi-architecture dependency situations.

APT_MULTI_ARCH_NONE

The package may only be installed for one architecture and may only satisfy dependencies of packages of the same architecture.

APT_MULTI_ARCH_SAME

Similar to APT_MULTI_ARCH_NONE, but it allows the package to be installed for multiple architectures at the same time.

APT_MULTI_ARCH_FOREIGN

The package is not co-installable with itself, but can satisfy the dependencies of packages from a different architecture.

APT_MULTI_ARCH_ALLOWED

Similar to APT_MULTI_ARCH_SAME, but it satisfies dependencies of packages from any architecture, as long as the dependency allows this (by setting the architecture to "any").

apt_multi_arch_to_string ()

const gchar *       apt_multi_arch_to_string            (AptMultiArch multi_arch);

Converts the AptMultiArch value multi_arch to a string as defined in Debian's Multi-Arch field.

multi_arch :

An AptMultiArch value

Returns :

A constant string describing multi_arch which consists only of the lowercase letters a-z.

enum AptPriority

typedef enum {
    APT_PRIORITY_UNKNOWN,
    APT_PRIORITY_REQUIRED,
    APT_PRIORITY_IMPORTANT,
    APT_PRIORITY_STANDARD,
    APT_PRIORITY_OPTIONAL,
    APT_PRIORITY_EXTRA
} AptPriority;

Enum values that describe the priority of the package.

APT_PRIORITY_UNKNOWN

The priority of the package is unknown, such a value is normally invalid.

APT_PRIORITY_REQUIRED

The package is required for a working base system.

APT_PRIORITY_IMPORTANT

The package should be installed on the system.

APT_PRIORITY_STANDARD

The package has standard priority.

APT_PRIORITY_OPTIONAL

The package is optional.

APT_PRIORITY_EXTRA

The package is extra; that is, users only want to install it in special circumstances.

apt_priority_to_string ()

const gchar *       apt_priority_to_string              (AptPriority priority);

Converts the AptPriority priority to a string describing the priority.

priority :

An AptPriority

Returns :

A constant string describing the priority which consists only of the lowercase letters a-z.

AptPackage

typedef struct _AptPackage AptPackage;

An opaque data structure representing a package in the cache.


apt_package_unref ()

void                apt_package_unref                   (AptPackage *package);

Decreases the reference count of package by one. If the reference count reaches 0, free the memory used by package.

package :

An AptPackage

apt_package_ref ()

AptPackage *        apt_package_ref                     (AptPackage *package);

Increases the reference count of package by one.

package :

An AptPackage

apt_package_get_id ()

guint32             apt_package_get_id                  (AptPackage *package);

Gets the unique numeric identifier of the package in the cache.

package :

An AptPackage

Returns :

An unsigned 32-bit identifier.

apt_package_get_name ()

const gchar *       apt_package_get_name                (AptPackage *package);

Gets the name of the package.

package :

An AptPackage

Returns :

An UTF-8 encoded string with the name of the package.

apt_package_get_version ()

const gchar *       apt_package_get_version             (AptPackage *package);

Retrieve the version of this package as an UTF-8 encoded string.

package :

An AptPackage

Returns :

A constant, utf-8 encoded string.

apt_package_get_architecture ()

const gchar *       apt_package_get_architecture        (AptPackage *package);

Retrieve the name of the architecture this package is built for.

package :

An AptPackage

Returns :

A constant, utf-8 encoded string.

apt_package_get_multi_arch ()

AptMultiArch        apt_package_get_multi_arch          (AptPackage *package);

Gets information about how the package behaves in systems with packages from mixed architectures; that is, multi-arch environments.

package :

An AptPackage

Returns :

An AptMultiArch value determining the multi-arch state of the package.

apt_package_get_size ()

goffset             apt_package_get_size                (AptPackage *package);

Gets the size of the index in bytes.

package :

An AptPackage

Returns :

The size of the file in bytes.

apt_package_get_installed_size ()

goffset             apt_package_get_installed_size      (AptPackage *package);

Gets the estimated size of the package when unpacked in bytes; since the value is internally stored as KiB, this value may differ from reality by up to 1023 byte.

package :

An AptPackage

Returns :

The size of the unpacked package in bytes.

apt_package_get_checksum ()

const gchar *       apt_package_get_checksum            (AptPackage *package);

Gets the checksum of the package, if one is stored in the cache, or NULL if no checksum is stored. The checksum may either be MD5, SHA1, or SHA256; the type of the checksum is determined by looking at the length of the string.

package :

An AptPackage

Returns :

A constant UTF-8 encoded string containing the checksum's hexadecimal representation; or NULL if the checksum is unknown.

apt_package_get_priority ()

AptPriority         apt_package_get_priority            (AptPackage *package);

Gets the priority of the package. If no correct package priority is set, the return value will be APT_PRIORITY_UNKNOWN. To convert the result to a string, use the function apt_priority_to_string().

package :

An AptPackage

Returns :

An AptPriority describing the package's priority.

apt_package_get_section ()

const gchar *       apt_package_get_section             (AptPackage *package);

Gets the section of the package if one is stored in the cache, or NULL if none is stored. Some package management solutions may have no notion of sections and may thus always cause this function to return NULL.

package :

An AptPackage

Returns :

A constant UTF-8 encoded string containing the package's section; or NULL if the package has no section.

apt_package_get_dependency ()

AptDependency *     apt_package_get_dependency          (AptPackage *package,
                                                         gsize index);

Gets the requested dependency of the package. It is an error to call this function with a value for index that is larger than the number returned by apt_package_n_dependencies().

package :

An AptPackage

index :

The index of the dependency.

Returns :

An AptDependency.

apt_package_n_dependencies ()

gsize               apt_package_n_dependencies          (AptPackage *package);

Gets the number of dependencies this package has.

package :

An AptPackage

Returns :

The number of dependencies package has.

apt_package_get_provides ()

AptProvides *       apt_package_get_provides            (AptPackage *package,
                                                         gsize index);

Gets the requested provides of the package. It is an error to call this function with a value for index that is larger than the number returned by apt_package_n_provides().

package :

An AptPackage

index :

The index of the provides.

Returns :

An AptProvides.

apt_package_n_provides ()

gsize               apt_package_n_provides              (AptPackage *package);

Gets the number of virtual packages provided by package.

package :

An AptPackage

Returns :

The number of virtual packages provided by package.

apt_package_get_source_name ()

const gchar *       apt_package_get_source_name         (AptPackage *package);

Gets the name of the source package this package is built from.

package :

An AptPackage

Returns :

The name of the source package.

apt_package_get_source_version ()

const gchar *       apt_package_get_source_version      (AptPackage *package);

Gets the version of the source package this package is built from.

package :

An AptPackage

Returns :

The version of the source package.

apt_package_get_current_state ()

AptCurrentState     apt_package_get_current_state       (AptPackage *package);

Gets the package state.

package :

An AptPackage

apt_package_get_selection_state ()

AptSelectionState   apt_package_get_selection_state     (AptPackage *package);

apt_package_get_flags ()

AptPackageFlags     apt_package_get_flags               (AptPackage *package);

Gets the flags as stored in package.

package :

An AptPackage

apt_package_get_descriptions ()

AptDescriptionIter * apt_package_get_descriptions       (AptPackage *package);

Finds the descriptions associated with the given package.

package :

The package for which the descriptions should be looked up.

Returns :

An iterator over AptDescription objects.

AptPackageIter

typedef struct _AptPackageIter AptPackageIter;

An opaque data structure representing an iterator over AptPackage instances.


apt_package_iter_next_value ()

AptPackage *        apt_package_iter_next_value         (AptPackageIter *iter);

Gets the next package in the iterator or NULL if there are no further packages. The return value of this function must be unref'd by the user when no longer needed.

iter :

An AptPackageIter

Returns :

The next package in the iterator or NULL if the end of the iteration is reached.

apt_package_iter_free ()

void                apt_package_iter_free               (AptPackageIter *iter);

Free the package iterator iter.

iter :

An AptPackageIter

AptProvides

typedef struct _AptProvides AptProvides;

An opaque data structure representing a virtual package.


apt_provides_unref ()

void                apt_provides_unref                  (AptProvides *provides);

Decreases the reference count of provides by one. If the reference count drops to 0, the memory allocated by provides is freed.

provides :

An AptProvides

apt_provides_ref ()

AptProvides *       apt_provides_ref                    (AptProvides *provides);

Increases the reference count of provides by one.

provides :

An AptProvides

Returns :

provides

apt_provides_get_name ()

const gchar *       apt_provides_get_name               (AptProvides *provides);

Gets the name of the virtual package provided by provides.

provides :

An AptProvides

Returns :

A constant UTF-8 encoded string containing the name.

apt_provides_get_version ()

const gchar *       apt_provides_get_version            (AptProvides *provides);

Gets the version of the virtual package provided by provides, if it provides a version; or NULL if the virtual package is not versioned.

provides :

An AptProvides

Returns :

A constant UTF-8 encoded string containing the version, or NULL if the virtual package has no version.

AptDependency

typedef struct _AptDependency AptDependency;

An opaque data structure representing a dependency in the cache.


apt_dependency_unref ()

void                apt_dependency_unref                (AptDependency *dependency);

Decreases the reference count of dependency by one.

dependency :

An AptDependency.

apt_dependency_ref ()

AptDependency *     apt_dependency_ref                  (AptDependency *dependency);

Increases the reference count of dependency by one.

dependency :

An AptDependency.

Returns :

A new reference to dependency.

apt_dependency_get_name ()

const gchar *       apt_dependency_get_name             (AptDependency *dependency);

Gets the name of the dependency's target package.

dependency :

An AptDependency

Returns :

A constant UTF-8 encoded string.

apt_dependency_get_version ()

const gchar *       apt_dependency_get_version          (AptDependency *dependency);

Gets the version of the dependency's target if there is one. If the dependency is not limited to a version, this function returns NULL.

dependency :

An AptDependency

Returns :

The target version or NULL if all versions are satisfying.

apt_dependency_get_architecture ()

const gchar *       apt_dependency_get_architecture     (AptDependency *dependency);

Get the target architecture. If the return value is NULL, it means that the dependency can be satisfied only by architecture-independent packages or by packages for the same architecture or by packages with APT_MULTI_ARCH_FOREIGN. If the return value is "any", the dependency may be satisfied by packages with APT_MULTI_ARCH_ALLOWED. In other cases, the behavior is undefined; but should result in the dependency not being resolved at all.

dependency :

An AptDependency

Returns :

NULL or "any".

apt_dependency_get_comparison ()

AptComparisonType   apt_dependency_get_comparison       (AptDependency *dependency);

Gets the type of comparison this dependency requires. For example, if the dependency were "a (>= 1.0)", the return value would be the AptComparisonType equivalent of >=; that is APT_COMPARISON_GE.

dependency :

An AptDependency.

Returns :

An AptComparisonType describing the comparison operator.

apt_dependency_get_type ()

AptDependencyType   apt_dependency_get_type             (AptDependency *dependency);

Gets the type of dependency as an AptDependencyType value.

dependency :

An AptDependency.

Returns :

An AptDependencyType describing the type of dependency.

apt_dependency_get_next_is_or ()

gboolean            apt_dependency_get_next_is_or       (AptDependency *dependency);

Determines whether the next dependency is ORed to this one. For example, in a dependency group 'a | b', this function returns TRUE for the AptDependency corresponding to 'a' and FALSE for the AptDependency corresponding to 'b'.

dependency :

An AptDependency.

Returns :

TRUE if the next dependency is ORed to the current one, FALSE otherwise.

enum AptComparisonType

typedef enum AptComparisonType {
    APT_COMPARISON_NONE,
    APT_COMPARISON_LT,
    APT_COMPARISON_LE,
    APT_COMPARISON_EQ,
    APT_COMPARISON_NE,
    APT_COMPARISON_GE,
    APT_COMPARISON_GT
} AptComparisonType;

Enum values to specify comparison operators. The names are derived from the comparison operators in Perl and are abbreviations.

APT_COMPARISON_NONE

There is no comparison at all.

APT_COMPARISON_LT

Less (<).

APT_COMPARISON_LE

Less or equal (<=).

APT_COMPARISON_EQ

Equal (= or ==).

APT_COMPARISON_NE

Not equal (!=).

APT_COMPARISON_GE

Greater or equal (>=)

APT_COMPARISON_GT

Greater (>)

apt_comparison_type_to_string ()

const gchar *       apt_comparison_type_to_string       (AptComparisonType type);

Converts the given comparison type to the operator used in Debian indexes. If type is APT_COMPARISON_NONE, an empty string is returned.

type :

The type that shall be converted to a string

Returns :

A pointer to a constant string of 0 - 2 characters.

enum AptDependencyType

typedef enum AptDependencyType {
    APT_DEPENDENCY_INVALID,
    APT_DEPENDENCY_PREDEPENDS,
    APT_DEPENDENCY_DEPENDS,
    APT_DEPENDENCY_RECOMMENDS,
    APT_DEPENDENCY_SUGGESTS,
    APT_DEPENDENCY_ENHANCES,
    APT_DEPENDENCY_CONFLICTS,
    APT_DEPENDENCY_BREAKS,
    APT_DEPENDENCY_REPLACES
} AptDependencyType;

Enumeration which defines all types of dependencies (positive and negative) understood by APT2. The names come from Debian package management, but the underlying concept is also understood by RPM systems.

APT_DEPENDENCY_INVALID

The dependency is invalid. If you see this somewhere, it is a bug.

APT_DEPENDENCY_PREDEPENDS

The dependency must be completely installed before the package can be installed

APT_DEPENDENCY_DEPENDS

The dependency must be unpacked.

APT_DEPENDENCY_RECOMMENDS

Like the previous one, but only installed if available (it should be installed).

APT_DEPENDENCY_SUGGESTS

The dependency may be useful for certain cases, but is normally not needed.

APT_DEPENDENCY_ENHANCES

The dependency is enhanced by this package, think of it as a reverse suggestion.

APT_DEPENDENCY_CONFLICTS

The both packages may not be installed at the same time.

APT_DEPENDENCY_BREAKS

This package breaks the dependency; for example, by removing a file the dependency needs.

APT_DEPENDENCY_REPLACES

The package may replace files installed by the dependency.

apt_dependency_type_to_string ()

const gchar *       apt_dependency_type_to_string       (AptDependencyType type);

Converts type to a human-readable string that is the name of the Debian dependency type which equals type.

type :

An AptDependencyType

Returns :

A constant string describing type.

apt_dependency_type_rate ()

gint                apt_dependency_type_rate            (AptDependencyType type);

Rates the given dependency type, determining whether the dependency will cause the installation of a package (positive) or whether it prevents a package from being installed.

type :

An AptDependencyType

Returns :

<0 if the dependency is negative, 0 if the dependency does not have any effect in itself. >0 if the dependency is positive.

AptIndex

typedef struct _AptIndex AptIndex;

An opaque data structure representing indexes.


enum AptIndexFlags

typedef enum {
    APT_INDEX_NOT_SOURCE = 1 << 0,
    APT_INDEX_NOT_AUTOMATIC = 1 << 1,
    APT_INDEX_IS_TRUSTED = 1 << 2
} AptIndexFlags;

Various flags that can be set on an AptIndex.

APT_INDEX_NOT_SOURCE

Packages from this index can not be retrieved. This mainly applies to package manager databases, such as dpkg's /var/lib/dpkg/status.

APT_INDEX_NOT_AUTOMATIC

Packages from this file shall not be upgraded automatically.

APT_INDEX_IS_TRUSTED

The index is considered to be trusted. For Debian, this means that the Release file of the distribution this index belongs to is signed.

apt_index_unref ()

void                apt_index_unref                     (AptIndex *index);

Decrease the reference count of index by one. If the reference count drops to zero, free the object.

index :

An AptIndex

apt_index_ref ()

AptIndex *          apt_index_ref                       (AptIndex *index);

Increase the reference count of index by one.

index :

An AptIndex

Returns :

index

apt_index_get_archive ()

const gchar *       apt_index_get_archive               (AptIndex *index);

Gets the archive of the index. For Debian-based systems, this is equal to the "Suite" field stored in Release files. If no archive is defined, the function returns NULL.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_base_uri ()

const gchar *       apt_index_get_base_uri              (AptIndex *index);

Gets the base URI of the archive. Appending the filename of a package from this index to this URI will produce the URI at which the package is located. If the index refers to a file which can not act as a source for packages, such as dpkg's /var/lib/dpkg/status, this function returns NULL.

index :

An AptIndex

Returns :

UTF-8 encoded URI string or NULL if there is no base URI.

apt_index_get_codename ()

const gchar *       apt_index_get_codename              (AptIndex *index);

Gets the codename of the index. For Debian-based systems, this is equal to the "Codename" field stored in Release files. If no codename is defined, the function returns NULL.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_component ()

const gchar *       apt_index_get_component             (AptIndex *index);

Gets the component of the index. The component can be used to separate certain parts of an archive and equals the fourth field (and following ones) in sources.list files. For Debian, this is mostly "main", "contrib" or "non-free". Components are optional, and as such, the function may return NULL if no component is set.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_filename ()

const gchar *       apt_index_get_filename              (AptIndex *index);

Gets the file name of the index; that is, the path to the local copy of the index file in the Dir::State::lists directory.

index :

An AptIndex

Returns :

UTF-8 encoded string with the absolute path to the file.

apt_index_get_flags ()

AptIndexFlags       apt_index_get_flags                 (AptIndex *index);

Gets the flags associated with this index as combination of AptIndexFlags values. See the description of AptIndexFlags for information on the meanings of the flags.

index :

An AptIndex

Returns :

The flags associated with this file as AptIndexFlags.

apt_index_get_label ()

const gchar *       apt_index_get_label                 (AptIndex *index);

Gets the label of the index. The label should be a short string describing the repository. It is optional and if not existent, the function returns NULL.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_mtime ()

time_t              apt_index_get_mtime                 (AptIndex *index);

Gets the last time this index was modified before it was added to the cache. If this value is older than the modification time of the file in the file system, the cache should be considered outdated.

index :

An AptIndex

Returns :

The last time of modification as time_t.

apt_index_get_origin ()

const gchar *       apt_index_get_origin                (AptIndex *index);

Gets the origin of the index. The origin is a short string describing the origin of the packages in this repository. For Debian-based systems, this is extracted from the "Origin" field in the Release file. Examples here are "Debian" for official Debian packages and "Ubuntu" for official Ubuntu packages. Specifying an origin is not required, if there is no origin, the function returns NULL.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_site ()

const gchar *       apt_index_get_site                  (AptIndex *index);

Gets the site associated with the index, if it was fetched via network from a server, or NULL if the index belongs to a local repository.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_get_type ()

const gchar *       apt_index_get_type                  (AptIndex *index);

Gets the type of the index. This should be a human-readable string describing the type of the index file. This function is considered unstable and may be changed to return a enumeration value in a future update. Do not use it.

index :

An AptIndex

Returns :

UTF-8 encoded human-readable string.

Stability Level: Unstable


apt_index_get_version ()

const gchar *       apt_index_get_version               (AptIndex *index);

Gets the version of the index. This should be the version of the distribution this indexes belongs to. For Debian-based systems, this field is retrieved from the 'Version' field in the Release file. This field is optional, and the function may thus return NULL if no version is set.

index :

An AptIndex

Returns :

UTF-8 encoded string or NULL.

apt_index_is_up_to_date ()

gboolean            apt_index_is_up_to_date             (AptIndex *index);

Checks whether index is up to date; that is, whether the file on the disk has not been modified since it was cached.

index :

An AptIndex

Returns :

TRUE if the file is up to date, FALSE otherwise.

AptDescription

typedef struct _AptDescription AptDescription;

An opaque data structure which may only be accessed using the following functions. Currently there is no way to create objects of this type, as this is still under heavy development.


apt_description_ref ()

AptDescription *    apt_description_ref                 (AptDescription *description);

Increments the reference count of description.

description :

An AptDescription

Returns :

description

apt_description_unref ()

void                apt_description_unref               (AptDescription *description);

Decrements the reference count of description. If the reference count drops to 0, the memory pointed to by description is freed.

description :

An AptDescription

apt_description_get_filename ()

const gchar *       apt_description_get_filename        (AptDescription *description);

Gets the name of the package archive (i.e. the deb/rpm/... file). In case this object is not related to a complete package record, but only to a translated description, the return value will be NULL.

description :

An AptDescription

Returns :

The filename of the package or NULL.

apt_description_get_language ()

const gchar *       apt_description_get_language        (AptDescription *description);

Gets the language of the description if it is a translated description, as an ISO 639 language code such as 'en' and optionally an ISO 3166 country code such as 'US'. In this example, the resulting language code would be 'en_US'. If the description is not translated, the function shall return NULL.

description :

An AptDescription

Returns :

The language code if translated or NULL if the description is not a translation.

apt_description_get_md5 ()

const gchar *       apt_description_get_md5             (AptDescription *description);

Gets the hexadecimal representation of the untranslated description's MD5 checksum. This value is used to locate the translations of the description.

description :

An AptDescription

Returns :

The hexadecimal representation of the MD5 checksum as a constant string.

apt_description_get_offset ()

goffset             apt_description_get_offset          (AptDescription *description);

Gets the offset of the package record in the index. While the return type of this value is a goffset, the offset is stored internally as an unsigned 32 bit integer; since it is not expected that package files reach sizes > 4 GB.

description :

An AptDescription

Returns :

The offset as a goffset.

apt_description_get_index_id ()

guint8              apt_description_get_index_id        (AptDescription *description);

Gets the ID of the index associated with this AptDescription. The return value may be passed to apt_cache_get_index() in order to receive a corresponding AptIndex.

description :

An AptDescription

AptDescriptionIter

typedef struct _AptDescriptionIter AptDescriptionIter;

An iterator over AptDescription objects. This is an opaque type.


apt_description_iter_free ()

void                apt_description_iter_free           (AptDescriptionIter *iter);

Free iter.

iter :

An AptDescriptionIter

apt_description_iter_next_value ()

AptDescription *    apt_description_iter_next_value     (AptDescriptionIter *iter);

Gets the next AptDescription in iter or NULL if there are no further descriptions.

iter :

An AptDescriptionIter

Returns :

The next AptDescription or NULL if there are no more ones.