Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r--lib/libalpm/alpm.h122
1 files changed, 62 insertions, 60 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 6df3e1f5..aeb1bb72 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -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,6 +57,7 @@ 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,
@@ -92,9 +90,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 +105,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 +115,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,
@@ -152,7 +144,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 +214,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 +231,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 +244,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 +255,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 +337,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 +371,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 +531,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 +553,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 +561,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 +570,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 +636,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 +649,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 +746,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
@@ -928,6 +920,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 +1109,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 +1179,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 {