summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r--lib/libalpm/alpm.h142
1 files changed, 80 insertions, 62 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 6df3e1f5..2e666294 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1,7 +1,7 @@
/*
* alpm.h
*
- * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
+ * Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -27,14 +27,12 @@
extern "C" {
#endif
-#include <sys/types.h> /* for off_t */
-#include <time.h> /* for time_t */
-#include <stdarg.h> /* for va_list */
+#include <stdint.h> /* int64_t */
+#include <sys/types.h> /* off_t */
+#include <stdarg.h> /* va_list */
#include <alpm_list.h>
-#define DEPRECATED __attribute__((deprecated))
-
/*
* Arch Linux Package Management library
*/
@@ -44,15 +42,14 @@ extern "C" {
* @{
*/
+typedef int64_t alpm_time_t;
+
/*
* Enumerations
* These ones are used in multiple contexts, so are forward-declared.
*/
-/**
- * Install reasons.
- * Why the package was installed.
- */
+/** Package install reasons. */
typedef enum _alpm_pkgreason_t {
/** Explicitly requested by the user. */
ALPM_PKG_REASON_EXPLICIT = 0,
@@ -60,12 +57,22 @@ typedef enum _alpm_pkgreason_t {
ALPM_PKG_REASON_DEPEND = 1
} alpm_pkgreason_t;
+/** Location a package object was loaded from. */
typedef enum _alpm_pkgfrom_t {
PKG_FROM_FILE = 1,
PKG_FROM_LOCALDB,
PKG_FROM_SYNCDB
} alpm_pkgfrom_t;
+/** Location a package object was loaded from. */
+typedef enum _alpm_pkgvalidation_t {
+ ALPM_PKG_VALIDATION_UNKNOWN = 0,
+ ALPM_PKG_VALIDATION_NONE = (1 << 0),
+ ALPM_PKG_VALIDATION_MD5SUM = (1 << 1),
+ ALPM_PKG_VALIDATION_SHA256SUM = (1 << 2),
+ ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3)
+} alpm_pkgvalidation_t;
+
/** Types of version constraints in dependency specs. */
typedef enum _alpm_depmod_t {
/** No version constraint */
@@ -92,9 +99,7 @@ typedef enum _alpm_fileconflicttype_t {
ALPM_FILECONFLICT_FILESYSTEM
} alpm_fileconflicttype_t;
-/**
- * PGP signature verification options
- */
+/** PGP signature verification options */
typedef enum _alpm_siglevel_t {
ALPM_SIG_PACKAGE = (1 << 0),
ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1),
@@ -109,9 +114,7 @@ typedef enum _alpm_siglevel_t {
ALPM_SIG_USE_DEFAULT = (1 << 31)
} alpm_siglevel_t;
-/**
- * PGP signature verification status return codes
- */
+/** PGP signature verification status return codes */
typedef enum _alpm_sigstatus_t {
ALPM_SIGSTATUS_VALID,
ALPM_SIGSTATUS_KEY_EXPIRED,
@@ -121,9 +124,7 @@ typedef enum _alpm_sigstatus_t {
ALPM_SIGSTATUS_INVALID
} alpm_sigstatus_t;
-/**
- * PGP signature verification status return codes
- */
+/** PGP signature verification status return codes */
typedef enum _alpm_sigvalidity_t {
ALPM_SIGVALIDITY_FULL,
ALPM_SIGVALIDITY_MARGINAL,
@@ -144,6 +145,7 @@ typedef struct __alpm_trans_t alpm_trans_t;
typedef struct _alpm_depend_t {
char *name;
char *version;
+ char *desc;
unsigned long name_hash;
alpm_depmod_t mod;
} alpm_depend_t;
@@ -152,7 +154,7 @@ typedef struct _alpm_depend_t {
typedef struct _alpm_depmissing_t {
char *target;
alpm_depend_t *depend;
- /* this is used in case of remove dependency error only */
+ /* this is used only in the case of a remove dependency error */
char *causingpkg;
} alpm_depmissing_t;
@@ -222,11 +224,15 @@ typedef struct _alpm_pgpkey_t {
char *uid;
char *name;
char *email;
- time_t created;
- time_t expires;
+ alpm_time_t created;
+ alpm_time_t expires;
+ unsigned int length;
+ unsigned int revoked;
+ char pubkey_algo;
} alpm_pgpkey_t;
-/** Signature result. Contains the key, status, and validity of a given
+/**
+ * Signature result. Contains the key, status, and validity of a given
* signature.
*/
typedef struct _alpm_sigresult_t {
@@ -235,7 +241,8 @@ typedef struct _alpm_sigresult_t {
alpm_sigvalidity_t validity;
} alpm_sigresult_t;
-/** Signature list. Contains the number of signatures found and a pointer to an
+/**
+ * Signature list. Contains the number of signatures found and a pointer to an
* array of results. The array is of size count.
*/
typedef struct _alpm_siglist_t {
@@ -247,9 +254,7 @@ typedef struct _alpm_siglist_t {
* Logging facilities
*/
-/**
- * Logging Levels
- */
+/** Logging Levels */
typedef enum _alpm_loglevel_t {
ALPM_LOG_ERROR = 1,
ALPM_LOG_WARNING = (1 << 1),
@@ -260,7 +265,8 @@ typedef enum _alpm_loglevel_t {
typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...);
-/** Events.
+/**
+ * Events.
* NULL parameters are passed to in all events unless specified otherwise.
*/
typedef enum _alpm_event_t {
@@ -341,13 +347,18 @@ typedef enum _alpm_event_t {
/** Disk space usage will be computed for a package */
ALPM_EVENT_DISKSPACE_START,
/** Disk space usage was computed for a package */
- ALPM_EVENT_DISKSPACE_DONE,
+ ALPM_EVENT_DISKSPACE_DONE
} alpm_event_t;
/** Event callback */
typedef void (*alpm_cb_event)(alpm_event_t, void *, void *);
-/** Questions */
+/**
+ * Questions.
+ * Unlike the events or progress enumerations, this enum has bitmask values
+ * so a frontend can use a bitmask map to supply preselected answers to the
+ * different types of questions.
+ */
typedef enum _alpm_question_t {
ALPM_QUESTION_INSTALL_IGNOREPKG = 1,
ALPM_QUESTION_REPLACE_PKG = (1 << 1),
@@ -370,7 +381,7 @@ typedef enum _alpm_progress_t {
ALPM_PROGRESS_CONFLICTS_START,
ALPM_PROGRESS_DISKSPACE_START,
ALPM_PROGRESS_INTEGRITY_START,
- ALPM_PROGRESS_LOAD_START,
+ ALPM_PROGRESS_LOAD_START
} alpm_progress_t;
/** Progress callback */
@@ -530,8 +541,8 @@ const char *alpm_option_get_arch(alpm_handle_t *handle);
/** Sets the targeted architecture. */
int alpm_option_set_arch(alpm_handle_t *handle, const char *arch);
-int alpm_option_get_usedelta(alpm_handle_t *handle);
-int alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta);
+double alpm_option_get_deltaratio(alpm_handle_t *handle);
+int alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio);
int alpm_option_get_checkspace(alpm_handle_t *handle);
int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
@@ -552,7 +563,7 @@ int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t leve
* libalpm functions.
* @return a reference to the local database
*/
-alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
+alpm_db_t *alpm_get_localdb(alpm_handle_t *handle);
/** Get the list of sync databases.
* Returns a list of alpm_db_t structures, one for each registered
@@ -560,7 +571,7 @@ alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
* @param handle the context handle
* @return a reference to an internal list of alpm_db_t structures
*/
-alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
+alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle);
/** Register a sync database of packages.
* @param handle the context handle
@@ -569,20 +580,20 @@ alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
* database; note that this must be a '.sig' file type verification
* @return an alpm_db_t* on success (the value), NULL on error
*/
-alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
+alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename,
alpm_siglevel_t level);
-/** Unregister a package database.
- * @param db pointer to the package database to unregister
+/** Unregister all package databases.
+ * @param handle the context handle
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_db_unregister(alpm_db_t *db);
+int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
-/** Unregister all package databases.
- * @param handle the context handle
+/** Unregister a package database.
+ * @param db pointer to the package database to unregister
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_db_unregister_all(alpm_handle_t *handle);
+int alpm_db_unregister(alpm_db_t *db);
/** Get the name of a package database.
* @param db pointer to the package database
@@ -635,7 +646,7 @@ alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db);
* @param name of the group
* @return the groups entry on success, NULL on error
*/
-alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name);
+alpm_group_t *alpm_db_get_group(alpm_db_t *db, const char *name);
/** Get the group cache of a package database.
* @param db pointer to the package database to get the group from
@@ -648,16 +659,7 @@ alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
* @param needles a list of regular expressions to search for
* @return the list of packages matching all regular expressions on success, NULL on error
*/
-alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles);
-
-/** Set install reason for a package in db.
- * @param handle the context handle
- * @param pkg the package to update
- * @param reason the new install reason
- * @return 0 on success, -1 on error (pm_errno is set accordingly)
- */
-int alpm_db_set_pkgreason(alpm_handle_t *handle, alpm_pkg_t *pkg,
- alpm_pkgreason_t reason);
+alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
/** @} */
@@ -754,13 +756,13 @@ const char *alpm_pkg_get_url(alpm_pkg_t *pkg);
* @param pkg a pointer to package
* @return the timestamp of the build time
*/
-time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
+alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
/** Returns the install timestamp of the package.
* @param pkg a pointer to package
* @return the timestamp of the install time
*/
-time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
+alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
/** Returns the packager's name.
* @param pkg a pointer to package
@@ -827,7 +829,7 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
/** Returns the list of package optional dependencies.
* @param pkg a pointer to package
- * @return a reference to an internal list of strings.
+ * @return a reference to an internal list of alpm_depend_t structures.
*/
alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg);
@@ -887,6 +889,12 @@ alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg);
*/
const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg);
+/** Returns the method used to validate a package during install.
+ * @param pkg a pointer to package
+ * @return an enum member giving the validation method
+ */
+alpm_pkgvalidation_t alpm_pkg_get_validation(alpm_pkg_t *pkg);
+
/* End of alpm_pkg_t accessors */
/* @} */
@@ -928,6 +936,16 @@ off_t alpm_pkg_download_size(alpm_pkg_t *newpkg);
alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg);
+/** Set install reason for a package in the local database.
+ * The provided package object must be from the local database or this method
+ * will fail. The write to the local database is performed immediately.
+ * @param pkg the package to update
+ * @param reason the new install reason
+ * @return 0 on success, -1 on error (pm_errno is set accordingly)
+ */
+int alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason);
+
+
/* End of alpm_pkg */
/** @} */
@@ -1107,13 +1125,13 @@ char *alpm_dep_compute_string(const alpm_depend_t *dep);
*/
/* checksums */
-char *alpm_compute_md5sum(const char *name);
+char *alpm_compute_md5sum(const char *filename);
char *alpm_compute_sha256sum(const char *filename);
/** @addtogroup alpm_api_errors Error Codes
* @{
*/
-enum _alpm_errno_t {
+typedef enum _alpm_errno_t {
ALPM_ERR_MEMORY = 1,
ALPM_ERR_SYSTEM,
ALPM_ERR_BADPERMS,
@@ -1177,19 +1195,19 @@ enum _alpm_errno_t {
ALPM_ERR_LIBCURL,
ALPM_ERR_EXTERNAL_DOWNLOAD,
ALPM_ERR_GPGME
-};
+} alpm_errno_t;
/** Returns the current error code from the handle. */
-enum _alpm_errno_t alpm_errno(alpm_handle_t *handle);
+alpm_errno_t alpm_errno(alpm_handle_t *handle);
/** Returns the string corresponding to an error number. */
-const char *alpm_strerror(enum _alpm_errno_t err);
+const char *alpm_strerror(alpm_errno_t err);
/* End of alpm_api_errors */
/** @} */
alpm_handle_t *alpm_initialize(const char *root, const char *dbpath,
- enum _alpm_errno_t *err);
+ alpm_errno_t *err);
int alpm_release(alpm_handle_t *handle);
enum alpm_caps {