libalpm
Arch Linux Package Manager Library
|
00001 /* 00002 * alpm.h 00003 * 00004 * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org> 00005 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> 00006 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> 00007 * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> 00008 * Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef _ALPM_H 00024 #define _ALPM_H 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 #include <stdint.h> /* int64_t */ 00031 #include <sys/types.h> /* off_t */ 00032 #include <stdarg.h> /* va_list */ 00033 00034 #include <alpm_list.h> 00035 00036 #define DEPRECATED __attribute__((deprecated)) 00037 00038 /* 00039 * Arch Linux Package Management library 00040 */ 00041 00042 /** @addtogroup alpm_api Public API 00043 * The libalpm Public API 00044 * @{ 00045 */ 00046 00047 typedef int64_t alpm_time_t; 00048 00049 /* 00050 * Enumerations 00051 * These ones are used in multiple contexts, so are forward-declared. 00052 */ 00053 00054 /** 00055 * Install reasons. 00056 * Why the package was installed. 00057 */ 00058 typedef enum _alpm_pkgreason_t { 00059 /** Explicitly requested by the user. */ 00060 ALPM_PKG_REASON_EXPLICIT = 0, 00061 /** Installed as a dependency for another package. */ 00062 ALPM_PKG_REASON_DEPEND = 1 00063 } alpm_pkgreason_t; 00064 00065 typedef enum _alpm_pkgfrom_t { 00066 PKG_FROM_FILE = 1, 00067 PKG_FROM_LOCALDB, 00068 PKG_FROM_SYNCDB 00069 } alpm_pkgfrom_t; 00070 00071 /** Types of version constraints in dependency specs. */ 00072 typedef enum _alpm_depmod_t { 00073 /** No version constraint */ 00074 ALPM_DEP_MOD_ANY = 1, 00075 /** Test version equality (package=x.y.z) */ 00076 ALPM_DEP_MOD_EQ, 00077 /** Test for at least a version (package>=x.y.z) */ 00078 ALPM_DEP_MOD_GE, 00079 /** Test for at most a version (package<=x.y.z) */ 00080 ALPM_DEP_MOD_LE, 00081 /** Test for greater than some version (package>x.y.z) */ 00082 ALPM_DEP_MOD_GT, 00083 /** Test for less than some version (package<x.y.z) */ 00084 ALPM_DEP_MOD_LT 00085 } alpm_depmod_t; 00086 00087 /** 00088 * File conflict type. 00089 * Whether the conflict results from a file existing on the filesystem, or with 00090 * another target in the transaction. 00091 */ 00092 typedef enum _alpm_fileconflicttype_t { 00093 ALPM_FILECONFLICT_TARGET = 1, 00094 ALPM_FILECONFLICT_FILESYSTEM 00095 } alpm_fileconflicttype_t; 00096 00097 /** 00098 * PGP signature verification options 00099 */ 00100 typedef enum _alpm_siglevel_t { 00101 ALPM_SIG_PACKAGE = (1 << 0), 00102 ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1), 00103 ALPM_SIG_PACKAGE_MARGINAL_OK = (1 << 2), 00104 ALPM_SIG_PACKAGE_UNKNOWN_OK = (1 << 3), 00105 00106 ALPM_SIG_DATABASE = (1 << 10), 00107 ALPM_SIG_DATABASE_OPTIONAL = (1 << 11), 00108 ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12), 00109 ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13), 00110 00111 ALPM_SIG_USE_DEFAULT = (1 << 31) 00112 } alpm_siglevel_t; 00113 00114 /** 00115 * PGP signature verification status return codes 00116 */ 00117 typedef enum _alpm_sigstatus_t { 00118 ALPM_SIGSTATUS_VALID, 00119 ALPM_SIGSTATUS_KEY_EXPIRED, 00120 ALPM_SIGSTATUS_SIG_EXPIRED, 00121 ALPM_SIGSTATUS_KEY_UNKNOWN, 00122 ALPM_SIGSTATUS_KEY_DISABLED, 00123 ALPM_SIGSTATUS_INVALID 00124 } alpm_sigstatus_t; 00125 00126 /** 00127 * PGP signature verification status return codes 00128 */ 00129 typedef enum _alpm_sigvalidity_t { 00130 ALPM_SIGVALIDITY_FULL, 00131 ALPM_SIGVALIDITY_MARGINAL, 00132 ALPM_SIGVALIDITY_NEVER, 00133 ALPM_SIGVALIDITY_UNKNOWN 00134 } alpm_sigvalidity_t; 00135 00136 /* 00137 * Structures 00138 */ 00139 00140 typedef struct __alpm_handle_t alpm_handle_t; 00141 typedef struct __alpm_db_t alpm_db_t; 00142 typedef struct __alpm_pkg_t alpm_pkg_t; 00143 typedef struct __alpm_trans_t alpm_trans_t; 00144 00145 /** Dependency */ 00146 typedef struct _alpm_depend_t { 00147 char *name; 00148 char *version; 00149 unsigned long name_hash; 00150 alpm_depmod_t mod; 00151 } alpm_depend_t; 00152 00153 /** Missing dependency */ 00154 typedef struct _alpm_depmissing_t { 00155 char *target; 00156 alpm_depend_t *depend; 00157 /* this is used in case of remove dependency error only */ 00158 char *causingpkg; 00159 } alpm_depmissing_t; 00160 00161 /** Conflict */ 00162 typedef struct _alpm_conflict_t { 00163 unsigned long package1_hash; 00164 unsigned long package2_hash; 00165 char *package1; 00166 char *package2; 00167 alpm_depend_t *reason; 00168 } alpm_conflict_t; 00169 00170 /** File conflict */ 00171 typedef struct _alpm_fileconflict_t { 00172 char *target; 00173 alpm_fileconflicttype_t type; 00174 char *file; 00175 char *ctarget; 00176 } alpm_fileconflict_t; 00177 00178 /** Package group */ 00179 typedef struct _alpm_group_t { 00180 /** group name */ 00181 char *name; 00182 /** list of alpm_pkg_t packages */ 00183 alpm_list_t *packages; 00184 } alpm_group_t; 00185 00186 /** Package upgrade delta */ 00187 typedef struct _alpm_delta_t { 00188 /** filename of the delta patch */ 00189 char *delta; 00190 /** md5sum of the delta file */ 00191 char *delta_md5; 00192 /** filename of the 'before' file */ 00193 char *from; 00194 /** filename of the 'after' file */ 00195 char *to; 00196 /** filesize of the delta file */ 00197 off_t delta_size; 00198 /** download filesize of the delta file */ 00199 off_t download_size; 00200 } alpm_delta_t; 00201 00202 /** File in a package */ 00203 typedef struct _alpm_file_t { 00204 char *name; 00205 off_t size; 00206 mode_t mode; 00207 } alpm_file_t; 00208 00209 /** Package filelist container */ 00210 typedef struct _alpm_filelist_t { 00211 size_t count; 00212 alpm_file_t *files; 00213 } alpm_filelist_t; 00214 00215 /** Local package or package file backup entry */ 00216 typedef struct _alpm_backup_t { 00217 char *name; 00218 char *hash; 00219 } alpm_backup_t; 00220 00221 typedef struct _alpm_pgpkey_t { 00222 void *data; 00223 char *fingerprint; 00224 char *uid; 00225 char *name; 00226 char *email; 00227 alpm_time_t created; 00228 alpm_time_t expires; 00229 unsigned int length; 00230 unsigned int revoked; 00231 char pubkey_algo; 00232 } alpm_pgpkey_t; 00233 00234 /** Signature result. Contains the key, status, and validity of a given 00235 * signature. 00236 */ 00237 typedef struct _alpm_sigresult_t { 00238 alpm_pgpkey_t key; 00239 alpm_sigstatus_t status; 00240 alpm_sigvalidity_t validity; 00241 } alpm_sigresult_t; 00242 00243 /** Signature list. Contains the number of signatures found and a pointer to an 00244 * array of results. The array is of size count. 00245 */ 00246 typedef struct _alpm_siglist_t { 00247 size_t count; 00248 alpm_sigresult_t *results; 00249 } alpm_siglist_t; 00250 00251 /* 00252 * Logging facilities 00253 */ 00254 00255 /** 00256 * Logging Levels 00257 */ 00258 typedef enum _alpm_loglevel_t { 00259 ALPM_LOG_ERROR = 1, 00260 ALPM_LOG_WARNING = (1 << 1), 00261 ALPM_LOG_DEBUG = (1 << 2), 00262 ALPM_LOG_FUNCTION = (1 << 3) 00263 } alpm_loglevel_t; 00264 00265 typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list); 00266 int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...); 00267 00268 /** Events. 00269 * NULL parameters are passed to in all events unless specified otherwise. 00270 */ 00271 typedef enum _alpm_event_t { 00272 /** Dependencies will be computed for a package. */ 00273 ALPM_EVENT_CHECKDEPS_START = 1, 00274 /** Dependencies were computed for a package. */ 00275 ALPM_EVENT_CHECKDEPS_DONE, 00276 /** File conflicts will be computed for a package. */ 00277 ALPM_EVENT_FILECONFLICTS_START, 00278 /** File conflicts were computed for a package. */ 00279 ALPM_EVENT_FILECONFLICTS_DONE, 00280 /** Dependencies will be resolved for target package. */ 00281 ALPM_EVENT_RESOLVEDEPS_START, 00282 /** Dependencies were resolved for target package. */ 00283 ALPM_EVENT_RESOLVEDEPS_DONE, 00284 /** Inter-conflicts will be checked for target package. */ 00285 ALPM_EVENT_INTERCONFLICTS_START, 00286 /** Inter-conflicts were checked for target package. */ 00287 ALPM_EVENT_INTERCONFLICTS_DONE, 00288 /** Package will be installed. 00289 * A pointer to the target package is passed to the callback. 00290 */ 00291 ALPM_EVENT_ADD_START, 00292 /** Package was installed. 00293 * A pointer to the new package is passed to the callback. 00294 */ 00295 ALPM_EVENT_ADD_DONE, 00296 /** Package will be removed. 00297 * A pointer to the target package is passed to the callback. 00298 */ 00299 ALPM_EVENT_REMOVE_START, 00300 /** Package was removed. 00301 * A pointer to the removed package is passed to the callback. 00302 */ 00303 ALPM_EVENT_REMOVE_DONE, 00304 /** Package will be upgraded. 00305 * A pointer to the upgraded package is passed to the callback. 00306 */ 00307 ALPM_EVENT_UPGRADE_START, 00308 /** Package was upgraded. 00309 * A pointer to the new package, and a pointer to the old package is passed 00310 * to the callback, respectively. 00311 */ 00312 ALPM_EVENT_UPGRADE_DONE, 00313 /** Target package's integrity will be checked. */ 00314 ALPM_EVENT_INTEGRITY_START, 00315 /** Target package's integrity was checked. */ 00316 ALPM_EVENT_INTEGRITY_DONE, 00317 /** Target package will be loaded. */ 00318 ALPM_EVENT_LOAD_START, 00319 /** Target package is finished loading. */ 00320 ALPM_EVENT_LOAD_DONE, 00321 /** Target deltas's integrity will be checked. */ 00322 ALPM_EVENT_DELTA_INTEGRITY_START, 00323 /** Target delta's integrity was checked. */ 00324 ALPM_EVENT_DELTA_INTEGRITY_DONE, 00325 /** Deltas will be applied to packages. */ 00326 ALPM_EVENT_DELTA_PATCHES_START, 00327 /** Deltas were applied to packages. */ 00328 ALPM_EVENT_DELTA_PATCHES_DONE, 00329 /** Delta patch will be applied to target package. 00330 * The filename of the package and the filename of the patch is passed to the 00331 * callback. 00332 */ 00333 ALPM_EVENT_DELTA_PATCH_START, 00334 /** Delta patch was applied to target package. */ 00335 ALPM_EVENT_DELTA_PATCH_DONE, 00336 /** Delta patch failed to apply to target package. */ 00337 ALPM_EVENT_DELTA_PATCH_FAILED, 00338 /** Scriptlet has printed information. 00339 * A line of text is passed to the callback. 00340 */ 00341 ALPM_EVENT_SCRIPTLET_INFO, 00342 /** Files will be downloaded from a repository. 00343 * The repository's tree name is passed to the callback. 00344 */ 00345 ALPM_EVENT_RETRIEVE_START, 00346 /** Disk space usage will be computed for a package */ 00347 ALPM_EVENT_DISKSPACE_START, 00348 /** Disk space usage was computed for a package */ 00349 ALPM_EVENT_DISKSPACE_DONE, 00350 } alpm_event_t; 00351 00352 /** Event callback */ 00353 typedef void (*alpm_cb_event)(alpm_event_t, void *, void *); 00354 00355 /** Questions */ 00356 typedef enum _alpm_question_t { 00357 ALPM_QUESTION_INSTALL_IGNOREPKG = 1, 00358 ALPM_QUESTION_REPLACE_PKG = (1 << 1), 00359 ALPM_QUESTION_CONFLICT_PKG = (1 << 2), 00360 ALPM_QUESTION_CORRUPTED_PKG = (1 << 3), 00361 ALPM_QUESTION_LOCAL_NEWER = (1 << 4), 00362 ALPM_QUESTION_REMOVE_PKGS = (1 << 5), 00363 ALPM_QUESTION_SELECT_PROVIDER = (1 << 6), 00364 ALPM_QUESTION_IMPORT_KEY = (1 << 7) 00365 } alpm_question_t; 00366 00367 /** Question callback */ 00368 typedef void (*alpm_cb_question)(alpm_question_t, void *, void *, void *, int *); 00369 00370 /** Progress */ 00371 typedef enum _alpm_progress_t { 00372 ALPM_PROGRESS_ADD_START, 00373 ALPM_PROGRESS_UPGRADE_START, 00374 ALPM_PROGRESS_REMOVE_START, 00375 ALPM_PROGRESS_CONFLICTS_START, 00376 ALPM_PROGRESS_DISKSPACE_START, 00377 ALPM_PROGRESS_INTEGRITY_START, 00378 ALPM_PROGRESS_LOAD_START, 00379 } alpm_progress_t; 00380 00381 /** Progress callback */ 00382 typedef void (*alpm_cb_progress)(alpm_progress_t, const char *, int, size_t, size_t); 00383 00384 /* 00385 * Downloading 00386 */ 00387 00388 /** Type of download progress callbacks. 00389 * @param filename the name of the file being downloaded 00390 * @param xfered the number of transferred bytes 00391 * @param total the total number of bytes to transfer 00392 */ 00393 typedef void (*alpm_cb_download)(const char *filename, 00394 off_t xfered, off_t total); 00395 00396 typedef void (*alpm_cb_totaldl)(off_t total); 00397 00398 /** A callback for downloading files 00399 * @param url the URL of the file to be downloaded 00400 * @param localpath the directory to which the file should be downloaded 00401 * @param force whether to force an update, even if the file is the same 00402 * @return 0 on success, 1 if the file exists and is identical, -1 on 00403 * error. 00404 */ 00405 typedef int (*alpm_cb_fetch)(const char *url, const char *localpath, 00406 int force); 00407 00408 /** Fetch a remote pkg. 00409 * @param handle the context handle 00410 * @param url URL of the package to download 00411 * @return the downloaded filepath on success, NULL on error 00412 */ 00413 char *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url); 00414 00415 /** @addtogroup alpm_api_options Options 00416 * Libalpm option getters and setters 00417 * @{ 00418 */ 00419 00420 /** Returns the callback used for logging. */ 00421 alpm_cb_log alpm_option_get_logcb(alpm_handle_t *handle); 00422 /** Sets the callback used for logging. */ 00423 int alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb); 00424 00425 /** Returns the callback used to report download progress. */ 00426 alpm_cb_download alpm_option_get_dlcb(alpm_handle_t *handle); 00427 /** Sets the callback used to report download progress. */ 00428 int alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb); 00429 00430 /** Returns the downloading callback. */ 00431 alpm_cb_fetch alpm_option_get_fetchcb(alpm_handle_t *handle); 00432 /** Sets the downloading callback. */ 00433 int alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb); 00434 00435 /** Returns the callback used to report total download size. */ 00436 alpm_cb_totaldl alpm_option_get_totaldlcb(alpm_handle_t *handle); 00437 /** Sets the callback used to report total download size. */ 00438 int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb); 00439 00440 /** Returns the callback used for events. */ 00441 alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle); 00442 /** Sets the callback used for events. */ 00443 int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb); 00444 00445 /** Returns the callback used for questions. */ 00446 alpm_cb_question alpm_option_get_questioncb(alpm_handle_t *handle); 00447 /** Sets the callback used for questions. */ 00448 int alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb); 00449 00450 /** Returns the callback used for operation progress. */ 00451 alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle); 00452 /** Sets the callback used for operation progress. */ 00453 int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb); 00454 00455 /** Returns the root of the destination filesystem. Read-only. */ 00456 const char *alpm_option_get_root(alpm_handle_t *handle); 00457 00458 /** Returns the path to the database directory. Read-only. */ 00459 const char *alpm_option_get_dbpath(alpm_handle_t *handle); 00460 00461 /** Get the name of the database lock file. Read-only. */ 00462 const char *alpm_option_get_lockfile(alpm_handle_t *handle); 00463 00464 /** @name Accessors to the list of package cache directories. 00465 * @{ 00466 */ 00467 alpm_list_t *alpm_option_get_cachedirs(alpm_handle_t *handle); 00468 int alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs); 00469 int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir); 00470 int alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir); 00471 /** @} */ 00472 00473 /** Returns the logfile name. */ 00474 const char *alpm_option_get_logfile(alpm_handle_t *handle); 00475 /** Sets the logfile name. */ 00476 int alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile); 00477 00478 /** Returns the path to libalpm's GnuPG home directory. */ 00479 const char *alpm_option_get_gpgdir(alpm_handle_t *handle); 00480 /** Sets the path to libalpm's GnuPG home directory. */ 00481 int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir); 00482 00483 /** Returns whether to use syslog (0 is FALSE, TRUE otherwise). */ 00484 int alpm_option_get_usesyslog(alpm_handle_t *handle); 00485 /** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */ 00486 int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog); 00487 00488 /** @name Accessors to the list of no-upgrade files. 00489 * These functions modify the list of files which should 00490 * not be updated by package installation. 00491 * @{ 00492 */ 00493 alpm_list_t *alpm_option_get_noupgrades(alpm_handle_t *handle); 00494 int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg); 00495 int alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade); 00496 int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg); 00497 /** @} */ 00498 00499 /** @name Accessors to the list of no-extract files. 00500 * These functions modify the list of filenames which should 00501 * be skipped packages which should 00502 * not be upgraded by a sysupgrade operation. 00503 * @{ 00504 */ 00505 alpm_list_t *alpm_option_get_noextracts(alpm_handle_t *handle); 00506 int alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg); 00507 int alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract); 00508 int alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg); 00509 /** @} */ 00510 00511 /** @name Accessors to the list of ignored packages. 00512 * These functions modify the list of packages that 00513 * should be ignored by a sysupgrade. 00514 * @{ 00515 */ 00516 alpm_list_t *alpm_option_get_ignorepkgs(alpm_handle_t *handle); 00517 int alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg); 00518 int alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs); 00519 int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg); 00520 /** @} */ 00521 00522 /** @name Accessors to the list of ignored groups. 00523 * These functions modify the list of groups whose packages 00524 * should be ignored by a sysupgrade. 00525 * @{ 00526 */ 00527 alpm_list_t *alpm_option_get_ignoregroups(alpm_handle_t *handle); 00528 int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp); 00529 int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps); 00530 int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp); 00531 /** @} */ 00532 00533 /** Returns the targeted architecture. */ 00534 const char *alpm_option_get_arch(alpm_handle_t *handle); 00535 /** Sets the targeted architecture. */ 00536 int alpm_option_set_arch(alpm_handle_t *handle, const char *arch); 00537 00538 int alpm_option_get_usedelta(alpm_handle_t *handle); 00539 int alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta); 00540 00541 int alpm_option_get_checkspace(alpm_handle_t *handle); 00542 int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace); 00543 00544 alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle); 00545 int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); 00546 00547 /** @} */ 00548 00549 /** @addtogroup alpm_api_databases Database Functions 00550 * Functions to query and manipulate the database of libalpm. 00551 * @{ 00552 */ 00553 00554 /** Get the database of locally installed packages. 00555 * The returned pointer points to an internal structure 00556 * of libalpm which should only be manipulated through 00557 * libalpm functions. 00558 * @return a reference to the local database 00559 */ 00560 alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle); 00561 00562 /** Get the list of sync databases. 00563 * Returns a list of alpm_db_t structures, one for each registered 00564 * sync database. 00565 * @param handle the context handle 00566 * @return a reference to an internal list of alpm_db_t structures 00567 */ 00568 alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle); 00569 00570 /** Register a sync database of packages. 00571 * @param handle the context handle 00572 * @param treename the name of the sync repository 00573 * @param level what level of signature checking to perform on the 00574 * database; note that this must be a '.sig' file type verification 00575 * @return an alpm_db_t* on success (the value), NULL on error 00576 */ 00577 alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename, 00578 alpm_siglevel_t level); 00579 00580 /** Unregister a package database. 00581 * @param db pointer to the package database to unregister 00582 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00583 */ 00584 int alpm_db_unregister(alpm_db_t *db); 00585 00586 /** Unregister all package databases. 00587 * @param handle the context handle 00588 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00589 */ 00590 int alpm_db_unregister_all(alpm_handle_t *handle); 00591 00592 /** Get the name of a package database. 00593 * @param db pointer to the package database 00594 * @return the name of the package database, NULL on error 00595 */ 00596 const char *alpm_db_get_name(const alpm_db_t *db); 00597 00598 /** Get the signature verification level for a database. 00599 * Will return the default verification level if this database is set up 00600 * with ALPM_SIG_USE_DEFAULT. 00601 * @param db pointer to the package database 00602 * @return the signature verification level 00603 */ 00604 alpm_siglevel_t alpm_db_get_siglevel(alpm_db_t *db); 00605 00606 /** Check the validity of a database. 00607 * This is most useful for sync databases and verifying signature status. 00608 * If invalid, the handle error code will be set accordingly. 00609 * @param db pointer to the package database 00610 * @return 0 if valid, -1 if invalid (pm_errno is set accordingly) 00611 */ 00612 int alpm_db_get_valid(alpm_db_t *db); 00613 00614 /** @name Accessors to the list of servers for a database. 00615 * @{ 00616 */ 00617 alpm_list_t *alpm_db_get_servers(const alpm_db_t *db); 00618 int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers); 00619 int alpm_db_add_server(alpm_db_t *db, const char *url); 00620 int alpm_db_remove_server(alpm_db_t *db, const char *url); 00621 /** @} */ 00622 00623 int alpm_db_update(int level, alpm_db_t *db); 00624 00625 /** Get a package entry from a package database. 00626 * @param db pointer to the package database to get the package from 00627 * @param name of the package 00628 * @return the package entry on success, NULL on error 00629 */ 00630 alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name); 00631 00632 /** Get the package cache of a package database. 00633 * @param db pointer to the package database to get the package from 00634 * @return the list of packages on success, NULL on error 00635 */ 00636 alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db); 00637 00638 /** Get a group entry from a package database. 00639 * @param db pointer to the package database to get the group from 00640 * @param name of the group 00641 * @return the groups entry on success, NULL on error 00642 */ 00643 alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name); 00644 00645 /** Get the group cache of a package database. 00646 * @param db pointer to the package database to get the group from 00647 * @return the list of groups on success, NULL on error 00648 */ 00649 alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db); 00650 00651 /** Searches a database with regular expressions. 00652 * @param db pointer to the package database to search in 00653 * @param needles a list of regular expressions to search for 00654 * @return the list of packages matching all regular expressions on success, NULL on error 00655 */ 00656 alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles); 00657 00658 /** Set install reason for a package in db. 00659 * @param handle the context handle 00660 * @param pkg the package to update 00661 * @param reason the new install reason 00662 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00663 */ 00664 int alpm_db_set_pkgreason(alpm_handle_t *handle, alpm_pkg_t *pkg, 00665 alpm_pkgreason_t reason); 00666 00667 /** @} */ 00668 00669 /** @addtogroup alpm_api_packages Package Functions 00670 * Functions to manipulate libalpm packages 00671 * @{ 00672 */ 00673 00674 /** Create a package from a file. 00675 * If full is false, the archive is read only until all necessary 00676 * metadata is found. If it is true, the entire archive is read, which 00677 * serves as a verification of integrity and the filelist can be created. 00678 * The allocated structure should be freed using alpm_pkg_free(). 00679 * @param handle the context handle 00680 * @param filename location of the package tarball 00681 * @param full whether to stop the load after metadata is read or continue 00682 * through the full archive 00683 * @param level what level of package signature checking to perform on the 00684 * package; note that this must be a '.sig' file type verification 00685 * @param pkg address of the package pointer 00686 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00687 */ 00688 int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, 00689 alpm_siglevel_t level, alpm_pkg_t **pkg); 00690 00691 /** Free a package. 00692 * @param pkg package pointer to free 00693 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00694 */ 00695 int alpm_pkg_free(alpm_pkg_t *pkg); 00696 00697 /** Check the integrity (with md5) of a package from the sync cache. 00698 * @param pkg package pointer 00699 * @return 0 on success, -1 on error (pm_errno is set accordingly) 00700 */ 00701 int alpm_pkg_checkmd5sum(alpm_pkg_t *pkg); 00702 00703 /** Compare two version strings and determine which one is 'newer'. */ 00704 int alpm_pkg_vercmp(const char *a, const char *b); 00705 00706 /** Computes the list of packages requiring a given package. 00707 * The return value of this function is a newly allocated 00708 * list of package names (char*), it should be freed by the caller. 00709 * @param pkg a package 00710 * @return the list of packages requiring pkg 00711 */ 00712 alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg); 00713 00714 /** @name Package Property Accessors 00715 * Any pointer returned by these functions points to internal structures 00716 * allocated by libalpm. They should not be freed nor modified in any 00717 * way. 00718 * @{ 00719 */ 00720 00721 /** Gets the name of the file from which the package was loaded. 00722 * @param pkg a pointer to package 00723 * @return a reference to an internal string 00724 */ 00725 const char *alpm_pkg_get_filename(alpm_pkg_t *pkg); 00726 00727 /** Returns the package name. 00728 * @param pkg a pointer to package 00729 * @return a reference to an internal string 00730 */ 00731 const char *alpm_pkg_get_name(alpm_pkg_t *pkg); 00732 00733 /** Returns the package version as a string. 00734 * This includes all available epoch, version, and pkgrel components. Use 00735 * alpm_pkg_vercmp() to compare version strings if necessary. 00736 * @param pkg a pointer to package 00737 * @return a reference to an internal string 00738 */ 00739 const char *alpm_pkg_get_version(alpm_pkg_t *pkg); 00740 00741 /** Returns the origin of the package. 00742 * @return an alpm_pkgfrom_t constant, -1 on error 00743 */ 00744 alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg); 00745 00746 /** Returns the package description. 00747 * @param pkg a pointer to package 00748 * @return a reference to an internal string 00749 */ 00750 const char *alpm_pkg_get_desc(alpm_pkg_t *pkg); 00751 00752 /** Returns the package URL. 00753 * @param pkg a pointer to package 00754 * @return a reference to an internal string 00755 */ 00756 const char *alpm_pkg_get_url(alpm_pkg_t *pkg); 00757 00758 /** Returns the build timestamp of the package. 00759 * @param pkg a pointer to package 00760 * @return the timestamp of the build time 00761 */ 00762 alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg); 00763 00764 /** Returns the install timestamp of the package. 00765 * @param pkg a pointer to package 00766 * @return the timestamp of the install time 00767 */ 00768 alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg); 00769 00770 /** Returns the packager's name. 00771 * @param pkg a pointer to package 00772 * @return a reference to an internal string 00773 */ 00774 const char *alpm_pkg_get_packager(alpm_pkg_t *pkg); 00775 00776 /** Returns the package's MD5 checksum as a string. 00777 * The returned string is a sequence of 32 lowercase hexadecimal digits. 00778 * @param pkg a pointer to package 00779 * @return a reference to an internal string 00780 */ 00781 const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg); 00782 00783 /** Returns the package's SHA256 checksum as a string. 00784 * The returned string is a sequence of 64 lowercase hexadecimal digits. 00785 * @param pkg a pointer to package 00786 * @return a reference to an internal string 00787 */ 00788 const char *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg); 00789 00790 /** Returns the architecture for which the package was built. 00791 * @param pkg a pointer to package 00792 * @return a reference to an internal string 00793 */ 00794 const char *alpm_pkg_get_arch(alpm_pkg_t *pkg); 00795 00796 /** Returns the size of the package. This is only available for sync database 00797 * packages and package files, not those loaded from the local database. 00798 * @param pkg a pointer to package 00799 * @return the size of the package in bytes. 00800 */ 00801 off_t alpm_pkg_get_size(alpm_pkg_t *pkg); 00802 00803 /** Returns the installed size of the package. 00804 * @param pkg a pointer to package 00805 * @return the total size of files installed by the package. 00806 */ 00807 off_t alpm_pkg_get_isize(alpm_pkg_t *pkg); 00808 00809 /** Returns the package installation reason. 00810 * @param pkg a pointer to package 00811 * @return an enum member giving the install reason. 00812 */ 00813 alpm_pkgreason_t alpm_pkg_get_reason(alpm_pkg_t *pkg); 00814 00815 /** Returns the list of package licenses. 00816 * @param pkg a pointer to package 00817 * @return a pointer to an internal list of strings. 00818 */ 00819 alpm_list_t *alpm_pkg_get_licenses(alpm_pkg_t *pkg); 00820 00821 /** Returns the list of package groups. 00822 * @param pkg a pointer to package 00823 * @return a pointer to an internal list of strings. 00824 */ 00825 alpm_list_t *alpm_pkg_get_groups(alpm_pkg_t *pkg); 00826 00827 /** Returns the list of package dependencies as alpm_depend_t. 00828 * @param pkg a pointer to package 00829 * @return a reference to an internal list of alpm_depend_t structures. 00830 */ 00831 alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg); 00832 00833 /** Returns the list of package optional dependencies. 00834 * @param pkg a pointer to package 00835 * @return a reference to an internal list of strings. 00836 */ 00837 alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg); 00838 00839 /** Returns the list of packages conflicting with pkg. 00840 * @param pkg a pointer to package 00841 * @return a reference to an internal list of alpm_depend_t structures. 00842 */ 00843 alpm_list_t *alpm_pkg_get_conflicts(alpm_pkg_t *pkg); 00844 00845 /** Returns the list of packages provided by pkg. 00846 * @param pkg a pointer to package 00847 * @return a reference to an internal list of alpm_depend_t structures. 00848 */ 00849 alpm_list_t *alpm_pkg_get_provides(alpm_pkg_t *pkg); 00850 00851 /** Returns the list of available deltas for pkg. 00852 * @param pkg a pointer to package 00853 * @return a reference to an internal list of strings. 00854 */ 00855 alpm_list_t *alpm_pkg_get_deltas(alpm_pkg_t *pkg); 00856 00857 /** Returns the list of packages to be replaced by pkg. 00858 * @param pkg a pointer to package 00859 * @return a reference to an internal list of alpm_depend_t structures. 00860 */ 00861 alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg); 00862 00863 /** Returns the list of files installed by pkg. 00864 * The filenames are relative to the install root, 00865 * and do not include leading slashes. 00866 * @param pkg a pointer to package 00867 * @return a pointer to a filelist object containing a count and an array of 00868 * package file objects 00869 */ 00870 alpm_filelist_t *alpm_pkg_get_files(alpm_pkg_t *pkg); 00871 00872 /** Returns the list of files backed up when installing pkg. 00873 * The elements of the returned list have the form 00874 * "<filename>\t<md5sum>", where the given md5sum is that of 00875 * the file as provided by the package. 00876 * @param pkg a pointer to package 00877 * @return a reference to an internal list of strings. 00878 */ 00879 alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg); 00880 00881 /** Returns the database containing pkg. 00882 * Returns a pointer to the alpm_db_t structure the package is 00883 * originating from, or NULL if the package was loaded from a file. 00884 * @param pkg a pointer to package 00885 * @return a pointer to the DB containing pkg, or NULL. 00886 */ 00887 alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg); 00888 00889 /** Retuns the base64 encoded package signature. 00890 * @param pkg a pointer to package 00891 * @return a reference to an internal string 00892 */ 00893 const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg); 00894 00895 /* End of alpm_pkg_t accessors */ 00896 /* @} */ 00897 00898 /** Open a package changelog for reading. 00899 * Similar to fopen in functionality, except that the returned 'file 00900 * stream' could really be from an archive as well as from the database. 00901 * @param pkg the package to read the changelog of (either file or db) 00902 * @return a 'file stream' to the package changelog 00903 */ 00904 void *alpm_pkg_changelog_open(alpm_pkg_t *pkg); 00905 00906 /** Read data from an open changelog 'file stream'. 00907 * Similar to fread in functionality, this function takes a buffer and 00908 * amount of data to read. If an error occurs pm_errno will be set. 00909 * @param ptr a buffer to fill with raw changelog data 00910 * @param size the size of the buffer 00911 * @param pkg the package that the changelog is being read from 00912 * @param fp a 'file stream' to the package changelog 00913 * @return the number of characters read, or 0 if there is no more data or an 00914 * error occurred. 00915 */ 00916 size_t alpm_pkg_changelog_read(void *ptr, size_t size, 00917 const alpm_pkg_t *pkg, void *fp); 00918 00919 int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp); 00920 00921 /** Returns whether the package has an install scriptlet. 00922 * @return 0 if FALSE, TRUE otherwise 00923 */ 00924 int alpm_pkg_has_scriptlet(alpm_pkg_t *pkg); 00925 00926 /** Returns the size of download. 00927 * Returns the size of the files that will be downloaded to install a 00928 * package. 00929 * @param newpkg the new package to upgrade to 00930 * @return the size of the download 00931 */ 00932 off_t alpm_pkg_download_size(alpm_pkg_t *newpkg); 00933 00934 alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg); 00935 00936 /* End of alpm_pkg */ 00937 /** @} */ 00938 00939 /* 00940 * Signatures 00941 */ 00942 00943 int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist); 00944 00945 int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist); 00946 00947 int alpm_siglist_cleanup(alpm_siglist_t *siglist); 00948 00949 /* 00950 * Groups 00951 */ 00952 00953 alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name); 00954 00955 /* 00956 * Sync 00957 */ 00958 00959 alpm_pkg_t *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync); 00960 00961 /** @addtogroup alpm_api_trans Transaction Functions 00962 * Functions to manipulate libalpm transactions 00963 * @{ 00964 */ 00965 00966 /** Transaction flags */ 00967 typedef enum _alpm_transflag_t { 00968 /** Ignore dependency checks. */ 00969 ALPM_TRANS_FLAG_NODEPS = 1, 00970 /** Ignore file conflicts and overwrite files. */ 00971 ALPM_TRANS_FLAG_FORCE = (1 << 1), 00972 /** Delete files even if they are tagged as backup. */ 00973 ALPM_TRANS_FLAG_NOSAVE = (1 << 2), 00974 /** Ignore version numbers when checking dependencies. */ 00975 ALPM_TRANS_FLAG_NODEPVERSION = (1 << 3), 00976 /** Remove also any packages depending on a package being removed. */ 00977 ALPM_TRANS_FLAG_CASCADE = (1 << 4), 00978 /** Remove packages and their unneeded deps (not explicitly installed). */ 00979 ALPM_TRANS_FLAG_RECURSE = (1 << 5), 00980 /** Modify database but do not commit changes to the filesystem. */ 00981 ALPM_TRANS_FLAG_DBONLY = (1 << 6), 00982 /* (1 << 7) flag can go here */ 00983 /** Use ALPM_PKG_REASON_DEPEND when installing packages. */ 00984 ALPM_TRANS_FLAG_ALLDEPS = (1 << 8), 00985 /** Only download packages and do not actually install. */ 00986 ALPM_TRANS_FLAG_DOWNLOADONLY = (1 << 9), 00987 /** Do not execute install scriptlets after installing. */ 00988 ALPM_TRANS_FLAG_NOSCRIPTLET = (1 << 10), 00989 /** Ignore dependency conflicts. */ 00990 ALPM_TRANS_FLAG_NOCONFLICTS = (1 << 11), 00991 /* (1 << 12) flag can go here */ 00992 /** Do not install a package if it is already installed and up to date. */ 00993 ALPM_TRANS_FLAG_NEEDED = (1 << 13), 00994 /** Use ALPM_PKG_REASON_EXPLICIT when installing packages. */ 00995 ALPM_TRANS_FLAG_ALLEXPLICIT = (1 << 14), 00996 /** Do not remove a package if it is needed by another one. */ 00997 ALPM_TRANS_FLAG_UNNEEDED = (1 << 15), 00998 /** Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE). */ 00999 ALPM_TRANS_FLAG_RECURSEALL = (1 << 16), 01000 /** Do not lock the database during the operation. */ 01001 ALPM_TRANS_FLAG_NOLOCK = (1 << 17) 01002 } alpm_transflag_t; 01003 01004 /** Returns the bitfield of flags for the current transaction. 01005 * @param handle the context handle 01006 * @return the bitfield of transaction flags 01007 */ 01008 alpm_transflag_t alpm_trans_get_flags(alpm_handle_t *handle); 01009 01010 /** Returns a list of packages added by the transaction. 01011 * @param handle the context handle 01012 * @return a list of alpm_pkg_t structures 01013 */ 01014 alpm_list_t *alpm_trans_get_add(alpm_handle_t *handle); 01015 01016 /** Returns the list of packages removed by the transaction. 01017 * @param handle the context handle 01018 * @return a list of alpm_pkg_t structures 01019 */ 01020 alpm_list_t *alpm_trans_get_remove(alpm_handle_t *handle); 01021 01022 /** Initialize the transaction. 01023 * @param handle the context handle 01024 * @param flags flags of the transaction (like nodeps, etc) 01025 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01026 */ 01027 int alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags); 01028 01029 /** Prepare a transaction. 01030 * @param handle the context handle 01031 * @param data the address of an alpm_list where a list 01032 * of alpm_depmissing_t objects is dumped (conflicting packages) 01033 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01034 */ 01035 int alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data); 01036 01037 /** Commit a transaction. 01038 * @param handle the context handle 01039 * @param data the address of an alpm_list where detailed description 01040 * of an error can be dumped (ie. list of conflicting files) 01041 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01042 */ 01043 int alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data); 01044 01045 /** Interrupt a transaction. 01046 * @param handle the context handle 01047 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01048 */ 01049 int alpm_trans_interrupt(alpm_handle_t *handle); 01050 01051 /** Release a transaction. 01052 * @param handle the context handle 01053 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01054 */ 01055 int alpm_trans_release(alpm_handle_t *handle); 01056 /** @} */ 01057 01058 /** @name Common Transactions */ 01059 /** @{ */ 01060 01061 /** Search for packages to upgrade and add them to the transaction. 01062 * @param handle the context handle 01063 * @param enable_downgrade allow downgrading of packages if the remote version is lower 01064 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01065 */ 01066 int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade); 01067 01068 /** Add a package to the transaction. 01069 * If the package was loaded by alpm_pkg_load(), it will be freed upon 01070 * alpm_trans_release() invocation. 01071 * @param handle the context handle 01072 * @param pkg the package to add 01073 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01074 */ 01075 int alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg); 01076 01077 /** Add a package removal action to the transaction. 01078 * @param handle the context handle 01079 * @param pkg the package to uninstall 01080 * @return 0 on success, -1 on error (pm_errno is set accordingly) 01081 */ 01082 int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg); 01083 01084 /** @} */ 01085 01086 /** @addtogroup alpm_api_depends Dependency Functions 01087 * Functions dealing with libalpm representation of dependency 01088 * information. 01089 * @{ 01090 */ 01091 01092 alpm_list_t *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglist, 01093 alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps); 01094 alpm_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring); 01095 alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *handle, 01096 alpm_list_t *dbs, const char *depstring); 01097 01098 alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist); 01099 01100 /** Returns a newly allocated string representing the dependency information. 01101 * @param dep a dependency info structure 01102 * @return a formatted string, e.g. "glibc>=2.12" 01103 */ 01104 char *alpm_dep_compute_string(const alpm_depend_t *dep); 01105 01106 /** @} */ 01107 01108 /** @} */ 01109 01110 /* 01111 * Helpers 01112 */ 01113 01114 /* checksums */ 01115 char *alpm_compute_md5sum(const char *name); 01116 char *alpm_compute_sha256sum(const char *filename); 01117 01118 /** @addtogroup alpm_api_errors Error Codes 01119 * @{ 01120 */ 01121 typedef enum _alpm_errno_t { 01122 ALPM_ERR_MEMORY = 1, 01123 ALPM_ERR_SYSTEM, 01124 ALPM_ERR_BADPERMS, 01125 ALPM_ERR_NOT_A_FILE, 01126 ALPM_ERR_NOT_A_DIR, 01127 ALPM_ERR_WRONG_ARGS, 01128 ALPM_ERR_DISK_SPACE, 01129 /* Interface */ 01130 ALPM_ERR_HANDLE_NULL, 01131 ALPM_ERR_HANDLE_NOT_NULL, 01132 ALPM_ERR_HANDLE_LOCK, 01133 /* Databases */ 01134 ALPM_ERR_DB_OPEN, 01135 ALPM_ERR_DB_CREATE, 01136 ALPM_ERR_DB_NULL, 01137 ALPM_ERR_DB_NOT_NULL, 01138 ALPM_ERR_DB_NOT_FOUND, 01139 ALPM_ERR_DB_INVALID, 01140 ALPM_ERR_DB_INVALID_SIG, 01141 ALPM_ERR_DB_VERSION, 01142 ALPM_ERR_DB_WRITE, 01143 ALPM_ERR_DB_REMOVE, 01144 /* Servers */ 01145 ALPM_ERR_SERVER_BAD_URL, 01146 ALPM_ERR_SERVER_NONE, 01147 /* Transactions */ 01148 ALPM_ERR_TRANS_NOT_NULL, 01149 ALPM_ERR_TRANS_NULL, 01150 ALPM_ERR_TRANS_DUP_TARGET, 01151 ALPM_ERR_TRANS_NOT_INITIALIZED, 01152 ALPM_ERR_TRANS_NOT_PREPARED, 01153 ALPM_ERR_TRANS_ABORT, 01154 ALPM_ERR_TRANS_TYPE, 01155 ALPM_ERR_TRANS_NOT_LOCKED, 01156 /* Packages */ 01157 ALPM_ERR_PKG_NOT_FOUND, 01158 ALPM_ERR_PKG_IGNORED, 01159 ALPM_ERR_PKG_INVALID, 01160 ALPM_ERR_PKG_INVALID_CHECKSUM, 01161 ALPM_ERR_PKG_INVALID_SIG, 01162 ALPM_ERR_PKG_OPEN, 01163 ALPM_ERR_PKG_CANT_REMOVE, 01164 ALPM_ERR_PKG_INVALID_NAME, 01165 ALPM_ERR_PKG_INVALID_ARCH, 01166 ALPM_ERR_PKG_REPO_NOT_FOUND, 01167 /* Signatures */ 01168 ALPM_ERR_SIG_MISSING, 01169 ALPM_ERR_SIG_INVALID, 01170 /* Deltas */ 01171 ALPM_ERR_DLT_INVALID, 01172 ALPM_ERR_DLT_PATCHFAILED, 01173 /* Dependencies */ 01174 ALPM_ERR_UNSATISFIED_DEPS, 01175 ALPM_ERR_CONFLICTING_DEPS, 01176 ALPM_ERR_FILE_CONFLICTS, 01177 /* Misc */ 01178 ALPM_ERR_RETRIEVE, 01179 ALPM_ERR_INVALID_REGEX, 01180 /* External library errors */ 01181 ALPM_ERR_LIBARCHIVE, 01182 ALPM_ERR_LIBCURL, 01183 ALPM_ERR_EXTERNAL_DOWNLOAD, 01184 ALPM_ERR_GPGME 01185 } alpm_errno_t; 01186 01187 /** Returns the current error code from the handle. */ 01188 alpm_errno_t alpm_errno(alpm_handle_t *handle); 01189 01190 /** Returns the string corresponding to an error number. */ 01191 const char *alpm_strerror(alpm_errno_t err); 01192 01193 /* End of alpm_api_errors */ 01194 /** @} */ 01195 01196 alpm_handle_t *alpm_initialize(const char *root, const char *dbpath, 01197 alpm_errno_t *err); 01198 int alpm_release(alpm_handle_t *handle); 01199 01200 enum alpm_caps { 01201 ALPM_CAPABILITY_NLS = (1 << 0), 01202 ALPM_CAPABILITY_DOWNLOADER = (1 << 1), 01203 ALPM_CAPABILITY_SIGNATURES = (1 << 2) 01204 }; 01205 01206 const char *alpm_version(void); 01207 enum alpm_caps alpm_capabilities(void); 01208 01209 /* End of alpm_api */ 01210 /** @} */ 01211 01212 #ifdef __cplusplus 01213 } 01214 #endif 01215 #endif /* _ALPM_H */ 01216 01217 /* vim: set ts=2 sw=2 noet: */