4 * Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
6 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
7 * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
8 * Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 #include <stdint.h> /* int64_t */
31 #include <sys/types.h> /* off_t */
32 #include <stdarg.h> /* va_list */
36 #include <archive_entry.h>
38 #include <alpm_list.h>
41 * Arch Linux Package Management library
44 /** @addtogroup alpm_api Public API
45 * The libalpm Public API
49 typedef int64_t alpm_time_t
;
53 * These ones are used in multiple contexts, so are forward-declared.
56 /** Package install reasons. */
57 typedef enum _alpm_pkgreason_t
{
58 /** Explicitly requested by the user. */
59 ALPM_PKG_REASON_EXPLICIT
= 0,
60 /** Installed as a dependency for another package. */
61 ALPM_PKG_REASON_DEPEND
= 1
64 /** Location a package object was loaded from. */
65 typedef enum _alpm_pkgfrom_t
{
66 ALPM_PKG_FROM_FILE
= 1,
67 ALPM_PKG_FROM_LOCALDB
,
71 /** Method used to validate a package. */
72 typedef enum _alpm_pkgvalidation_t
{
73 ALPM_PKG_VALIDATION_UNKNOWN
= 0,
74 ALPM_PKG_VALIDATION_NONE
= (1 << 0),
75 ALPM_PKG_VALIDATION_MD5SUM
= (1 << 1),
76 ALPM_PKG_VALIDATION_SHA256SUM
= (1 << 2),
77 ALPM_PKG_VALIDATION_SIGNATURE
= (1 << 3)
78 } alpm_pkgvalidation_t
;
80 /** Types of version constraints in dependency specs. */
81 typedef enum _alpm_depmod_t
{
82 /** No version constraint */
84 /** Test version equality (package=x.y.z) */
86 /** Test for at least a version (package>=x.y.z) */
88 /** Test for at most a version (package<=x.y.z) */
90 /** Test for greater than some version (package>x.y.z) */
92 /** Test for less than some version (package<x.y.z) */
98 * Whether the conflict results from a file existing on the filesystem, or with
99 * another target in the transaction.
101 typedef enum _alpm_fileconflicttype_t
{
102 ALPM_FILECONFLICT_TARGET
= 1,
103 ALPM_FILECONFLICT_FILESYSTEM
104 } alpm_fileconflicttype_t
;
106 /** PGP signature verification options */
107 typedef enum _alpm_siglevel_t
{
108 ALPM_SIG_PACKAGE
= (1 << 0),
109 ALPM_SIG_PACKAGE_OPTIONAL
= (1 << 1),
110 ALPM_SIG_PACKAGE_MARGINAL_OK
= (1 << 2),
111 ALPM_SIG_PACKAGE_UNKNOWN_OK
= (1 << 3),
113 ALPM_SIG_DATABASE
= (1 << 10),
114 ALPM_SIG_DATABASE_OPTIONAL
= (1 << 11),
115 ALPM_SIG_DATABASE_MARGINAL_OK
= (1 << 12),
116 ALPM_SIG_DATABASE_UNKNOWN_OK
= (1 << 13),
118 ALPM_SIG_PACKAGE_SET
= (1 << 27),
119 ALPM_SIG_PACKAGE_TRUST_SET
= (1 << 28),
121 ALPM_SIG_USE_DEFAULT
= (1 << 31)
124 /** PGP signature verification status return codes */
125 typedef enum _alpm_sigstatus_t
{
126 ALPM_SIGSTATUS_VALID
,
127 ALPM_SIGSTATUS_KEY_EXPIRED
,
128 ALPM_SIGSTATUS_SIG_EXPIRED
,
129 ALPM_SIGSTATUS_KEY_UNKNOWN
,
130 ALPM_SIGSTATUS_KEY_DISABLED
,
131 ALPM_SIGSTATUS_INVALID
134 /** PGP signature verification status return codes */
135 typedef enum _alpm_sigvalidity_t
{
136 ALPM_SIGVALIDITY_FULL
,
137 ALPM_SIGVALIDITY_MARGINAL
,
138 ALPM_SIGVALIDITY_NEVER
,
139 ALPM_SIGVALIDITY_UNKNOWN
140 } alpm_sigvalidity_t
;
146 typedef struct __alpm_handle_t alpm_handle_t
;
147 typedef struct __alpm_db_t alpm_db_t
;
148 typedef struct __alpm_pkg_t alpm_pkg_t
;
149 typedef struct __alpm_trans_t alpm_trans_t
;
152 typedef struct _alpm_depend_t
{
156 unsigned long name_hash
;
160 /** Missing dependency */
161 typedef struct _alpm_depmissing_t
{
163 alpm_depend_t
*depend
;
164 /* this is used only in the case of a remove dependency error */
169 typedef struct _alpm_conflict_t
{
170 unsigned long package1_hash
;
171 unsigned long package2_hash
;
174 alpm_depend_t
*reason
;
178 typedef struct _alpm_fileconflict_t
{
180 alpm_fileconflicttype_t type
;
183 } alpm_fileconflict_t
;
186 typedef struct _alpm_group_t
{
189 /** list of alpm_pkg_t packages */
190 alpm_list_t
*packages
;
193 /** Package upgrade delta */
194 typedef struct _alpm_delta_t
{
195 /** filename of the delta patch */
197 /** md5sum of the delta file */
199 /** filename of the 'before' file */
201 /** filename of the 'after' file */
203 /** filesize of the delta file */
205 /** download filesize of the delta file */
209 /** File in a package */
210 typedef struct _alpm_file_t
{
216 /** Package filelist container */
217 typedef struct _alpm_filelist_t
{
222 /** Local package or package file backup entry */
223 typedef struct _alpm_backup_t
{
228 typedef struct _alpm_pgpkey_t
{
237 unsigned int revoked
;
242 * Signature result. Contains the key, status, and validity of a given
245 typedef struct _alpm_sigresult_t
{
247 alpm_sigstatus_t status
;
248 alpm_sigvalidity_t validity
;
252 * Signature list. Contains the number of signatures found and a pointer to an
253 * array of results. The array is of size count.
255 typedef struct _alpm_siglist_t
{
257 alpm_sigresult_t
*results
;
264 /** Logging Levels */
265 typedef enum _alpm_loglevel_t
{
267 ALPM_LOG_WARNING
= (1 << 1),
268 ALPM_LOG_DEBUG
= (1 << 2),
269 ALPM_LOG_FUNCTION
= (1 << 3)
272 typedef void (*alpm_cb_log
)(alpm_loglevel_t
, const char *, va_list);
274 int alpm_logaction(alpm_handle_t
*handle
, const char *prefix
,
275 const char *fmt
, ...) __attribute__((format(printf
, 3, 4)));
279 * NULL parameters are passed to in all events unless specified otherwise.
281 typedef enum _alpm_event_t
{
282 /** Dependencies will be computed for a package. */
283 ALPM_EVENT_CHECKDEPS_START
= 1,
284 /** Dependencies were computed for a package. */
285 ALPM_EVENT_CHECKDEPS_DONE
,
286 /** File conflicts will be computed for a package. */
287 ALPM_EVENT_FILECONFLICTS_START
,
288 /** File conflicts were computed for a package. */
289 ALPM_EVENT_FILECONFLICTS_DONE
,
290 /** Dependencies will be resolved for target package. */
291 ALPM_EVENT_RESOLVEDEPS_START
,
292 /** Dependencies were resolved for target package. */
293 ALPM_EVENT_RESOLVEDEPS_DONE
,
294 /** Inter-conflicts will be checked for target package. */
295 ALPM_EVENT_INTERCONFLICTS_START
,
296 /** Inter-conflicts were checked for target package. */
297 ALPM_EVENT_INTERCONFLICTS_DONE
,
298 /** Package will be installed.
299 * A pointer to the target package is passed to the callback.
301 ALPM_EVENT_ADD_START
,
302 /** Package was installed.
303 * A pointer to the new package is passed to the callback.
306 /** Package will be removed.
307 * A pointer to the target package is passed to the callback.
309 ALPM_EVENT_REMOVE_START
,
310 /** Package was removed.
311 * A pointer to the removed package is passed to the callback.
313 ALPM_EVENT_REMOVE_DONE
,
314 /** Package will be upgraded.
315 * A pointer to the upgraded package is passed to the callback.
317 ALPM_EVENT_UPGRADE_START
,
318 /** Package was upgraded.
319 * A pointer to the new package, and a pointer to the old package is passed
320 * to the callback, respectively.
322 ALPM_EVENT_UPGRADE_DONE
,
323 /** Package will be downgraded.
324 * A pointer to the downgraded package is passed to the callback.
326 ALPM_EVENT_DOWNGRADE_START
,
327 /** Package was downgraded.
328 * A pointer to the new package, and a pointer to the old package is passed
329 * to the callback, respectively.
331 ALPM_EVENT_DOWNGRADE_DONE
,
332 /** Package will be reinstalled.
333 * A pointer to the reinstalled package is passed to the callback.
335 ALPM_EVENT_REINSTALL_START
,
336 /** Package was reinstalled.
337 * A pointer to the new package, and a pointer to the old package is passed
338 * to the callback, respectively.
340 ALPM_EVENT_REINSTALL_DONE
,
341 /** Target package's integrity will be checked. */
342 ALPM_EVENT_INTEGRITY_START
,
343 /** Target package's integrity was checked. */
344 ALPM_EVENT_INTEGRITY_DONE
,
345 /** Target package will be loaded. */
346 ALPM_EVENT_LOAD_START
,
347 /** Target package is finished loading. */
348 ALPM_EVENT_LOAD_DONE
,
349 /** Target delta's integrity will be checked. */
350 ALPM_EVENT_DELTA_INTEGRITY_START
,
351 /** Target delta's integrity was checked. */
352 ALPM_EVENT_DELTA_INTEGRITY_DONE
,
353 /** Deltas will be applied to packages. */
354 ALPM_EVENT_DELTA_PATCHES_START
,
355 /** Deltas were applied to packages. */
356 ALPM_EVENT_DELTA_PATCHES_DONE
,
357 /** Delta patch will be applied to target package.
358 * The filename of the package and the filename of the patch is passed to the
361 ALPM_EVENT_DELTA_PATCH_START
,
362 /** Delta patch was applied to target package. */
363 ALPM_EVENT_DELTA_PATCH_DONE
,
364 /** Delta patch failed to apply to target package. */
365 ALPM_EVENT_DELTA_PATCH_FAILED
,
366 /** Scriptlet has printed information.
367 * A line of text is passed to the callback.
369 ALPM_EVENT_SCRIPTLET_INFO
,
370 /** Files will be downloaded from a repository.
371 * The repository's tree name is passed to the callback.
373 ALPM_EVENT_RETRIEVE_START
,
374 /** Disk space usage will be computed for a package */
375 ALPM_EVENT_DISKSPACE_START
,
376 /** Disk space usage was computed for a package */
377 ALPM_EVENT_DISKSPACE_DONE
,
378 /** An optdepend for another package is being removed
379 * The requiring package and its dependency are passed to the callback */
380 ALPM_EVENT_OPTDEP_REQUIRED
,
381 /** A configured repository database is missing */
382 ALPM_EVENT_DATABASE_MISSING
,
383 /** Checking keys used to create signatures are in keyring. */
384 ALPM_EVENT_KEYRING_START
,
385 /** Keyring checking is finished. */
386 ALPM_EVENT_KEYRING_DONE
,
387 /** Downloading missing keys into keyring. */
388 ALPM_EVENT_KEY_DOWNLOAD_START
,
389 /** Key downloading is finished. */
390 ALPM_EVENT_KEY_DOWNLOAD_DONE
393 /** Event callback */
394 typedef void (*alpm_cb_event
)(alpm_event_t
, void *, void *);
398 * Unlike the events or progress enumerations, this enum has bitmask values
399 * so a frontend can use a bitmask map to supply preselected answers to the
400 * different types of questions.
402 typedef enum _alpm_question_t
{
403 ALPM_QUESTION_INSTALL_IGNOREPKG
= 1,
404 ALPM_QUESTION_REPLACE_PKG
= (1 << 1),
405 ALPM_QUESTION_CONFLICT_PKG
= (1 << 2),
406 ALPM_QUESTION_CORRUPTED_PKG
= (1 << 3),
407 ALPM_QUESTION_REMOVE_PKGS
= (1 << 4),
408 ALPM_QUESTION_SELECT_PROVIDER
= (1 << 5),
409 ALPM_QUESTION_IMPORT_KEY
= (1 << 6)
412 /** Question callback */
413 typedef void (*alpm_cb_question
)(alpm_question_t
, void *, void *, void *, int *);
416 typedef enum _alpm_progress_t
{
417 ALPM_PROGRESS_ADD_START
,
418 ALPM_PROGRESS_UPGRADE_START
,
419 ALPM_PROGRESS_DOWNGRADE_START
,
420 ALPM_PROGRESS_REINSTALL_START
,
421 ALPM_PROGRESS_REMOVE_START
,
422 ALPM_PROGRESS_CONFLICTS_START
,
423 ALPM_PROGRESS_DISKSPACE_START
,
424 ALPM_PROGRESS_INTEGRITY_START
,
425 ALPM_PROGRESS_LOAD_START
,
426 ALPM_PROGRESS_KEYRING_START
429 /** Progress callback */
430 typedef void (*alpm_cb_progress
)(alpm_progress_t
, const char *, int, size_t, size_t);
436 /** Type of download progress callbacks.
437 * @param filename the name of the file being downloaded
438 * @param xfered the number of transferred bytes
439 * @param total the total number of bytes to transfer
441 typedef void (*alpm_cb_download
)(const char *filename
,
442 off_t xfered
, off_t total
);
444 typedef void (*alpm_cb_totaldl
)(off_t total
);
446 /** A callback for downloading files
447 * @param url the URL of the file to be downloaded
448 * @param localpath the directory to which the file should be downloaded
449 * @param force whether to force an update, even if the file is the same
450 * @return 0 on success, 1 if the file exists and is identical, -1 on
453 typedef int (*alpm_cb_fetch
)(const char *url
, const char *localpath
,
456 /** Fetch a remote pkg.
457 * @param handle the context handle
458 * @param url URL of the package to download
459 * @return the downloaded filepath on success, NULL on error
461 char *alpm_fetch_pkgurl(alpm_handle_t
*handle
, const char *url
);
463 /** @addtogroup alpm_api_options Options
464 * Libalpm option getters and setters
468 /** Returns the callback used for logging. */
469 alpm_cb_log
alpm_option_get_logcb(alpm_handle_t
*handle
);
470 /** Sets the callback used for logging. */
471 int alpm_option_set_logcb(alpm_handle_t
*handle
, alpm_cb_log cb
);
473 /** Returns the callback used to report download progress. */
474 alpm_cb_download
alpm_option_get_dlcb(alpm_handle_t
*handle
);
475 /** Sets the callback used to report download progress. */
476 int alpm_option_set_dlcb(alpm_handle_t
*handle
, alpm_cb_download cb
);
478 /** Returns the downloading callback. */
479 alpm_cb_fetch
alpm_option_get_fetchcb(alpm_handle_t
*handle
);
480 /** Sets the downloading callback. */
481 int alpm_option_set_fetchcb(alpm_handle_t
*handle
, alpm_cb_fetch cb
);
483 /** Returns the callback used to report total download size. */
484 alpm_cb_totaldl
alpm_option_get_totaldlcb(alpm_handle_t
*handle
);
485 /** Sets the callback used to report total download size. */
486 int alpm_option_set_totaldlcb(alpm_handle_t
*handle
, alpm_cb_totaldl cb
);
488 /** Returns the callback used for events. */
489 alpm_cb_event
alpm_option_get_eventcb(alpm_handle_t
*handle
);
490 /** Sets the callback used for events. */
491 int alpm_option_set_eventcb(alpm_handle_t
*handle
, alpm_cb_event cb
);
493 /** Returns the callback used for questions. */
494 alpm_cb_question
alpm_option_get_questioncb(alpm_handle_t
*handle
);
495 /** Sets the callback used for questions. */
496 int alpm_option_set_questioncb(alpm_handle_t
*handle
, alpm_cb_question cb
);
498 /** Returns the callback used for operation progress. */
499 alpm_cb_progress
alpm_option_get_progresscb(alpm_handle_t
*handle
);
500 /** Sets the callback used for operation progress. */
501 int alpm_option_set_progresscb(alpm_handle_t
*handle
, alpm_cb_progress cb
);
503 /** Returns the root of the destination filesystem. Read-only. */
504 const char *alpm_option_get_root(alpm_handle_t
*handle
);
506 /** Returns the path to the database directory. Read-only. */
507 const char *alpm_option_get_dbpath(alpm_handle_t
*handle
);
509 /** Get the name of the database lock file. Read-only. */
510 const char *alpm_option_get_lockfile(alpm_handle_t
*handle
);
512 /** @name Accessors to the list of package cache directories.
515 alpm_list_t
*alpm_option_get_cachedirs(alpm_handle_t
*handle
);
516 int alpm_option_set_cachedirs(alpm_handle_t
*handle
, alpm_list_t
*cachedirs
);
517 int alpm_option_add_cachedir(alpm_handle_t
*handle
, const char *cachedir
);
518 int alpm_option_remove_cachedir(alpm_handle_t
*handle
, const char *cachedir
);
521 /** Returns the logfile name. */
522 const char *alpm_option_get_logfile(alpm_handle_t
*handle
);
523 /** Sets the logfile name. */
524 int alpm_option_set_logfile(alpm_handle_t
*handle
, const char *logfile
);
526 /** Returns the path to libalpm's GnuPG home directory. */
527 const char *alpm_option_get_gpgdir(alpm_handle_t
*handle
);
528 /** Sets the path to libalpm's GnuPG home directory. */
529 int alpm_option_set_gpgdir(alpm_handle_t
*handle
, const char *gpgdir
);
531 /** Returns whether to use syslog (0 is FALSE, TRUE otherwise). */
532 int alpm_option_get_usesyslog(alpm_handle_t
*handle
);
533 /** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */
534 int alpm_option_set_usesyslog(alpm_handle_t
*handle
, int usesyslog
);
536 /** @name Accessors to the list of no-upgrade files.
537 * These functions modify the list of files which should
538 * not be updated by package installation.
541 alpm_list_t
*alpm_option_get_noupgrades(alpm_handle_t
*handle
);
542 int alpm_option_add_noupgrade(alpm_handle_t
*handle
, const char *pkg
);
543 int alpm_option_set_noupgrades(alpm_handle_t
*handle
, alpm_list_t
*noupgrade
);
544 int alpm_option_remove_noupgrade(alpm_handle_t
*handle
, const char *pkg
);
547 /** @name Accessors to the list of no-extract files.
548 * These functions modify the list of filenames which should
549 * be skipped packages which should
550 * not be upgraded by a sysupgrade operation.
553 alpm_list_t
*alpm_option_get_noextracts(alpm_handle_t
*handle
);
554 int alpm_option_add_noextract(alpm_handle_t
*handle
, const char *pkg
);
555 int alpm_option_set_noextracts(alpm_handle_t
*handle
, alpm_list_t
*noextract
);
556 int alpm_option_remove_noextract(alpm_handle_t
*handle
, const char *pkg
);
559 /** @name Accessors to the list of ignored packages.
560 * These functions modify the list of packages that
561 * should be ignored by a sysupgrade.
564 alpm_list_t
*alpm_option_get_ignorepkgs(alpm_handle_t
*handle
);
565 int alpm_option_add_ignorepkg(alpm_handle_t
*handle
, const char *pkg
);
566 int alpm_option_set_ignorepkgs(alpm_handle_t
*handle
, alpm_list_t
*ignorepkgs
);
567 int alpm_option_remove_ignorepkg(alpm_handle_t
*handle
, const char *pkg
);
570 /** @name Accessors to the list of ignored groups.
571 * These functions modify the list of groups whose packages
572 * should be ignored by a sysupgrade.
575 alpm_list_t
*alpm_option_get_ignoregroups(alpm_handle_t
*handle
);
576 int alpm_option_add_ignoregroup(alpm_handle_t
*handle
, const char *grp
);
577 int alpm_option_set_ignoregroups(alpm_handle_t
*handle
, alpm_list_t
*ignoregrps
);
578 int alpm_option_remove_ignoregroup(alpm_handle_t
*handle
, const char *grp
);
581 /** Returns the targeted architecture. */
582 const char *alpm_option_get_arch(alpm_handle_t
*handle
);
583 /** Sets the targeted architecture. */
584 int alpm_option_set_arch(alpm_handle_t
*handle
, const char *arch
);
586 double alpm_option_get_deltaratio(alpm_handle_t
*handle
);
587 int alpm_option_set_deltaratio(alpm_handle_t
*handle
, double ratio
);
589 int alpm_option_get_checkspace(alpm_handle_t
*handle
);
590 int alpm_option_set_checkspace(alpm_handle_t
*handle
, int checkspace
);
592 alpm_siglevel_t
alpm_option_get_default_siglevel(alpm_handle_t
*handle
);
593 int alpm_option_set_default_siglevel(alpm_handle_t
*handle
, alpm_siglevel_t level
);
595 alpm_siglevel_t
alpm_option_get_local_file_siglevel(alpm_handle_t
*handle
);
596 int alpm_option_set_local_file_siglevel(alpm_handle_t
*handle
, alpm_siglevel_t level
);
598 alpm_siglevel_t
alpm_option_get_remote_file_siglevel(alpm_handle_t
*handle
);
599 int alpm_option_set_remote_file_siglevel(alpm_handle_t
*handle
, alpm_siglevel_t level
);
603 /** @addtogroup alpm_api_databases Database Functions
604 * Functions to query and manipulate the database of libalpm.
608 /** Get the database of locally installed packages.
609 * The returned pointer points to an internal structure
610 * of libalpm which should only be manipulated through
612 * @return a reference to the local database
614 alpm_db_t
*alpm_get_localdb(alpm_handle_t
*handle
);
616 /** Get the list of sync databases.
617 * Returns a list of alpm_db_t structures, one for each registered
619 * @param handle the context handle
620 * @return a reference to an internal list of alpm_db_t structures
622 alpm_list_t
*alpm_get_syncdbs(alpm_handle_t
*handle
);
624 /** Register a sync database of packages.
625 * @param handle the context handle
626 * @param treename the name of the sync repository
627 * @param level what level of signature checking to perform on the
628 * database; note that this must be a '.sig' file type verification
629 * @return an alpm_db_t* on success (the value), NULL on error
631 alpm_db_t
*alpm_register_syncdb(alpm_handle_t
*handle
, const char *treename
,
632 alpm_siglevel_t level
);
634 /** Unregister all package databases.
635 * @param handle the context handle
636 * @return 0 on success, -1 on error (pm_errno is set accordingly)
638 int alpm_unregister_all_syncdbs(alpm_handle_t
*handle
);
640 /** Unregister a package database.
641 * @param db pointer to the package database to unregister
642 * @return 0 on success, -1 on error (pm_errno is set accordingly)
644 int alpm_db_unregister(alpm_db_t
*db
);
646 /** Get the name of a package database.
647 * @param db pointer to the package database
648 * @return the name of the package database, NULL on error
650 const char *alpm_db_get_name(const alpm_db_t
*db
);
652 /** Get the signature verification level for a database.
653 * Will return the default verification level if this database is set up
654 * with ALPM_SIG_USE_DEFAULT.
655 * @param db pointer to the package database
656 * @return the signature verification level
658 alpm_siglevel_t
alpm_db_get_siglevel(alpm_db_t
*db
);
660 /** Check the validity of a database.
661 * This is most useful for sync databases and verifying signature status.
662 * If invalid, the handle error code will be set accordingly.
663 * @param db pointer to the package database
664 * @return 0 if valid, -1 if invalid (pm_errno is set accordingly)
666 int alpm_db_get_valid(alpm_db_t
*db
);
668 /** @name Accessors to the list of servers for a database.
671 alpm_list_t
*alpm_db_get_servers(const alpm_db_t
*db
);
672 int alpm_db_set_servers(alpm_db_t
*db
, alpm_list_t
*servers
);
673 int alpm_db_add_server(alpm_db_t
*db
, const char *url
);
674 int alpm_db_remove_server(alpm_db_t
*db
, const char *url
);
677 int alpm_db_update(int force
, alpm_db_t
*db
);
679 /** Get a package entry from a package database.
680 * @param db pointer to the package database to get the package from
681 * @param name of the package
682 * @return the package entry on success, NULL on error
684 alpm_pkg_t
*alpm_db_get_pkg(alpm_db_t
*db
, const char *name
);
686 /** Get the package cache of a package database.
687 * @param db pointer to the package database to get the package from
688 * @return the list of packages on success, NULL on error
690 alpm_list_t
*alpm_db_get_pkgcache(alpm_db_t
*db
);
692 /** Get a group entry from a package database.
693 * @param db pointer to the package database to get the group from
694 * @param name of the group
695 * @return the groups entry on success, NULL on error
697 alpm_group_t
*alpm_db_get_group(alpm_db_t
*db
, const char *name
);
699 /** Get the group cache of a package database.
700 * @param db pointer to the package database to get the group from
701 * @return the list of groups on success, NULL on error
703 alpm_list_t
*alpm_db_get_groupcache(alpm_db_t
*db
);
705 /** Searches a database with regular expressions.
706 * @param db pointer to the package database to search in
707 * @param needles a list of regular expressions to search for
708 * @return the list of packages matching all regular expressions on success, NULL on error
710 alpm_list_t
*alpm_db_search(alpm_db_t
*db
, const alpm_list_t
*needles
);
712 typedef enum _alpm_db_usage_
{
713 ALPM_DB_USAGE_SYNC
= 1,
714 ALPM_DB_USAGE_SEARCH
= (1 << 1),
715 ALPM_DB_USAGE_INSTALL
= (1 << 2),
716 ALPM_DB_USAGE_UPGRADE
= (1 << 3),
717 ALPM_DB_USAGE_ALL
= (1 << 4) - 1,
720 /** Sets the usage of a database.
721 * @param db pointer to the package database to set the status for
722 * @param usage a bitmask of alpm_db_usage_t values
723 * @return 0 on success, or -1 on error
725 int alpm_db_set_usage(alpm_db_t
*db
, alpm_db_usage_t usage
);
727 /** Gets the usage of a database.
728 * @param db pointer to the package database to get the status of
729 * @param usage pointer to an alpm_db_usage_t to store db's status
730 * @return 0 on success, or -1 on error
732 int alpm_db_get_usage(alpm_db_t
*db
, alpm_db_usage_t
*usage
);
736 /** @addtogroup alpm_api_packages Package Functions
737 * Functions to manipulate libalpm packages
741 /** Create a package from a file.
742 * If full is false, the archive is read only until all necessary
743 * metadata is found. If it is true, the entire archive is read, which
744 * serves as a verification of integrity and the filelist can be created.
745 * The allocated structure should be freed using alpm_pkg_free().
746 * @param handle the context handle
747 * @param filename location of the package tarball
748 * @param full whether to stop the load after metadata is read or continue
749 * through the full archive
750 * @param level what level of package signature checking to perform on the
751 * package; note that this must be a '.sig' file type verification
752 * @param pkg address of the package pointer
753 * @return 0 on success, -1 on error (pm_errno is set accordingly)
755 int alpm_pkg_load(alpm_handle_t
*handle
, const char *filename
, int full
,
756 alpm_siglevel_t level
, alpm_pkg_t
**pkg
);
758 /** Find a package in a list by name.
759 * @param haystack a list of alpm_pkg_t
760 * @param needle the package name
761 * @return a pointer to the package if found or NULL
763 alpm_pkg_t
*alpm_pkg_find(alpm_list_t
*haystack
, const char *needle
);
766 * @param pkg package pointer to free
767 * @return 0 on success, -1 on error (pm_errno is set accordingly)
769 int alpm_pkg_free(alpm_pkg_t
*pkg
);
771 /** Check the integrity (with md5) of a package from the sync cache.
772 * @param pkg package pointer
773 * @return 0 on success, -1 on error (pm_errno is set accordingly)
775 int alpm_pkg_checkmd5sum(alpm_pkg_t
*pkg
);
777 /** Compare two version strings and determine which one is 'newer'. */
778 int alpm_pkg_vercmp(const char *a
, const char *b
);
780 /** Computes the list of packages requiring a given package.
781 * The return value of this function is a newly allocated
782 * list of package names (char*), it should be freed by the caller.
783 * @param pkg a package
784 * @return the list of packages requiring pkg
786 alpm_list_t
*alpm_pkg_compute_requiredby(alpm_pkg_t
*pkg
);
788 /** Computes the list of packages optionally requiring a given package.
789 * The return value of this function is a newly allocated
790 * list of package names (char*), it should be freed by the caller.
791 * @param pkg a package
792 * @return the list of packages optionally requiring pkg
794 alpm_list_t
*alpm_pkg_compute_optionalfor(alpm_pkg_t
*pkg
);
796 /** @name Package Property Accessors
797 * Any pointer returned by these functions points to internal structures
798 * allocated by libalpm. They should not be freed nor modified in any
803 /** Gets the name of the file from which the package was loaded.
804 * @param pkg a pointer to package
805 * @return a reference to an internal string
807 const char *alpm_pkg_get_filename(alpm_pkg_t
*pkg
);
809 /** Returns the package name.
810 * @param pkg a pointer to package
811 * @return a reference to an internal string
813 const char *alpm_pkg_get_name(alpm_pkg_t
*pkg
);
815 /** Returns the package version as a string.
816 * This includes all available epoch, version, and pkgrel components. Use
817 * alpm_pkg_vercmp() to compare version strings if necessary.
818 * @param pkg a pointer to package
819 * @return a reference to an internal string
821 const char *alpm_pkg_get_version(alpm_pkg_t
*pkg
);
823 /** Returns the origin of the package.
824 * @return an alpm_pkgfrom_t constant, -1 on error
826 alpm_pkgfrom_t
alpm_pkg_get_origin(alpm_pkg_t
*pkg
);
828 /** Returns the package description.
829 * @param pkg a pointer to package
830 * @return a reference to an internal string
832 const char *alpm_pkg_get_desc(alpm_pkg_t
*pkg
);
834 /** Returns the package URL.
835 * @param pkg a pointer to package
836 * @return a reference to an internal string
838 const char *alpm_pkg_get_url(alpm_pkg_t
*pkg
);
840 /** Returns the build timestamp of the package.
841 * @param pkg a pointer to package
842 * @return the timestamp of the build time
844 alpm_time_t
alpm_pkg_get_builddate(alpm_pkg_t
*pkg
);
846 /** Returns the install timestamp of the package.
847 * @param pkg a pointer to package
848 * @return the timestamp of the install time
850 alpm_time_t
alpm_pkg_get_installdate(alpm_pkg_t
*pkg
);
852 /** Returns the packager's name.
853 * @param pkg a pointer to package
854 * @return a reference to an internal string
856 const char *alpm_pkg_get_packager(alpm_pkg_t
*pkg
);
858 /** Returns the package's MD5 checksum as a string.
859 * The returned string is a sequence of 32 lowercase hexadecimal digits.
860 * @param pkg a pointer to package
861 * @return a reference to an internal string
863 const char *alpm_pkg_get_md5sum(alpm_pkg_t
*pkg
);
865 /** Returns the package's SHA256 checksum as a string.
866 * The returned string is a sequence of 64 lowercase hexadecimal digits.
867 * @param pkg a pointer to package
868 * @return a reference to an internal string
870 const char *alpm_pkg_get_sha256sum(alpm_pkg_t
*pkg
);
872 /** Returns the architecture for which the package was built.
873 * @param pkg a pointer to package
874 * @return a reference to an internal string
876 const char *alpm_pkg_get_arch(alpm_pkg_t
*pkg
);
878 /** Returns the size of the package. This is only available for sync database
879 * packages and package files, not those loaded from the local database.
880 * @param pkg a pointer to package
881 * @return the size of the package in bytes.
883 off_t
alpm_pkg_get_size(alpm_pkg_t
*pkg
);
885 /** Returns the installed size of the package.
886 * @param pkg a pointer to package
887 * @return the total size of files installed by the package.
889 off_t
alpm_pkg_get_isize(alpm_pkg_t
*pkg
);
891 /** Returns the package installation reason.
892 * @param pkg a pointer to package
893 * @return an enum member giving the install reason.
895 alpm_pkgreason_t
alpm_pkg_get_reason(alpm_pkg_t
*pkg
);
897 /** Returns the list of package licenses.
898 * @param pkg a pointer to package
899 * @return a pointer to an internal list of strings.
901 alpm_list_t
*alpm_pkg_get_licenses(alpm_pkg_t
*pkg
);
903 /** Returns the list of package groups.
904 * @param pkg a pointer to package
905 * @return a pointer to an internal list of strings.
907 alpm_list_t
*alpm_pkg_get_groups(alpm_pkg_t
*pkg
);
909 /** Returns the list of package dependencies as alpm_depend_t.
910 * @param pkg a pointer to package
911 * @return a reference to an internal list of alpm_depend_t structures.
913 alpm_list_t
*alpm_pkg_get_depends(alpm_pkg_t
*pkg
);
915 /** Returns the list of package optional dependencies.
916 * @param pkg a pointer to package
917 * @return a reference to an internal list of alpm_depend_t structures.
919 alpm_list_t
*alpm_pkg_get_optdepends(alpm_pkg_t
*pkg
);
921 /** Returns the list of packages conflicting with pkg.
922 * @param pkg a pointer to package
923 * @return a reference to an internal list of alpm_depend_t structures.
925 alpm_list_t
*alpm_pkg_get_conflicts(alpm_pkg_t
*pkg
);
927 /** Returns the list of packages provided by pkg.
928 * @param pkg a pointer to package
929 * @return a reference to an internal list of alpm_depend_t structures.
931 alpm_list_t
*alpm_pkg_get_provides(alpm_pkg_t
*pkg
);
933 /** Returns the list of available deltas for pkg.
934 * @param pkg a pointer to package
935 * @return a reference to an internal list of strings.
937 alpm_list_t
*alpm_pkg_get_deltas(alpm_pkg_t
*pkg
);
939 /** Returns the list of packages to be replaced by pkg.
940 * @param pkg a pointer to package
941 * @return a reference to an internal list of alpm_depend_t structures.
943 alpm_list_t
*alpm_pkg_get_replaces(alpm_pkg_t
*pkg
);
945 /** Returns the list of files installed by pkg.
946 * The filenames are relative to the install root,
947 * and do not include leading slashes.
948 * @param pkg a pointer to package
949 * @return a pointer to a filelist object containing a count and an array of
950 * package file objects
952 alpm_filelist_t
*alpm_pkg_get_files(alpm_pkg_t
*pkg
);
954 /** Returns the list of files backed up when installing pkg.
955 * The elements of the returned list have the form
956 * "<filename>\t<md5sum>", where the given md5sum is that of
957 * the file as provided by the package.
958 * @param pkg a pointer to package
959 * @return a reference to a list of alpm_backup_t objects
961 alpm_list_t
*alpm_pkg_get_backup(alpm_pkg_t
*pkg
);
963 /** Returns the database containing pkg.
964 * Returns a pointer to the alpm_db_t structure the package is
965 * originating from, or NULL if the package was loaded from a file.
966 * @param pkg a pointer to package
967 * @return a pointer to the DB containing pkg, or NULL.
969 alpm_db_t
*alpm_pkg_get_db(alpm_pkg_t
*pkg
);
971 /** Returns the base64 encoded package signature.
972 * @param pkg a pointer to package
973 * @return a reference to an internal string
975 const char *alpm_pkg_get_base64_sig(alpm_pkg_t
*pkg
);
977 /** Returns the method used to validate a package during install.
978 * @param pkg a pointer to package
979 * @return an enum member giving the validation method
981 alpm_pkgvalidation_t
alpm_pkg_get_validation(alpm_pkg_t
*pkg
);
983 /* End of alpm_pkg_t accessors */
986 /** Open a package changelog for reading.
987 * Similar to fopen in functionality, except that the returned 'file
988 * stream' could really be from an archive as well as from the database.
989 * @param pkg the package to read the changelog of (either file or db)
990 * @return a 'file stream' to the package changelog
992 void *alpm_pkg_changelog_open(alpm_pkg_t
*pkg
);
994 /** Read data from an open changelog 'file stream'.
995 * Similar to fread in functionality, this function takes a buffer and
996 * amount of data to read. If an error occurs pm_errno will be set.
997 * @param ptr a buffer to fill with raw changelog data
998 * @param size the size of the buffer
999 * @param pkg the package that the changelog is being read from
1000 * @param fp a 'file stream' to the package changelog
1001 * @return the number of characters read, or 0 if there is no more data or an
1004 size_t alpm_pkg_changelog_read(void *ptr
, size_t size
,
1005 const alpm_pkg_t
*pkg
, void *fp
);
1007 int alpm_pkg_changelog_close(const alpm_pkg_t
*pkg
, void *fp
);
1009 /** Open a package mtree file for reading.
1010 * @param pkg the local package to read the changelog of
1011 * @return a archive structure for the package mtree file
1013 struct archive
*alpm_pkg_mtree_open(alpm_pkg_t
*pkg
);
1015 /** Read next entry from a package mtree file.
1016 * @param pkg the package that the mtree file is being read from
1017 * @param archive the archive structure reading from the mtree file
1018 * @param entry an archive_entry to store the entry header information
1019 * @return 0 if end of archive is reached, non-zero otherwise.
1021 int alpm_pkg_mtree_next(const alpm_pkg_t
*pkg
, struct archive
*archive
,
1022 struct archive_entry
**entry
);
1024 int alpm_pkg_mtree_close(const alpm_pkg_t
*pkg
, struct archive
*archive
);
1026 /** Returns whether the package has an install scriptlet.
1027 * @return 0 if FALSE, TRUE otherwise
1029 int alpm_pkg_has_scriptlet(alpm_pkg_t
*pkg
);
1031 /** Returns the size of download.
1032 * Returns the size of the files that will be downloaded to install a
1034 * @param newpkg the new package to upgrade to
1035 * @return the size of the download
1037 off_t
alpm_pkg_download_size(alpm_pkg_t
*newpkg
);
1039 alpm_list_t
*alpm_pkg_unused_deltas(alpm_pkg_t
*pkg
);
1041 /** Set install reason for a package in the local database.
1042 * The provided package object must be from the local database or this method
1043 * will fail. The write to the local database is performed immediately.
1044 * @param pkg the package to update
1045 * @param reason the new install reason
1046 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1048 int alpm_pkg_set_reason(alpm_pkg_t
*pkg
, alpm_pkgreason_t reason
);
1051 /* End of alpm_pkg */
1058 /** Determines whether a package filelist contains a given path.
1059 * The provided path should be relative to the install root with no leading
1060 * slashes, e.g. "etc/localtime". When searching for directories, the path must
1061 * have a trailing slash.
1062 * @param filelist a pointer to a package filelist
1063 * @param path the path to search for in the package
1064 * @return a pointer to the matching file or NULL if not found
1066 alpm_file_t
*alpm_filelist_contains(alpm_filelist_t
*filelist
, const char *path
);
1072 int alpm_pkg_check_pgp_signature(alpm_pkg_t
*pkg
, alpm_siglist_t
*siglist
);
1074 int alpm_db_check_pgp_signature(alpm_db_t
*db
, alpm_siglist_t
*siglist
);
1076 int alpm_siglist_cleanup(alpm_siglist_t
*siglist
);
1082 alpm_list_t
*alpm_find_group_pkgs(alpm_list_t
*dbs
, const char *name
);
1088 alpm_pkg_t
*alpm_sync_newversion(alpm_pkg_t
*pkg
, alpm_list_t
*dbs_sync
);
1090 /** @addtogroup alpm_api_trans Transaction Functions
1091 * Functions to manipulate libalpm transactions
1095 /** Transaction flags */
1096 typedef enum _alpm_transflag_t
{
1097 /** Ignore dependency checks. */
1098 ALPM_TRANS_FLAG_NODEPS
= 1,
1099 /** Ignore file conflicts and overwrite files. */
1100 ALPM_TRANS_FLAG_FORCE
= (1 << 1),
1101 /** Delete files even if they are tagged as backup. */
1102 ALPM_TRANS_FLAG_NOSAVE
= (1 << 2),
1103 /** Ignore version numbers when checking dependencies. */
1104 ALPM_TRANS_FLAG_NODEPVERSION
= (1 << 3),
1105 /** Remove also any packages depending on a package being removed. */
1106 ALPM_TRANS_FLAG_CASCADE
= (1 << 4),
1107 /** Remove packages and their unneeded deps (not explicitly installed). */
1108 ALPM_TRANS_FLAG_RECURSE
= (1 << 5),
1109 /** Modify database but do not commit changes to the filesystem. */
1110 ALPM_TRANS_FLAG_DBONLY
= (1 << 6),
1111 /* (1 << 7) flag can go here */
1112 /** Use ALPM_PKG_REASON_DEPEND when installing packages. */
1113 ALPM_TRANS_FLAG_ALLDEPS
= (1 << 8),
1114 /** Only download packages and do not actually install. */
1115 ALPM_TRANS_FLAG_DOWNLOADONLY
= (1 << 9),
1116 /** Do not execute install scriptlets after installing. */
1117 ALPM_TRANS_FLAG_NOSCRIPTLET
= (1 << 10),
1118 /** Ignore dependency conflicts. */
1119 ALPM_TRANS_FLAG_NOCONFLICTS
= (1 << 11),
1120 /* (1 << 12) flag can go here */
1121 /** Do not install a package if it is already installed and up to date. */
1122 ALPM_TRANS_FLAG_NEEDED
= (1 << 13),
1123 /** Use ALPM_PKG_REASON_EXPLICIT when installing packages. */
1124 ALPM_TRANS_FLAG_ALLEXPLICIT
= (1 << 14),
1125 /** Do not remove a package if it is needed by another one. */
1126 ALPM_TRANS_FLAG_UNNEEDED
= (1 << 15),
1127 /** Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE). */
1128 ALPM_TRANS_FLAG_RECURSEALL
= (1 << 16),
1129 /** Do not lock the database during the operation. */
1130 ALPM_TRANS_FLAG_NOLOCK
= (1 << 17)
1133 /** Returns the bitfield of flags for the current transaction.
1134 * @param handle the context handle
1135 * @return the bitfield of transaction flags
1137 alpm_transflag_t
alpm_trans_get_flags(alpm_handle_t
*handle
);
1139 /** Returns a list of packages added by the transaction.
1140 * @param handle the context handle
1141 * @return a list of alpm_pkg_t structures
1143 alpm_list_t
*alpm_trans_get_add(alpm_handle_t
*handle
);
1145 /** Returns the list of packages removed by the transaction.
1146 * @param handle the context handle
1147 * @return a list of alpm_pkg_t structures
1149 alpm_list_t
*alpm_trans_get_remove(alpm_handle_t
*handle
);
1151 /** Initialize the transaction.
1152 * @param handle the context handle
1153 * @param flags flags of the transaction (like nodeps, etc)
1154 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1156 int alpm_trans_init(alpm_handle_t
*handle
, alpm_transflag_t flags
);
1158 /** Prepare a transaction.
1159 * @param handle the context handle
1160 * @param data the address of an alpm_list where a list
1161 * of alpm_depmissing_t objects is dumped (conflicting packages)
1162 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1164 int alpm_trans_prepare(alpm_handle_t
*handle
, alpm_list_t
**data
);
1166 /** Commit a transaction.
1167 * @param handle the context handle
1168 * @param data the address of an alpm_list where detailed description
1169 * of an error can be dumped (i.e. list of conflicting files)
1170 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1172 int alpm_trans_commit(alpm_handle_t
*handle
, alpm_list_t
**data
);
1174 /** Interrupt a transaction.
1175 * @param handle the context handle
1176 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1178 int alpm_trans_interrupt(alpm_handle_t
*handle
);
1180 /** Release a transaction.
1181 * @param handle the context handle
1182 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1184 int alpm_trans_release(alpm_handle_t
*handle
);
1187 /** @name Common Transactions */
1190 /** Search for packages to upgrade and add them to the transaction.
1191 * @param handle the context handle
1192 * @param enable_downgrade allow downgrading of packages if the remote version is lower
1193 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1195 int alpm_sync_sysupgrade(alpm_handle_t
*handle
, int enable_downgrade
);
1197 /** Add a package to the transaction.
1198 * If the package was loaded by alpm_pkg_load(), it will be freed upon
1199 * alpm_trans_release() invocation.
1200 * @param handle the context handle
1201 * @param pkg the package to add
1202 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1204 int alpm_add_pkg(alpm_handle_t
*handle
, alpm_pkg_t
*pkg
);
1206 /** Add a package removal action to the transaction.
1207 * @param handle the context handle
1208 * @param pkg the package to uninstall
1209 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1211 int alpm_remove_pkg(alpm_handle_t
*handle
, alpm_pkg_t
*pkg
);
1215 /** @addtogroup alpm_api_depends Dependency Functions
1216 * Functions dealing with libalpm representation of dependency
1221 alpm_list_t
*alpm_checkdeps(alpm_handle_t
*handle
, alpm_list_t
*pkglist
,
1222 alpm_list_t
*remove
, alpm_list_t
*upgrade
, int reversedeps
);
1223 alpm_pkg_t
*alpm_find_satisfier(alpm_list_t
*pkgs
, const char *depstring
);
1224 alpm_pkg_t
*alpm_find_dbs_satisfier(alpm_handle_t
*handle
,
1225 alpm_list_t
*dbs
, const char *depstring
);
1227 alpm_list_t
*alpm_checkconflicts(alpm_handle_t
*handle
, alpm_list_t
*pkglist
);
1229 /** Returns a newly allocated string representing the dependency information.
1230 * @param dep a dependency info structure
1231 * @return a formatted string, e.g. "glibc>=2.12"
1233 char *alpm_dep_compute_string(const alpm_depend_t
*dep
);
1244 char *alpm_compute_md5sum(const char *filename
);
1245 char *alpm_compute_sha256sum(const char *filename
);
1247 /** @addtogroup alpm_api_errors Error Codes
1250 typedef enum _alpm_errno_t
{
1251 ALPM_ERR_MEMORY
= 1,
1254 ALPM_ERR_NOT_A_FILE
,
1256 ALPM_ERR_WRONG_ARGS
,
1257 ALPM_ERR_DISK_SPACE
,
1259 ALPM_ERR_HANDLE_NULL
,
1260 ALPM_ERR_HANDLE_NOT_NULL
,
1261 ALPM_ERR_HANDLE_LOCK
,
1266 ALPM_ERR_DB_NOT_NULL
,
1267 ALPM_ERR_DB_NOT_FOUND
,
1268 ALPM_ERR_DB_INVALID
,
1269 ALPM_ERR_DB_INVALID_SIG
,
1270 ALPM_ERR_DB_VERSION
,
1274 ALPM_ERR_SERVER_BAD_URL
,
1275 ALPM_ERR_SERVER_NONE
,
1277 ALPM_ERR_TRANS_NOT_NULL
,
1278 ALPM_ERR_TRANS_NULL
,
1279 ALPM_ERR_TRANS_DUP_TARGET
,
1280 ALPM_ERR_TRANS_NOT_INITIALIZED
,
1281 ALPM_ERR_TRANS_NOT_PREPARED
,
1282 ALPM_ERR_TRANS_ABORT
,
1283 ALPM_ERR_TRANS_TYPE
,
1284 ALPM_ERR_TRANS_NOT_LOCKED
,
1286 ALPM_ERR_PKG_NOT_FOUND
,
1287 ALPM_ERR_PKG_IGNORED
,
1288 ALPM_ERR_PKG_INVALID
,
1289 ALPM_ERR_PKG_INVALID_CHECKSUM
,
1290 ALPM_ERR_PKG_INVALID_SIG
,
1291 ALPM_ERR_PKG_MISSING_SIG
,
1293 ALPM_ERR_PKG_CANT_REMOVE
,
1294 ALPM_ERR_PKG_INVALID_NAME
,
1295 ALPM_ERR_PKG_INVALID_ARCH
,
1296 ALPM_ERR_PKG_REPO_NOT_FOUND
,
1298 ALPM_ERR_SIG_MISSING
,
1299 ALPM_ERR_SIG_INVALID
,
1301 ALPM_ERR_DLT_INVALID
,
1302 ALPM_ERR_DLT_PATCHFAILED
,
1304 ALPM_ERR_UNSATISFIED_DEPS
,
1305 ALPM_ERR_CONFLICTING_DEPS
,
1306 ALPM_ERR_FILE_CONFLICTS
,
1309 ALPM_ERR_INVALID_REGEX
,
1310 /* External library errors */
1311 ALPM_ERR_LIBARCHIVE
,
1313 ALPM_ERR_EXTERNAL_DOWNLOAD
,
1317 /** Returns the current error code from the handle. */
1318 alpm_errno_t
alpm_errno(alpm_handle_t
*handle
);
1320 /** Returns the string corresponding to an error number. */
1321 const char *alpm_strerror(alpm_errno_t err
);
1323 /* End of alpm_api_errors */
1326 alpm_handle_t
*alpm_initialize(const char *root
, const char *dbpath
,
1328 int alpm_release(alpm_handle_t
*handle
);
1331 ALPM_CAPABILITY_NLS
= (1 << 0),
1332 ALPM_CAPABILITY_DOWNLOADER
= (1 << 1),
1333 ALPM_CAPABILITY_SIGNATURES
= (1 << 2)
1336 const char *alpm_version(void);
1337 enum alpm_caps
alpm_capabilities(void);
1339 /* End of alpm_api */
1345 #endif /* _ALPM_H */
1347 /* vim: set ts=2 sw=2 noet: */