libalpm
Arch Linux Package Manager Library
alpm.h
Go to the documentation of this file.
1/*
2 * alpm.h
3 *
4 * Copyright (c) 2006-2024 Pacman Development Team <pacman-dev@lists.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>
9 *
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.
14 *
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.
19 *
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/>.
22 */
23
24
25/** @mainpage alpm
26 *
27 * libalpm is a package management library, primarily used by pacman.
28 */
29
30#ifndef ALPM_H
31#define ALPM_H
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <stdint.h> /* int64_t */
38#include <sys/types.h> /* off_t */
39#include <stdarg.h> /* va_list */
40
41/* libarchive */
42#include <archive.h>
43#include <archive_entry.h>
44
45#include <alpm_list.h>
46
47/** @addtogroup libalpm The libalpm Public API
48 *
49 *
50 *
51 * libalpm is a package management library, primarily used by pacman.
52 * For ease of access, the libalpm manual has been split up into several sections.
53 *
54 * @section see_also See Also
55 * \b libalpm_list(3),
56 * \b libalpm_cb(3),
57 * \b libalpm_databases(3),
58 * \b libalpm_depends(3),
59 * \b libalpm_errors(3),
60 * \b libalpm_files(3),
61 * \b libalpm_groups(3),
62 * \b libalpm_handle(3),
63 * \b libalpm_log(3),
64 * \b libalpm_misc(3),
65 * \b libalpm_options(3),
66 * \b libalpm_packages(3),
67 * \b libalpm_sig(3),
68 * \b libalpm_trans(3)
69 * @{
70 */
71
72/*
73 * Opaque Structures
74 */
75
76/** The libalpm context handle.
77 *
78 * This struct represents an instance of libalpm.
79 * @ingroup libalpm_handle
80 */
81typedef struct _alpm_handle_t alpm_handle_t;
82
83/** A database.
84 *
85 * A database is a container that stores metadata about packages.
86 *
87 * A database can be located on the local filesystem or on a remote server.
88 *
89 * To use a database, it must first be registered via \link alpm_register_syncdb \endlink.
90 * If the database is already present in dbpath then it will be usable. Otherwise,
91 * the database needs to be downloaded using \link alpm_db_update \endlink. Even if the
92 * source of the database is the local filesystem.
93 *
94 * After this, the database can be used to query packages and groups. Any packages or groups
95 * from the database will continue to be owned by the database and do not need to be freed by
96 * the user. They will be freed when the database is unregistered.
97 *
98 * Databases are automatically unregistered when the \link alpm_handle_t \endlink is released.
99 * @ingroup libalpm_databases
100 */
101typedef struct _alpm_db_t alpm_db_t;
102
103
104/** A package.
105 *
106 * A package can be loaded from disk via \link alpm_pkg_load \endlink or retrieved from a database.
107 * Packages from databases are automatically freed when the database is unregistered. Packages loaded
108 * from a file must be freed manually.
109 *
110 * Packages can then be queried for metadata or added to a transaction
111 * to be added or removed from the system.
112 * @ingroup libalpm_packages
113 */
114typedef struct _alpm_pkg_t alpm_pkg_t;
115
116/** The extended data type used to store non-standard package data fields
117 * @ingroup libalpm_packages
118 */
119typedef struct _alpm_pkg_xdata_t {
120 char *name;
121 char *value;
123
124/** The time type used by libalpm. Represents a unix time stamp
125 * @ingroup libalpm_misc */
126typedef int64_t alpm_time_t;
127
128/** @addtogroup libalpm_files Files
129 * @brief Functions for package files
130 * @{
131 */
132
133/** File in a package */
134typedef struct _alpm_file_t {
135 /** Name of the file */
136 char *name;
137 /** Size of the file */
138 off_t size;
139 /** The file's permissions */
140 mode_t mode;
142
143/** Package filelist container */
144typedef struct _alpm_filelist_t {
145 /** Amount of files in the array */
146 size_t count;
147 /** An array of files */
150
151/** Local package or package file backup entry */
152typedef struct _alpm_backup_t {
153 /** Name of the file (without .pacsave extension) */
154 char *name;
155 /** Hash of the filename (used internally) */
156 char *hash;
158
159/** Determines whether a package filelist contains a given path.
160 * The provided path should be relative to the install root with no leading
161 * slashes, e.g. "etc/localtime". When searching for directories, the path must
162 * have a trailing slash.
163 * @param filelist a pointer to a package filelist
164 * @param path the path to search for in the package
165 * @return a pointer to the matching file or NULL if not found
166 */
167alpm_file_t *alpm_filelist_contains(const alpm_filelist_t *filelist, const char *path);
168
169/* End of libalpm_files */
170/** @} */
171
172
173/** @addtogroup libalpm_groups Groups
174 * @brief Functions for package groups
175 * @{
176 */
177
178/** Package group */
179typedef struct _alpm_group_t {
180 /** group name */
181 char *name;
182 /** list of alpm_pkg_t packages */
185
186/** Find group members across a list of databases.
187 * If a member exists in several databases, only the first database is used.
188 * IgnorePkg is also handled.
189 * @param dbs the list of alpm_db_t *
190 * @param name the name of the group
191 * @return the list of alpm_pkg_t * (caller is responsible for alpm_list_free)
192 */
193alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name);
194
195/* End of libalpm_groups */
196/** @} */
197
198
199/** @addtogroup libalpm_errors Error Codes
200 * Error codes returned by libalpm.
201 * @{
202 */
203
204/** libalpm's error type */
205typedef enum _alpm_errno_t {
206 /** No error */
208 /** Failed to allocate memory */
210 /** A system error occurred */
212 /** Permmision denied */
214 /** Should be a file */
216 /** Should be a directory */
218 /** Function was called with invalid arguments */
220 /** Insufficient disk space */
222 /* Interface */
223 /** Handle should be null */
225 /** Handle should not be null */
227 /** Failed to acquire lock */
229 /* Databases */
230 /** Failed to open database */
232 /** Failed to create database */
234 /** Database should not be null */
236 /** Database should be null */
238 /** The database could not be found */
240 /** Database is invalid */
242 /** Database has an invalid signature */
244 /** The localdb is in a newer/older format than libalpm expects */
246 /** Failed to write to the database */
248 /** Failed to remove entry from database */
250 /* Servers */
251 /** Server URL is in an invalid format */
253 /** The database has no configured servers */
255 /* Transactions */
256 /** A transaction is already initialized */
258 /** A transaction has not been initialized */
260 /** Duplicate target in transaction */
262 /** Duplicate filename in transaction */
264 /** A transaction has not been initialized */
266 /** Transaction has not been prepared */
268 /** Transaction was aborted */
270 /** Failed to interrupt transaction */
272 /** Tried to commit transaction without locking the database */
274 /** A hook failed to run */
276 /* Packages */
277 /** Package not found */
279 /** Package is in ignorepkg */
281 /** Package is invalid */
283 /** Package has an invalid checksum */
285 /** Package has an invalid signature */
287 /** Package does not have a signature */
289 /** Cannot open the package file */
291 /** Failed to remove package files */
293 /** Package has an invalid name */
295 /** Package has an invalid architecture */
297 /* Signatures */
298 /** Signatures are missing */
300 /** Signatures are invalid */
302 /* Dependencies */
303 /** Dependencies could not be satisfied */
305 /** Conflicting dependencies */
307 /** Files conflict */
309 /* Misc */
310 /** Download failed */
312 /** Invalid Regex */
314 /* External library errors */
315 /** Error in libarchive */
317 /** Error in libcurl */
319 /** Error in external download program */
321 /** Error in gpgme */
323 /** Missing compile-time features */
326
327/** Returns the current error code from the handle.
328 * @param handle the context handle
329 * @return the current error code of the handle
330 */
331alpm_errno_t alpm_errno(alpm_handle_t *handle);
332
333/** Returns the string corresponding to an error number.
334 * @param err the error code to get the string for
335 * @return the string relating to the given error code
336 */
337const char *alpm_strerror(alpm_errno_t err);
338
339/* End of libalpm_errors */
340/** @} */
341
342
343/** \addtogroup libalpm_handle Handle
344 * @brief Functions to initialize and release libalpm
345 * @{
346 */
347
348/** Initializes the library.
349 * Creates handle, connects to database and creates lockfile.
350 * This must be called before any other functions are called.
351 * @param root the root path for all filesystem operations
352 * @param dbpath the absolute path to the libalpm database
353 * @param err an optional variable to hold any error return codes
354 * @return a context handle on success, NULL on error, err will be set if provided
355 */
356alpm_handle_t *alpm_initialize(const char *root, const char *dbpath,
357 alpm_errno_t *err);
358
359/** Release the library.
360 * Disconnects from the database, removes handle and lockfile
361 * This should be the last alpm call you make.
362 * After this returns, handle should be considered invalid and cannot be reused
363 * in any way.
364 * @param handle the context handle
365 * @return 0 on success, -1 on error
366 */
367int alpm_release(alpm_handle_t *handle);
368
369/* End of libalpm_handle */
370/** @} */
371
372
373/** @addtogroup libalpm_sig Signature checking
374 * @brief Functions to check signatures
375 * @{
376 */
377
378/** PGP signature verification options */
379typedef enum _alpm_siglevel_t {
380 /** Packages require a signature */
382 /** Packages do not require a signature,
383 * but check packages that do have signatures */
385 /* Allow packages with signatures that are marginal trust */
387 /** Allow packages with signatures that are unknown trust */
389
390 /** Databases require a signature */
391 ALPM_SIG_DATABASE = (1 << 10),
392 /** Databases do not require a signature,
393 * but check databases that do have signatures */
395 /** Allow databases with signatures that are marginal trust */
397 /** Allow databases with signatures that are unknown trust */
399
400 /** The Default siglevel */
401 ALPM_SIG_USE_DEFAULT = (1 << 30)
403
404/** PGP signature verification status return codes */
405typedef enum _alpm_sigstatus_t {
406 /** Signature is valid */
408 /** The key has expired */
410 /** The signature has expired */
412 /** The key is not in the keyring */
414 /** The key has been disabled */
416 /** The signature is invalid */
419
420
421/** The trust level of a PGP key */
422typedef enum _alpm_sigvalidity_t {
423 /** The signature is fully trusted */
425 /** The signature is marginally trusted */
427 /** The signature is never trusted */
429 /** The signature has unknown trust */
432
433/** A PGP key */
434typedef struct _alpm_pgpkey_t {
435 /** The actual key data */
436 void *data;
437 /** The key's fingerprint */
439 /** UID of the key */
440 char *uid;
441 /** Name of the key's owner */
442 char *name;
443 /** Email of the key's owner */
444 char *email;
445 /** When the key was created */
447 /** When the key expires */
449 /** The length of the key */
450 unsigned int length;
451 /** has the key been revoked */
452 unsigned int revoked;
453 /** A character representing the encryption algorithm used by the public key
454 *
455 * ? = unknown
456 * R = RSA
457 * D = DSA
458 * E = EDDSA
459 */
462
463/**
464 * Signature result. Contains the key, status, and validity of a given
465 * signature.
466 */
467typedef struct _alpm_sigresult_t {
468 /** The key of the signature */
470 /** The status of the signature */
472 /** The validity of the signature */
475
476/**
477 * Signature list. Contains the number of signatures found and a pointer to an
478 * array of results. The array is of size count.
479 */
480typedef struct _alpm_siglist_t {
481 /** The amount of results in the array */
482 size_t count;
483 /** An array of sigresults */
486
487/**
488 * Check the PGP signature for the given package file.
489 * @param pkg the package to check
490 * @param siglist a pointer to storage for signature results
491 * @return 0 if valid, -1 if an error occurred or signature is invalid
492 */
493int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
494
495/**
496 * Check the PGP signature for the given database.
497 * @param db the database to check
498 * @param siglist a pointer to storage for signature results
499 * @return 0 if valid, -1 if an error occurred or signature is invalid
500 */
501int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
502
503/**
504 * Clean up and free a signature result list.
505 * Note that this does not free the siglist object itself in case that
506 * was allocated on the stack; this is the responsibility of the caller.
507 * @param siglist a pointer to storage for signature results
508 * @return 0 on success, -1 on error
509 */
511
512/**
513 * Decode a loaded signature in base64 form.
514 * @param base64_data the signature to attempt to decode
515 * @param data the decoded data; must be freed by the caller
516 * @param data_len the length of the returned data
517 * @return 0 on success, -1 on failure to properly decode
518 */
519int alpm_decode_signature(const char *base64_data,
520 unsigned char **data, size_t *data_len);
521
522/**
523 * Extract the Issuer Key ID from a signature
524 * @param handle the context handle
525 * @param identifier the identifier of the key.
526 * This may be the name of the package or the path to the package.
527 * @param sig PGP signature
528 * @param len length of signature
529 * @param keys a pointer to storage for key IDs
530 * @return 0 on success, -1 on error
531 */
532int alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
533 const unsigned char *sig, const size_t len, alpm_list_t **keys);
534
535/* End of libalpm_sig */
536/** @} */
537
538
539/** @addtogroup libalpm_depends Dependency
540 * @brief Functions dealing with libalpm's dependency and conflict
541 * information.
542 * @{
543 */
544
545/** Types of version constraints in dependency specs. */
546typedef enum _alpm_depmod_t {
547 /** No version constraint */
549 /** Test version equality (package=x.y.z) */
551 /** Test for at least a version (package>=x.y.z) */
553 /** Test for at most a version (package<=x.y.z) */
555 /** Test for greater than some version (package>x.y.z) */
557 /** Test for less than some version (package<x.y.z) */
560
561/**
562 * File conflict type.
563 * Whether the conflict results from a file existing on the filesystem, or with
564 * another target in the transaction.
565 */
566typedef enum _alpm_fileconflicttype_t {
567 /** The conflict results with a another target in the transaction */
569 /** The conflict results from a file existing on the filesystem */
572
573/** The basic dependency type.
574 *
575 * This type is used throughout libalpm, not just for dependencies
576 * but also conflicts and providers. */
577typedef struct _alpm_depend_t {
578 /** Name of the provider to satisfy this dependency */
579 char *name;
580 /** Version of the provider to match against (optional) */
581 char *version;
582 /** A description of why this dependency is needed (optional) */
583 char *desc;
584 /** A hash of name (used internally to speed up conflict checks) */
585 unsigned long name_hash;
586 /** How the version should match against the provider */
589
590/** Missing dependency. */
591typedef struct _alpm_depmissing_t {
592 /** Name of the package that has the dependency */
593 char *target;
594 /** The dependency that was wanted */
596 /** If the depmissing was caused by a conflict, the name of the package
597 * that would be installed, causing the satisfying package to be removed */
600
601/** A conflict that has occurred between two packages. */
602typedef struct _alpm_conflict_t {
603 /** The first package */
604 alpm_pkg_t *package1;
605 /** The second package */
606 alpm_pkg_t *package2;
607 /** The conflict */
610
611/** File conflict.
612 *
613 * A conflict that has happened due to a two packages containing the same file,
614 * or a package contains a file that is already on the filesystem and not owned
615 * by that package. */
616typedef struct _alpm_fileconflict_t {
617 /** The name of the package that caused the conflict */
618 char *target;
619 /** The type of conflict */
621 /** The name of the file that the package conflicts with */
622 char *file;
623 /** The name of the package that also owns the file if there is one*/
624 char *ctarget;
626
627/** Checks dependencies and returns missing ones in a list.
628 * Dependencies can include versions with depmod operators.
629 * @param handle the context handle
630 * @param pkglist the list of local packages
631 * @param remove an alpm_list_t* of packages to be removed
632 * @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade)
633 * @param reversedeps handles the backward dependencies
634 * @return an alpm_list_t* of alpm_depmissing_t pointers.
635 */
636alpm_list_t *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglist,
637 alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps);
638
639/** Find a package satisfying a specified dependency.
640 * The dependency can include versions with depmod operators.
641 * @param pkgs an alpm_list_t* of alpm_pkg_t where the satisfyer will be searched
642 * @param depstring package or provision name, versioned or not
643 * @return a alpm_pkg_t* satisfying depstring
644 */
645alpm_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring);
646
647/** Find a package satisfying a specified dependency.
648 * First look for a literal, going through each db one by one. Then look for
649 * providers. The first satisfyer that belongs to an installed package is
650 * returned. If no providers belong to an installed package then an
651 * alpm_question_select_provider_t is created to select the provider.
652 * The dependency can include versions with depmod operators.
653 *
654 * @param handle the context handle
655 * @param dbs an alpm_list_t* of alpm_db_t where the satisfyer will be searched
656 * @param depstring package or provision name, versioned or not
657 * @return a alpm_pkg_t* satisfying depstring
658 */
659alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *handle,
660 alpm_list_t *dbs, const char *depstring);
661
662/** Check the package conflicts in a database
663 *
664 * @param handle the context handle
665 * @param pkglist the list of packages to check
666 *
667 * @return an alpm_list_t of alpm_conflict_t
668 */
669alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist);
670
671/** Returns a newly allocated string representing the dependency information.
672 * @param dep a dependency info structure
673 * @return a formatted string, e.g. "glibc>=2.12"
674 */
675char *alpm_dep_compute_string(const alpm_depend_t *dep);
676
677/** Return a newly allocated dependency information parsed from a string
678 *\link alpm_dep_free should be used to free the dependency \endlink
679 * @param depstring a formatted string, e.g. "glibc=2.12"
680 * @return a dependency info structure
681 */
682alpm_depend_t *alpm_dep_from_string(const char *depstring);
683
684/** Free a dependency info structure
685 * @param dep struct to free
686 */
688
689/** Free a fileconflict and its members.
690 * @param conflict the fileconflict to free
691 */
693
694/** Free a depmissing and its members
695 * @param miss the depmissing to free
696 * */
698
699/**
700 * Free a conflict and its members.
701 * @param conflict the conflict to free
702 */
703void alpm_conflict_free(alpm_conflict_t *conflict);
704
705
706/* End of libalpm_depends */
707/** @} */
708
709
710/** \addtogroup libalpm_cb Callbacks
711 * @brief Functions and structures for libalpm's callbacks
712 * @{
713 */
714
715/**
716 * Type of events.
717 */
718typedef enum _alpm_event_type_t {
719 /** Dependencies will be computed for a package. */
721 /** Dependencies were computed for a package. */
723 /** File conflicts will be computed for a package. */
725 /** File conflicts were computed for a package. */
727 /** Dependencies will be resolved for target package. */
729 /** Dependencies were resolved for target package. */
731 /** Inter-conflicts will be checked for target package. */
733 /** Inter-conflicts were checked for target package. */
735 /** Processing the package transaction is starting. */
737 /** Processing the package transaction is finished. */
739 /** Package will be installed/upgraded/downgraded/re-installed/removed; See
740 * alpm_event_package_operation_t for arguments. */
742 /** Package was installed/upgraded/downgraded/re-installed/removed; See
743 * alpm_event_package_operation_t for arguments. */
745 /** Target package's integrity will be checked. */
747 /** Target package's integrity was checked. */
749 /** Target package will be loaded. */
751 /** Target package is finished loading. */
753 /** Scriptlet has printed information; See alpm_event_scriptlet_info_t for
754 * arguments. */
756 /** Database files will be downloaded from a repository. */
758 /** Database files were downloaded from a repository. */
760 /** Not all database files were successfully downloaded from a repository. */
762 /** Package files will be downloaded from a repository. */
764 /** Package files were downloaded from a repository. */
766 /** Not all package files were successfully downloaded from a repository. */
768 /** Disk space usage will be computed for a package. */
770 /** Disk space usage was computed for a package. */
772 /** An optdepend for another package is being removed; See
773 * alpm_event_optdep_removal_t for arguments. */
775 /** A configured repository database is missing; See
776 * alpm_event_database_missing_t for arguments. */
778 /** Checking keys used to create signatures are in keyring. */
780 /** Keyring checking is finished. */
782 /** Downloading missing keys into keyring. */
784 /** Key downloading is finished. */
786 /** A .pacnew file was created; See alpm_event_pacnew_created_t for arguments. */
788 /** A .pacsave file was created; See alpm_event_pacsave_created_t for
789 * arguments. */
791 /** Processing hooks will be started. */
793 /** Processing hooks is finished. */
795 /** A hook is starting */
797 /** A hook has finished running. */
800
801/** An event that may represent any event. */
802typedef struct _alpm_event_any_t {
803 /** Type of event */
806
807/** An enum over the kind of package operations. */
808typedef enum _alpm_package_operation_t {
809 /** Package (to be) installed. (No oldpkg) */
811 /** Package (to be) upgraded */
813 /** Package (to be) re-installed */
815 /** Package (to be) downgraded */
817 /** Package (to be) removed (No newpkg) */
820
821/** A package operation event occurred. */
822typedef struct _alpm_event_package_operation_t {
823 /** Type of event */
825 /** Type of operation */
827 /** Old package */
828 alpm_pkg_t *oldpkg;
829 /** New package */
830 alpm_pkg_t *newpkg;
832
833/** An optional dependency was removed. */
834typedef struct _alpm_event_optdep_removal_t {
835 /** Type of event */
837 /** Package with the optdep */
838 alpm_pkg_t *pkg;
839 /** Optdep being removed */
842
843/** A scriptlet was ran. */
844typedef struct _alpm_event_scriptlet_info_t {
845 /** Type of event */
847 /** Line of scriptlet output */
848 const char *line;
850
851
852/** A database is missing.
853 *
854 * The database is registered but has not been downloaded
855 */
856typedef struct _alpm_event_database_missing_t {
857 /** Type of event */
859 /** Name of the database */
860 const char *dbname;
862
863/** A package was downloaded. */
864typedef struct _alpm_event_pkgdownload_t {
865 /** Type of event */
867 /** Name of the file */
868 const char *file;
870
871/** A pacnew file was created. */
872typedef struct _alpm_event_pacnew_created_t {
873 /** Type of event */
875 /** Whether the creation was result of a NoUpgrade or not */
877 /** Old package */
878 alpm_pkg_t *oldpkg;
879 /** New Package */
880 alpm_pkg_t *newpkg;
881 /** Filename of the file without the .pacnew suffix */
882 const char *file;
884
885/** A pacsave file was created. */
886typedef struct _alpm_event_pacsave_created_t {
887 /** Type of event */
889 /** Old package */
890 alpm_pkg_t *oldpkg;
891 /** Filename of the file without the .pacsave suffix */
892 const char *file;
894
895/** Kind of hook. */
896typedef enum _alpm_hook_when_t {
897 /* Pre transaction hook */
899 /* Post transaction hook */
902
903/** pre/post transaction hooks are to be ran. */
904typedef struct _alpm_event_hook_t {
905 /** Type of event*/
907 /** Type of hook */
910
911/** A pre/post transaction hook was ran. */
912typedef struct _alpm_event_hook_run_t {
913 /** Type of event */
915 /** Name of hook */
916 const char *name;
917 /** Description of hook to be outputted */
918 const char *desc;
919 /** position of hook being run */
920 size_t position;
921 /** total hooks being run */
922 size_t total;
924
925/** Packages downloading about to start. */
926typedef struct _alpm_event_pkg_retrieve_t {
927 /** Type of event */
929 /** Number of packages to download */
930 size_t num;
931 /** Total size of packages to download */
934
935/** Events.
936 * This is a union passed to the callback that allows the frontend to know
937 * which type of event was triggered (via type). It is then possible to
938 * typecast the pointer to the right structure, or use the union field, in order
939 * to access event-specific data. */
940typedef union _alpm_event_t {
941 /** Type of event it's always safe to access this. */
943 /** The any event type. It's always safe to access this. */
945 /** Package operation */
947 /** An optdept was remove */
949 /** A scriptlet was ran */
951 /** A database is missing */
953 /** A package was downloaded */
955 /** A pacnew file was created */
957 /** A pacsave file was created */
959 /** Pre/post transaction hooks are being ran */
961 /** A hook was ran */
963 /** Download packages */
966
967/** Event callback.
968 *
969 * Called when an event occurs
970 * @param ctx user-provided context
971 * @param event the event that occurred */
972typedef void (*alpm_cb_event)(void *ctx, alpm_event_t *event);
973
974/**
975 * Type of question.
976 * Unlike the events or progress enumerations, this enum has bitmask values
977 * so a frontend can use a bitmask map to supply preselected answers to the
978 * different types of questions.
979 */
980typedef enum _alpm_question_type_t {
981 /** Should target in ignorepkg be installed anyway? */
983 /** Should a package be replaced? */
985 /** Should a conflicting package be removed? */
987 /** Should a corrupted package be deleted? */
989 /** Should unresolvable targets be removed from the transaction? */
991 /** Provider selection */
993 /** Should a key be imported? */
994 ALPM_QUESTION_IMPORT_KEY = (1 << 6)
996
997/** A question that can represent any other question. */
998typedef struct _alpm_question_any_t {
999 /** Type of question */
1001 /** Answer */
1004
1005/** Should target in ignorepkg be installed anyway? */
1006typedef struct _alpm_question_install_ignorepkg_t {
1007 /** Type of question */
1009 /** Answer: whether or not to install pkg anyway */
1011 /** The ignored package that we are deciding whether to install */
1012 alpm_pkg_t *pkg;
1014
1015/** Should a package be replaced? */
1016typedef struct _alpm_question_replace_t {
1017 /** Type of question */
1019 /** Answer: whether or not to replace oldpkg with newpkg */
1021 /** Package to be replaced */
1022 alpm_pkg_t *oldpkg;
1023 /** Package to replace with.*/
1024 alpm_pkg_t *newpkg;
1025 /** DB of newpkg */
1026 alpm_db_t *newdb;
1028
1029/** Should a conflicting package be removed? */
1030typedef struct _alpm_question_conflict_t {
1031 /** Type of question */
1033 /** Answer: whether or not to remove conflict->package2 */
1035 /** Conflict info */
1038
1039/** Should a corrupted package be deleted? */
1040typedef struct _alpm_question_corrupted_t {
1041 /** Type of question */
1043 /** Answer: whether or not to remove filepath */
1045 /** File to remove */
1046 const char *filepath;
1047 /** Error code indicating the reason for package invalidity */
1050
1051/** Should unresolvable targets be removed from the transaction? */
1052typedef struct _alpm_question_remove_pkgs_t {
1053 /** Type of question */
1055 /** Answer: whether or not to skip packages */
1056 int skip;
1057 /** List of alpm_pkg_t* with unresolved dependencies */
1060
1061/** Provider selection */
1062typedef struct _alpm_question_select_provider_t {
1063 /** Type of question */
1065 /** Answer: which provider to use (index from providers) */
1067 /** List of alpm_pkg_t* as possible providers */
1069 /** What providers provide for */
1072
1073/** Should a key be imported? */
1074typedef struct _alpm_question_import_key_t {
1075 /** Type of question */
1077 /** Answer: whether or not to import key */
1078 int import;
1079 /** UID of the key to import */
1080 const char *uid;
1081 /** Fingerprint the key to import */
1082 const char *fingerprint;
1084
1085/**
1086 * Questions.
1087 * This is an union passed to the callback that allows the frontend to know
1088 * which type of question was triggered (via type). It is then possible to
1089 * typecast the pointer to the right structure, or use the union field, in order
1090 * to access question-specific data. */
1091typedef union _alpm_question_t {
1092 /** The type of question. It's always safe to access this. */
1094 /** A question that can represent any question.
1095 * It's always safe to access this. */
1097 /** Should target in ignorepkg be installed anyway? */
1099 /** Should a package be replaced? */
1101 /** Should a conflicting package be removed? */
1103 /** Should a corrupted package be deleted? */
1105 /** Should unresolvable targets be removed from the transaction? */
1107 /** Provider selection */
1109 /** Should a key be imported? */
1112
1113/** Question callback.
1114 *
1115 * This callback allows user to give input and decide what to do during certain events
1116 * @param ctx user-provided context
1117 * @param question the question being asked.
1118 */
1119typedef void (*alpm_cb_question)(void *ctx, alpm_question_t *question);
1120
1121/** An enum over different kinds of progress alerts. */
1122typedef enum _alpm_progress_t {
1123 /** Package install */
1125 /** Package upgrade */
1127 /** Package downgrade */
1129 /** Package reinstall */
1131 /** Package removal */
1133 /** Conflict checking */
1135 /** Diskspace checking */
1137 /** Package Integrity checking */
1139 /** Loading packages from disk */
1141 /** Checking signatures of packages */
1144
1145/** Progress callback
1146 *
1147 * Alert the front end about the progress of certain events.
1148 * Allows the implementation of loading bars for events that
1149 * make take a while to complete.
1150 * @param ctx user-provided context
1151 * @param progress the kind of event that is progressing
1152 * @param pkg for package operations, the name of the package being operated on
1153 * @param percent the percent completion of the action
1154 * @param howmany the total amount of items in the action
1155 * @param current the current amount of items completed
1156 */
1157/** Progress callback */
1158typedef void (*alpm_cb_progress)(void *ctx, alpm_progress_t progress, const char *pkg,
1159 int percent, size_t howmany, size_t current);
1160
1161/*
1162 * Downloading
1163 */
1164
1165/** File download events.
1166 * These events are reported by ALPM via download callback.
1167 */
1168typedef enum _alpm_download_event_type_t {
1169 /** A download was started */
1171 /** A download made progress */
1173 /** Download will be retried */
1175 /** A download completed */
1178
1179/** Context struct for when a download starts. */
1180typedef struct _alpm_download_event_init_t {
1181 /** whether this file is optional and thus the errors could be ignored */
1184
1185/** Context struct for when a download progresses. */
1186typedef struct _alpm_download_event_progress_t {
1187 /** Amount of data downloaded */
1189 /** Total amount need to be downloaded */
1190 off_t total;
1192
1193/** Context struct for when a download retries. */
1194typedef struct _alpm_download_event_retry_t {
1195 /** If the download will resume or start over */
1198
1199/** Context struct for when a download completes. */
1200typedef struct _alpm_download_event_completed_t {
1201 /** Total bytes in file */
1202 off_t total;
1203 /** download result code:
1204 * 0 - download completed successfully
1205 * 1 - the file is up-to-date
1206 * -1 - error
1207 */
1210
1211/** Type of download progress callbacks.
1212 * @param ctx user-provided context
1213 * @param filename the name of the file being downloaded
1214 * @param event the event type
1215 * @param data the event data of type alpm_download_event_*_t
1216 */
1217typedef void (*alpm_cb_download)(void *ctx, const char *filename,
1218 alpm_download_event_type_t event, void *data);
1219
1220
1221/** A callback for downloading files
1222 * @param ctx user-provided context
1223 * @param url the URL of the file to be downloaded
1224 * @param localpath the directory to which the file should be downloaded
1225 * @param force whether to force an update, even if the file is the same
1226 * @return 0 on success, 1 if the file exists and is identical, -1 on
1227 * error.
1228 */
1229typedef int (*alpm_cb_fetch)(void *ctx, const char *url, const char *localpath,
1230 int force);
1231
1232/* End of libalpm_cb */
1233/** @} */
1234
1235
1236/** @addtogroup libalpm_databases Database
1237 * @brief Functions to query and manipulate the database of libalpm.
1238 * @{
1239 */
1240
1241/** Get the database of locally installed packages.
1242 * The returned pointer points to an internal structure
1243 * of libalpm which should only be manipulated through
1244 * libalpm functions.
1245 * @return a reference to the local database
1246 */
1247alpm_db_t *alpm_get_localdb(alpm_handle_t *handle);
1248
1249/** Get the list of sync databases.
1250 * Returns a list of alpm_db_t structures, one for each registered
1251 * sync database.
1252 *
1253 * @param handle the context handle
1254 * @return a reference to an internal list of alpm_db_t structures
1255 */
1256alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle);
1257
1258/** Register a sync database of packages.
1259 * Databases can not be registered when there is an active transaction.
1260 *
1261 * @param handle the context handle
1262 * @param treename the name of the sync repository
1263 * @param level what level of signature checking to perform on the
1264 * database; note that this must be a '.sig' file type verification
1265 * @return an alpm_db_t* on success (the value), NULL on error
1266 */
1267alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename,
1268 int level);
1269
1270/** Unregister all package databases.
1271 * Databases can not be unregistered while there is an active transaction.
1272 *
1273 * @param handle the context handle
1274 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1275 */
1276int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
1277
1278/** Unregister a package database.
1279 * Databases can not be unregistered when there is an active transaction.
1280 *
1281 * @param db pointer to the package database to unregister
1282 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1283 */
1284int alpm_db_unregister(alpm_db_t *db);
1285
1286/** Get the handle of a package database.
1287 * @param db pointer to the package database
1288 * @return the alpm handle that the package database belongs to
1289 */
1290alpm_handle_t *alpm_db_get_handle(alpm_db_t *db);
1291
1292/** Get the name of a package database.
1293 * @param db pointer to the package database
1294 * @return the name of the package database, NULL on error
1295 */
1296const char *alpm_db_get_name(const alpm_db_t *db);
1297
1298/** Get the signature verification level for a database.
1299 * Will return the default verification level if this database is set up
1300 * with ALPM_SIG_USE_DEFAULT.
1301 * @param db pointer to the package database
1302 * @return the signature verification level
1303 */
1304int alpm_db_get_siglevel(alpm_db_t *db);
1305
1306/** Check the validity of a database.
1307 * This is most useful for sync databases and verifying signature status.
1308 * If invalid, the handle error code will be set accordingly.
1309 * @param db pointer to the package database
1310 * @return 0 if valid, -1 if invalid (pm_errno is set accordingly)
1311 */
1312int alpm_db_get_valid(alpm_db_t *db);
1313
1314/** @name Server accessors
1315 * @{
1316 */
1317
1318/** Get the list of servers assigned to this db.
1319 * @param db pointer to the database to get the servers from
1320 * @return a char* list of servers
1321 */
1322alpm_list_t *alpm_db_get_servers(const alpm_db_t *db);
1323
1324/** Sets the list of servers for the database to use.
1325 * @param db the database to set the servers. The list will be duped and
1326 * the original will still need to be freed by the caller.
1327 * @param servers a char* list of servers.
1328 */
1329int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers);
1330
1331/** Add a download server to a database.
1332 * @param db database pointer
1333 * @param url url of the server
1334 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1335 */
1336int alpm_db_add_server(alpm_db_t *db, const char *url);
1337
1338/** Remove a download server from a database.
1339 * @param db database pointer
1340 * @param url url of the server
1341 * @return 0 on success, 1 on server not present,
1342 * -1 on error (pm_errno is set accordingly)
1343 */
1344int alpm_db_remove_server(alpm_db_t *db, const char *url);
1345
1346/** Get the list of cache servers assigned to this db.
1347 * @param db pointer to the database to get the servers from
1348 * @return a char* list of servers
1349 */
1350alpm_list_t *alpm_db_get_cache_servers(const alpm_db_t *db);
1351
1352/** Sets the list of cache servers for the database to use.
1353 * @param db the database to set the servers. The list will be duped and
1354 * the original will still need to be freed by the caller.
1355 * @param servers a char* list of servers.
1356 */
1357int alpm_db_set_cache_servers(alpm_db_t *db, alpm_list_t *servers);
1358
1359/** Add a download cache server to a database.
1360 * @param db database pointer
1361 * @param url url of the server
1362 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1363 */
1364int alpm_db_add_cache_server(alpm_db_t *db, const char *url);
1365
1366/** Remove a download cache server from a database.
1367 * @param db database pointer
1368 * @param url url of the server
1369 * @return 0 on success, 1 on server not present,
1370 * -1 on error (pm_errno is set accordingly)
1371 */
1372int alpm_db_remove_cache_server(alpm_db_t *db, const char *url);
1373
1374/* End of server accessors */
1375/** @} */
1376
1377/** Update package databases.
1378 *
1379 * An update of the package databases in the list \a dbs will be attempted.
1380 * Unless \a force is true, the update will only be performed if the remote
1381 * databases were modified since the last update.
1382 *
1383 * This operation requires a database lock, and will return an applicable error
1384 * if the lock could not be obtained.
1385 *
1386 * Example:
1387 * @code
1388 * alpm_list_t *dbs = alpm_get_syncdbs(config->handle);
1389 * ret = alpm_db_update(config->handle, dbs, force);
1390 * if(ret < 0) {
1391 * pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"),
1392 * alpm_strerror(alpm_errno(config->handle)));
1393 * }
1394 * @endcode
1395 *
1396 * @note After a successful update, the \link alpm_db_get_pkgcache()
1397 * package cache \endlink will be invalidated
1398 * @param handle the context handle
1399 * @param dbs list of package databases to update
1400 * @param force if true, then forces the update, otherwise update only in case
1401 * the databases aren't up to date
1402 * @return 0 on success, -1 on error (pm_errno is set accordingly),
1403 * 1 if all databases are up to to date
1404 */
1405int alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force);
1406
1407/** Get a package entry from a package database.
1408 * Looking up a package is O(1) and will be significantly faster than
1409 * iterating over the pkgcahe.
1410 * @param db pointer to the package database to get the package from
1411 * @param name of the package
1412 * @return the package entry on success, NULL on error
1413 */
1414alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name);
1415
1416/** Get the package cache of a package database.
1417 * This is a list of all packages the db contains.
1418 * @param db pointer to the package database to get the package from
1419 * @return the list of packages on success, NULL on error
1420 */
1421alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db);
1422
1423/** Get a group entry from a package database.
1424 * Looking up a group is O(1) and will be significantly faster than
1425 * iterating over the groupcahe.
1426 * @param db pointer to the package database to get the group from
1427 * @param name of the group
1428 * @return the groups entry on success, NULL on error
1429 */
1430alpm_group_t *alpm_db_get_group(alpm_db_t *db, const char *name);
1431
1432/** Get the group cache of a package database.
1433 * @param db pointer to the package database to get the group from
1434 * @return the list of groups on success, NULL on error
1435 */
1436alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
1437
1438/** Searches a database with regular expressions.
1439 * @param db pointer to the package database to search in
1440 * @param needles a list of regular expressions to search for
1441 * @param ret pointer to list for storing packages matching all
1442 * regular expressions - must point to an empty (NULL) alpm_list_t *.
1443 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1444 */
1445int alpm_db_search(alpm_db_t *db, const alpm_list_t *needles,
1446 alpm_list_t **ret);
1447
1448/** The usage level of a database. */
1449typedef enum _alpm_db_usage_t {
1450 /** Enable refreshes for this database */
1452 /** Enable search for this database */
1454 /** Enable installing packages from this database */
1456 /** Enable sysupgrades with this database */
1458 /** Enable all usage levels */
1459 ALPM_DB_USAGE_ALL = (1 << 4) - 1,
1461
1462/** @name Usage accessors
1463 * @{
1464 */
1465
1466/** Sets the usage of a database.
1467 * @param db pointer to the package database to set the status for
1468 * @param usage a bitmask of alpm_db_usage_t values
1469 * @return 0 on success, or -1 on error
1470 */
1471int alpm_db_set_usage(alpm_db_t *db, int usage);
1472
1473/** Gets the usage of a database.
1474 * @param db pointer to the package database to get the status of
1475 * @param usage pointer to an alpm_db_usage_t to store db's status
1476 * @return 0 on success, or -1 on error
1477 */
1478int alpm_db_get_usage(alpm_db_t *db, int *usage);
1479
1480/* End of usage accessors */
1481/** @} */
1482
1483
1484/* End of libalpm_databases */
1485/** @} */
1486
1487
1488/** \addtogroup libalpm_log Logging Functions
1489 * @brief Functions to log using libalpm
1490 * @{
1491 */
1492
1493/** Logging Levels */
1494typedef enum _alpm_loglevel_t {
1495 /** Error */
1497 /** Warning */
1499 /** Debug */
1500 ALPM_LOG_DEBUG = (1 << 2),
1501 /** Function */
1502 ALPM_LOG_FUNCTION = (1 << 3)
1504
1505
1506/** The callback type for logging.
1507 *
1508 * libalpm will call this function whenever something is to be logged.
1509 * many libalpm will produce log output. Additionally any calls to \link alpm_logaction
1510 * \endlink will also call this callback.
1511 * @param ctx user-provided context
1512 * @param level the currently set loglevel
1513 * @param fmt the printf like format string
1514 * @param args printf like arguments
1515 */
1516typedef void (*alpm_cb_log)(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args);
1517
1518/** A printf-like function for logging.
1519 * @param handle the context handle
1520 * @param prefix caller-specific prefix for the log
1521 * @param fmt output format
1522 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1523 */
1524int alpm_logaction(alpm_handle_t *handle, const char *prefix,
1525 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
1526
1527/* End of libalpm_log */
1528/** @} */
1529
1530
1531/** @addtogroup libalpm_options Options
1532 * Libalpm option getters and setters
1533 * @{
1534 */
1535
1536/** @name Accessors for callbacks
1537 * @{
1538 */
1539
1540/** Returns the callback used for logging.
1541 * @param handle the context handle
1542 * @return the currently set log callback
1543 */
1544alpm_cb_log alpm_option_get_logcb(alpm_handle_t *handle);
1545
1546/** Returns the callback used for logging.
1547 * @param handle the context handle
1548 * @return the currently set log callback context
1549 */
1550void *alpm_option_get_logcb_ctx(alpm_handle_t *handle);
1551
1552/** Sets the callback used for logging.
1553 * @param handle the context handle
1554 * @param cb the cb to use
1555 * @param ctx user-provided context to pass to cb
1556 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1557 */
1558int alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb, void *ctx);
1559
1560/** Returns the callback used to report download progress.
1561 * @param handle the context handle
1562 * @return the currently set download callback
1563 */
1564alpm_cb_download alpm_option_get_dlcb(alpm_handle_t *handle);
1565
1566/** Returns the callback used to report download progress.
1567 * @param handle the context handle
1568 * @return the currently set download callback context
1569 */
1570void *alpm_option_get_dlcb_ctx(alpm_handle_t *handle);
1571
1572/** Sets the callback used to report download progress.
1573 * @param handle the context handle
1574 * @param cb the cb to use
1575 * @param ctx user-provided context to pass to cb
1576 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1577 */
1578int alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb, void *ctx);
1579
1580/** Returns the downloading callback.
1581 * @param handle the context handle
1582 * @return the currently set fetch callback
1583 */
1584alpm_cb_fetch alpm_option_get_fetchcb(alpm_handle_t *handle);
1585
1586/** Returns the downloading callback.
1587 * @param handle the context handle
1588 * @return the currently set fetch callback context
1589 */
1590void *alpm_option_get_fetchcb_ctx(alpm_handle_t *handle);
1591
1592/** Sets the downloading callback.
1593 * @param handle the context handle
1594 * @param cb the cb to use
1595 * @param ctx user-provided context to pass to cb
1596 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1597 */
1598int alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb, void *ctx);
1599
1600/** Returns the callback used for events.
1601 * @param handle the context handle
1602 * @return the currently set event callback
1603 */
1604alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle);
1605
1606/** Returns the callback used for events.
1607 * @param handle the context handle
1608 * @return the currently set event callback context
1609 */
1610void *alpm_option_get_eventcb_ctx(alpm_handle_t *handle);
1611
1612/** Sets the callback used for events.
1613 * @param handle the context handle
1614 * @param cb the cb to use
1615 * @param ctx user-provided context to pass to cb
1616 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1617 */
1618int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb, void *ctx);
1619
1620/** Returns the callback used for questions.
1621 * @param handle the context handle
1622 * @return the currently set question callback
1623 */
1624alpm_cb_question alpm_option_get_questioncb(alpm_handle_t *handle);
1625
1626/** Returns the callback used for questions.
1627 * @param handle the context handle
1628 * @return the currently set question callback context
1629 */
1630void *alpm_option_get_questioncb_ctx(alpm_handle_t *handle);
1631
1632/** Sets the callback used for questions.
1633 * @param handle the context handle
1634 * @param cb the cb to use
1635 * @param ctx user-provided context to pass to cb
1636 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1637 */
1638int alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb, void *ctx);
1639
1640/**Returns the callback used for operation progress.
1641 * @param handle the context handle
1642 * @return the currently set progress callback
1643 */
1644alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle);
1645
1646/**Returns the callback used for operation progress.
1647 * @param handle the context handle
1648 * @return the currently set progress callback context
1649 */
1650void *alpm_option_get_progresscb_ctx(alpm_handle_t *handle);
1651
1652/** Sets the callback used for operation progress.
1653 * @param handle the context handle
1654 * @param cb the cb to use
1655 * @param ctx user-provided context to pass to cb
1656 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1657 */
1658int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb, void *ctx);
1659/* End of callback accessors */
1660/** @} */
1661
1662
1663/** @name Accessors to the root directory
1664 *
1665 * The root directory is the prefix to which libalpm installs packages to.
1666 * Hooks and scriptlets will also be run in a chroot to ensure they behave correctly
1667 * in alternative roots.
1668 * @{
1669 */
1670
1671/** Returns the root path. Read-only.
1672 * @param handle the context handle
1673 */
1674const char *alpm_option_get_root(alpm_handle_t *handle);
1675/* End of root accessors */
1676/** @} */
1677
1678
1679/** @name Accessors to the database path
1680 *
1681 * The dbpath is where libalpm stores the local db and
1682 * downloads sync databases.
1683 * @{
1684 */
1685
1686/** Returns the path to the database directory. Read-only.
1687 * @param handle the context handle
1688 */
1689const char *alpm_option_get_dbpath(alpm_handle_t *handle);
1690/* End of dbpath accessors */
1691/** @} */
1692
1693
1694/** @name Accessors to the lockfile
1695 *
1696 * The lockfile is used to ensure two instances of libalpm can not write
1697 * to the database at the same time. The lock file is created when
1698 * committing a transaction and released when the transaction completes.
1699 * Or when calling \link alpm_unlock \endlink.
1700 * @{
1701 */
1702
1703/** Get the name of the database lock file. Read-only.
1704 * This is the name that the lockfile would have. It does not
1705 * matter if the lockfile actually exists on disk.
1706 * @param handle the context handle
1707 */
1708const char *alpm_option_get_lockfile(alpm_handle_t *handle);
1709/* End of lockfile accessors */
1710/** @} */
1711
1712/** @name Accessors to the list of package cache directories.
1713 *
1714 * This is where libalpm will store downloaded packages.
1715 * @{
1716 */
1717
1718/** Gets the currently configured cachedirs,
1719 * @param handle the context handle
1720 * @return a char* list of cache directories
1721 */
1722alpm_list_t *alpm_option_get_cachedirs(alpm_handle_t *handle);
1723
1724/** Sets the cachedirs.
1725 * @param handle the context handle
1726 * @param cachedirs a char* list of cachdirs. The list will be duped and
1727 * the original will still need to be freed by the caller.
1728 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1729 */
1730int alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs);
1731
1732/** Append a cachedir to the configured cachedirs.
1733 * @param handle the context handle
1734 * @param cachedir the cachedir to add
1735 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1736 */
1737int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir);
1738
1739/** Remove a cachedir from the configured cachedirs.
1740 * @param handle the context handle
1741 * @param cachedir the cachedir to remove
1742 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1743 */
1744int alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir);
1745/* End of cachedir accessors */
1746/** @} */
1747
1748
1749/** @name Accessors to the list of package hook directories.
1750 *
1751 * libalpm will search these directories for hooks to run. A hook in
1752 * a later directory will override previous hooks if they have the same name.
1753 * @{
1754 */
1755
1756/** Gets the currently configured hookdirs,
1757 * @param handle the context handle
1758 * @return a char* list of hook directories
1759 */
1760alpm_list_t *alpm_option_get_hookdirs(alpm_handle_t *handle);
1761
1762/** Sets the hookdirs.
1763 * @param handle the context handle
1764 * @param hookdirs a char* list of hookdirs. The list will be duped and
1765 * the original will still need to be freed by the caller.
1766 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1767 */
1768int alpm_option_set_hookdirs(alpm_handle_t *handle, alpm_list_t *hookdirs);
1769
1770/** Append a hookdir to the configured hookdirs.
1771 * @param handle the context handle
1772 * @param hookdir the hookdir to add
1773 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1774 */
1775int alpm_option_add_hookdir(alpm_handle_t *handle, const char *hookdir);
1776
1777/** Remove a hookdir from the configured hookdirs.
1778 * @param handle the context handle
1779 * @param hookdir the hookdir to remove
1780 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1781 */
1782int alpm_option_remove_hookdir(alpm_handle_t *handle, const char *hookdir);
1783/* End of hookdir accessors */
1784/** @} */
1785
1786
1787/** @name Accessors to the list of overwritable files.
1788 *
1789 * Normally libalpm will refuse to install a package that owns files that
1790 * are already on disk and not owned by that package.
1791 *
1792 * If a conflicting file matches a glob in the overwrite_files list, then no
1793 * conflict will be raised and libalpm will simply overwrite the file.
1794 * @{
1795 */
1796
1797/** Gets the currently configured overwritable files,
1798 * @param handle the context handle
1799 * @return a char* list of overwritable file globs
1800 */
1801alpm_list_t *alpm_option_get_overwrite_files(alpm_handle_t *handle);
1802
1803/** Sets the overwritable files.
1804 * @param handle the context handle
1805 * @param globs a char* list of overwritable file globs. The list will be duped and
1806 * the original will still need to be freed by the caller.
1807 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1808 */
1809int alpm_option_set_overwrite_files(alpm_handle_t *handle, alpm_list_t *globs);
1810
1811/** Append an overwritable file to the configured overwritable files.
1812 * @param handle the context handle
1813 * @param glob the file glob to add
1814 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1815 */
1816int alpm_option_add_overwrite_file(alpm_handle_t *handle, const char *glob);
1817
1818/** Remove a file glob from the configured overwritable files globs.
1819 * @note The overwritable file list contains a list of globs. The glob to
1820 * remove must exactly match the entry to remove. There is no glob expansion.
1821 * @param handle the context handle
1822 * @param glob the file glob to remove
1823 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1824 */
1825int alpm_option_remove_overwrite_file(alpm_handle_t *handle, const char *glob);
1826/* End of overwrite accessors */
1827/** @} */
1828
1829
1830/** @name Accessors to the log file
1831 *
1832 * This controls where libalpm will save log output to.
1833 * @{
1834 */
1835
1836/** Gets the filepath to the currently set logfile.
1837 * @param handle the context handle
1838 * @return the path to the logfile
1839 */
1840const char *alpm_option_get_logfile(alpm_handle_t *handle);
1841
1842/** Sets the logfile path.
1843 * @param handle the context handle
1844 * @param logfile path to the new location of the logfile
1845 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1846 */
1847int alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile);
1848/* End of logfile accessors */
1849/** @} */
1850
1851
1852/** @name Accessors to the GPG directory
1853 *
1854 * This controls where libalpm will store GnuPG's files.
1855 * @{
1856 */
1857
1858/** Returns the path to libalpm's GnuPG home directory.
1859 * @param handle the context handle
1860 * @return the path to libalpms's GnuPG home directory
1861 */
1862const char *alpm_option_get_gpgdir(alpm_handle_t *handle);
1863
1864/** Sets the path to libalpm's GnuPG home directory.
1865 * @param handle the context handle
1866 * @param gpgdir the gpgdir to set
1867 */
1868int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir);
1869/* End of gpgdir accessors */
1870/** @} */
1871
1872
1873/** @name Accessors for use sandboxuser
1874 *
1875 * This controls the user that libalpm will use for sensitive operations like
1876 * downloading files.
1877 * @{
1878 */
1879
1880/** Returns the user to switch to for sensitive operations.
1881 * @return the user name
1882 */
1883const char *alpm_option_get_sandboxuser(alpm_handle_t *handle);
1884
1885/** Sets the user to switch to for sensitive operations.
1886 * @param handle the context handle
1887 * @param sandboxuser the user to set
1888 */
1889int alpm_option_set_sandboxuser(alpm_handle_t *handle, const char *sandboxuser);
1890
1891/* End of sandboxuser accessors */
1892/** @} */
1893
1894
1895/** @name Accessors for use syslog
1896 *
1897 * This controls whether libalpm will also use the syslog. Even if this option
1898 * is enabled, libalpm will still try to log to its log file.
1899 * @{
1900 */
1901
1902/** Returns whether to use syslog (0 is FALSE, TRUE otherwise).
1903 * @param handle the context handle
1904 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1905 */
1906int alpm_option_get_usesyslog(alpm_handle_t *handle);
1907
1908/** Sets whether to use syslog (0 is FALSE, TRUE otherwise).
1909 * @param handle the context handle
1910 * @param usesyslog whether to use the syslog (0 is FALSE, TRUE otherwise)
1911 */
1912int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog);
1913/* End of usesyslog accessors */
1914/** @} */
1915
1916
1917/** @name Accessors to the list of no-upgrade files.
1918 * These functions modify the list of files which should
1919 * not be updated by package installation.
1920 * @{
1921 */
1922
1923/** Get the list of no-upgrade files
1924 * @param handle the context handle
1925 * @return the char* list of no-upgrade files
1926 */
1927alpm_list_t *alpm_option_get_noupgrades(alpm_handle_t *handle);
1928
1929/** Add a file to the no-upgrade list
1930 * @param handle the context handle
1931 * @param path the path to add
1932 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1933 */
1934int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *path);
1935
1936/** Sets the list of no-upgrade files
1937 * @param handle the context handle
1938 * @param noupgrade a char* list of file to not upgrade.
1939 * The list will be duped and the original will still need to be freed by the caller.
1940 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1941 */
1942int alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade);
1943
1944/** Remove an entry from the no-upgrade list
1945 * @param handle the context handle
1946 * @param path the path to remove
1947 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1948 */
1949int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *path);
1950
1951/** Test if a path matches any of the globs in the no-upgrade list
1952 * @param handle the context handle
1953 * @param path the path to test
1954 * @return 0 is the path matches a glob, negative if there is no match and
1955 * positive is the match was inverted
1956 */
1957int alpm_option_match_noupgrade(alpm_handle_t *handle, const char *path);
1958/* End of noupgrade accessors */
1959/** @} */
1960
1961
1962/** @name Accessors to the list of no-extract files.
1963 * These functions modify the list of filenames which should
1964 * be skipped packages which should
1965 * not be upgraded by a sysupgrade operation.
1966 * @{
1967 */
1968
1969/** Get the list of no-extract files
1970 * @param handle the context handle
1971 * @return the char* list of no-extract files
1972 */
1973alpm_list_t *alpm_option_get_noextracts(alpm_handle_t *handle);
1974
1975/** Add a file to the no-extract list
1976 * @param handle the context handle
1977 * @param path the path to add
1978 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1979 */
1980int alpm_option_add_noextract(alpm_handle_t *handle, const char *path);
1981
1982/** Sets the list of no-extract files
1983 * @param handle the context handle
1984 * @param noextract a char* list of file to not extract.
1985 * The list will be duped and the original will still need to be freed by the caller.
1986 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1987 */
1988int alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract);
1989
1990/** Remove an entry from the no-extract list
1991 * @param handle the context handle
1992 * @param path the path to remove
1993 * @return 0 on success, -1 on error (pm_errno is set accordingly)
1994 */
1995int alpm_option_remove_noextract(alpm_handle_t *handle, const char *path);
1996
1997/** Test if a path matches any of the globs in the no-extract list
1998 * @param handle the context handle
1999 * @param path the path to test
2000 * @return 0 is the path matches a glob, negative if there is no match and
2001 * positive is the match was inverted
2002 */
2003int alpm_option_match_noextract(alpm_handle_t *handle, const char *path);
2004/* End of noextract accessors */
2005/** @} */
2006
2007
2008/** @name Accessors to the list of ignored packages.
2009 * These functions modify the list of packages that
2010 * should be ignored by a sysupgrade.
2011 *
2012 * Entries in this list may be globs and only match the package's
2013 * name. Providers are not taken into account.
2014 * @{
2015 */
2016
2017/** Get the list of ignored packages
2018 * @param handle the context handle
2019 * @return the char* list of ignored packages
2020 */
2021alpm_list_t *alpm_option_get_ignorepkgs(alpm_handle_t *handle);
2022
2023/** Add a file to the ignored package list
2024 * @param handle the context handle
2025 * @param pkg the package to add
2026 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2027 */
2028int alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg);
2029
2030/** Sets the list of packages to ignore
2031 * @param handle the context handle
2032 * @param ignorepkgs a char* list of packages to ignore
2033 * The list will be duped and the original will still need to be freed by the caller.
2034 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2035 */
2036int alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs);
2037
2038/** Remove an entry from the ignorepkg list
2039 * @param handle the context handle
2040 * @param pkg the package to remove
2041 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2042 */
2043int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg);
2044/* End of ignorepkg accessors */
2045/** @} */
2046
2047
2048/** @name Accessors to the list of ignored groups.
2049 * These functions modify the list of groups whose packages
2050 * should be ignored by a sysupgrade.
2051 *
2052 * Entries in this list may be globs.
2053 * @{
2054 */
2055
2056/** Get the list of ignored groups
2057 * @param handle the context handle
2058 * @return the char* list of ignored groups
2059 */
2060alpm_list_t *alpm_option_get_ignoregroups(alpm_handle_t *handle);
2061
2062/** Add a file to the ignored group list
2063 * @param handle the context handle
2064 * @param grp the group to add
2065 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2066 */
2067int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp);
2068
2069/** Sets the list of groups to ignore
2070 * @param handle the context handle
2071 * @param ignoregrps a char* list of groups to ignore
2072 * The list will be duped and the original will still need to be freed by the caller.
2073 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2074 */
2075int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps);
2076
2077/** Remove an entry from the ignoregroup list
2078 * @param handle the context handle
2079 * @param grp the group to remove
2080 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2081 */
2082int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp);
2083/* End of ignoregroup accessors */
2084/** @} */
2085
2086
2087/** @name Accessors to the list of ignored dependencies.
2088 * These functions modify the list of dependencies that
2089 * should be ignored by a sysupgrade.
2090 *
2091 * This is effectively a list of virtual providers that
2092 * packages can use to satisfy their dependencies.
2093 * @{
2094 */
2095
2096/** Gets the list of dependencies that are assumed to be met
2097 * @param handle the context handle
2098 * @return a list of alpm_depend_t*
2099 */
2100alpm_list_t *alpm_option_get_assumeinstalled(alpm_handle_t *handle);
2101
2102/** Add a depend to the assumed installed list
2103 * @param handle the context handle
2104 * @param dep the dependency to add
2105 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2106 */
2107int alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep);
2108
2109/** Sets the list of dependencies that are assumed to be met
2110 * @param handle the context handle
2111 * @param deps a list of *alpm_depend_t
2112 * The list will be duped and the original will still need to be freed by the caller.
2113 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2114 */
2115int alpm_option_set_assumeinstalled(alpm_handle_t *handle, alpm_list_t *deps);
2116
2117/** Remove an entry from the assume installed list
2118 * @param handle the context handle
2119 * @param dep the dep to remove
2120 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2121 */
2122int alpm_option_remove_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep);
2123/* End of assunmeinstalled accessors */
2124/** @} */
2125
2126
2127/** @name Accessors to the list of allowed architectures.
2128 * libalpm will only install packages that match one of the configured
2129 * architectures. The architectures do not need to match the physical
2130 architecture. They can just be treated as a label.
2131 * @{
2132 */
2133
2134/** Returns the allowed package architecture.
2135 * @param handle the context handle
2136 * @return the configured package architectures
2137 */
2138alpm_list_t *alpm_option_get_architectures(alpm_handle_t *handle);
2139
2140/** Adds an allowed package architecture.
2141 * @param handle the context handle
2142 * @param arch the architecture to set
2143 */
2144int alpm_option_add_architecture(alpm_handle_t *handle, const char *arch);
2145
2146/** Sets the allowed package architecture.
2147 * @param handle the context handle
2148 * @param arches the architecture to set
2149 */
2150int alpm_option_set_architectures(alpm_handle_t *handle, alpm_list_t *arches);
2151
2152/** Removes an allowed package architecture.
2153 * @param handle the context handle
2154 * @param arch the architecture to remove
2155 */
2156int alpm_option_remove_architecture(alpm_handle_t *handle, const char *arch);
2157
2158/* End of arch accessors */
2159/** @} */
2160
2161
2162/** @name Accessors for check space.
2163 *
2164 * This controls whether libalpm will check if there is sufficient before
2165 * installing packages.
2166 * @{
2167 */
2168
2169/** Get whether or not checking for free space before installing packages is enabled.
2170 * @param handle the context handle
2171 * @return 0 if disabled, 1 if enabled
2172 */
2173int alpm_option_get_checkspace(alpm_handle_t *handle);
2174
2175/** Enable/disable checking free space before installing packages.
2176 * @param handle the context handle
2177 * @param checkspace 0 for disabled, 1 for enabled
2178 */
2179int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
2180/* End of checkspace accessors */
2181/** @} */
2182
2183
2184/** @name Accessors for the database extension
2185 *
2186 * This controls the extension used for sync databases. libalpm will use this
2187 * extension to both lookup remote databses and as the name used when opening
2188 * reading them.
2189 *
2190 * This is useful for file databases. Seems as files can increase the size of
2191 * a database by quite a lot, a server could hold a database without files under
2192 * one extension, and another with files under another extension.
2193 *
2194 * Which one is downloaded and used then depends on this setting.
2195 * @{
2196 */
2197
2198/** Gets the configured database extension.
2199 * @param handle the context handle
2200 * @return the configured database extension
2201 */
2202const char *alpm_option_get_dbext(alpm_handle_t *handle);
2203
2204/** Sets the database extension.
2205 * @param handle the context handle
2206 * @param dbext the database extension to use
2207 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2208 */
2209int alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext);
2210/* End of dbext accessors */
2211/** @} */
2212
2213
2214/** @name Accessors for the signature levels
2215 * @{
2216 */
2217
2218/** Get the default siglevel.
2219 * @param handle the context handle
2220 * @return a \link alpm_siglevel_t \endlink bitfield of the siglevel
2221 */
2222int alpm_option_get_default_siglevel(alpm_handle_t *handle);
2223
2224/** Set the default siglevel.
2225 * @param handle the context handle
2226 * @param level a \link alpm_siglevel_t \endlink bitfield of the level to set
2227 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2228 */
2229int alpm_option_set_default_siglevel(alpm_handle_t *handle, int level);
2230
2231/** Get the configured local file siglevel.
2232 * @param handle the context handle
2233 * @return a \link alpm_siglevel_t \endlink bitfield of the siglevel
2234 */
2235int alpm_option_get_local_file_siglevel(alpm_handle_t *handle);
2236
2237/** Set the local file siglevel.
2238 * @param handle the context handle
2239 * @param level a \link alpm_siglevel_t \endlink bitfield of the level to set
2240 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2241 */
2242int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level);
2243
2244/** Get the configured remote file siglevel.
2245 * @param handle the context handle
2246 * @return a \link alpm_siglevel_t \endlink bitfield of the siglevel
2247 */
2248int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
2249
2250/** Set the remote file siglevel.
2251 * @param handle the context handle
2252 * @param level a \link alpm_siglevel_t \endlink bitfield of the level to set
2253 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2254 */
2255int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level);
2256/* End of signature accessors */
2257/** @} */
2258
2259
2260/** @name Accessors for download timeout
2261 *
2262 * By default, libalpm will timeout if a download has been transferring
2263 * less than 1 byte for 10 seconds.
2264 * @{
2265 */
2266
2267/** Enables/disables the download timeout.
2268 * @param handle the context handle
2269 * @param disable_dl_timeout 0 for enabled, 1 for disabled
2270 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2271 */
2272int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, unsigned short disable_dl_timeout);
2273/* End of disable_dl_timeout accessors */
2274/** @} */
2275
2276
2277/** @name Accessors for parallel downloads
2278 * \link alpm_db_update \endlink, \link alpm_fetch_pkgurl \endlink and
2279 * \link alpm_trans_commit \endlink can all download packages in parallel.
2280 * This setting configures how many packages can be downloaded in parallel,
2281 *
2282 * By default this value is set to 1, meaning packages are downloading
2283 * sequentially.
2284 *
2285 * @{
2286 */
2287
2288/** Gets the number of parallel streams to download database and package files.
2289 * @param handle the context handle
2290 * @return the number of parallel streams to download database and package files
2291 */
2292int alpm_option_get_parallel_downloads(alpm_handle_t *handle);
2293
2294/** Sets number of parallel streams to download database and package files.
2295 * @param handle the context handle
2296 * @param num_streams number of parallel download streams
2297 * @return 0 on success, -1 on error
2298 */
2299int alpm_option_set_parallel_downloads(alpm_handle_t *handle, unsigned int num_streams);
2300/* End of parallel_downloads accessors */
2301/** @} */
2302
2303/** @name Accessors for sandbox
2304 *
2305 * By default, libalpm will sandbox the downloader process.
2306 * @{
2307 */
2308
2309/** Enables/disables the sandbox.
2310 * @param handle the context handle
2311 * @param disable_sandbox 0 for enabled, 1 for disabled
2312 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2313 */
2314int alpm_option_set_disable_sandbox(alpm_handle_t *handle, unsigned short disable_sandbox);
2315/* End of disable_sandbox accessors */
2316/** @} */
2317
2318/* End of libalpm_options */
2319/** @} */
2320
2321
2322/** @addtogroup libalpm_packages Package Functions
2323 * Functions to manipulate libalpm packages
2324 * @{
2325 */
2326
2327/** Package install reasons. */
2328typedef enum _alpm_pkgreason_t {
2329 /** Explicitly requested by the user. */
2331 /** Installed as a dependency for another package. */
2333 /** Failed parsing of local database */
2336
2337/** Location a package object was loaded from. */
2338typedef enum _alpm_pkgfrom_t {
2339 /** Loaded from a file via \link alpm_pkg_load \endlink */
2341 /** From the local database */
2343 /** From a sync database */
2346
2347
2348/** Method used to validate a package. */
2349typedef enum _alpm_pkgvalidation_t {
2350 /** The package's validation type is unknown */
2352 /** The package does not have any validation */
2354 /** The package is validated with md5 */
2356 /** The package is validated with sha256 */
2358 /** The package is validated with a PGP signature */
2361
2362/** Create a package from a file.
2363 * If full is false, the archive is read only until all necessary
2364 * metadata is found. If it is true, the entire archive is read, which
2365 * serves as a verification of integrity and the filelist can be created.
2366 * The allocated structure should be freed using alpm_pkg_free().
2367 * @param handle the context handle
2368 * @param filename location of the package tarball
2369 * @param full whether to stop the load after metadata is read or continue
2370 * through the full archive
2371 * @param level what level of package signature checking to perform on the
2372 * package; note that this must be a '.sig' file type verification
2373 * @param pkg address of the package pointer
2374 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2375 */
2376int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
2377 int level, alpm_pkg_t **pkg);
2378
2379/** Fetch a list of remote packages.
2380 * @param handle the context handle
2381 * @param urls list of package URLs to download
2382 * @param fetched list of filepaths to the fetched packages, each item
2383 * corresponds to one in `urls` list. This is an output parameter,
2384 * the caller should provide a pointer to an empty list
2385 * (*fetched === NULL) and the callee fills the list with data.
2386 * @return 0 on success or -1 on failure
2387 */
2388int alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
2389 alpm_list_t **fetched);
2390
2391/** Find a package in a list by name.
2392 * @param haystack a list of alpm_pkg_t
2393 * @param needle the package name
2394 * @return a pointer to the package if found or NULL
2395 */
2396alpm_pkg_t *alpm_pkg_find(alpm_list_t *haystack, const char *needle);
2397
2398/** Free a package.
2399 * Only packages loaded with \link alpm_pkg_load \endlink can be freed.
2400 * Packages from databases will be freed by libalpm when they are unregistered.
2401 * @param pkg package pointer to free
2402 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2403 */
2404int alpm_pkg_free(alpm_pkg_t *pkg);
2405
2406/** Check the integrity (with md5) of a package from the sync cache.
2407 * @param pkg package pointer
2408 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2409 */
2410int alpm_pkg_checkmd5sum(alpm_pkg_t *pkg);
2411
2412/** Compare two version strings and determine which one is 'newer'.
2413 * Returns a value comparable to the way strcmp works. Returns 1
2414 * if a is newer than b, 0 if a and b are the same version, or -1
2415 * if b is newer than a.
2416 *
2417 * Different epoch values for version strings will override any further
2418 * comparison. If no epoch is provided, 0 is assumed.
2419 *
2420 * Keep in mind that the pkgrel is only compared if it is available
2421 * on both versions handed to this function. For example, comparing
2422 * 1.5-1 and 1.5 will yield 0; comparing 1.5-1 and 1.5-2 will yield
2423 * -1 as expected. This is mainly for supporting versioned dependencies
2424 * that do not include the pkgrel.
2425 */
2426int alpm_pkg_vercmp(const char *a, const char *b);
2427
2428/** Computes the list of packages requiring a given package.
2429 * The return value of this function is a newly allocated
2430 * list of package names (char*), it should be freed by the caller.
2431 * @param pkg a package
2432 * @return the list of packages requiring pkg
2433 */
2435
2436/** Computes the list of packages optionally requiring a given package.
2437 * The return value of this function is a newly allocated
2438 * list of package names (char*), it should be freed by the caller.
2439 * @param pkg a package
2440 * @return the list of packages optionally requiring pkg
2441 */
2443
2444/** Test if a package should be ignored.
2445 * Checks if the package is ignored via IgnorePkg, or if the package is
2446 * in a group ignored via IgnoreGroup.
2447 * @param handle the context handle
2448 * @param pkg the package to test
2449 * @return 1 if the package should be ignored, 0 otherwise
2450 */
2451int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
2452
2453/** @name Package Property Accessors
2454 * Any pointer returned by these functions points to internal structures
2455 * allocated by libalpm. They should not be freed nor modified in any
2456 * way.
2457 *
2458 * For loaded packages, they will be freed when \link alpm_pkg_free \endlink is called.
2459 * For database packages, they will be freed when the database is unregistered.
2460 * @{
2461 */
2462
2463/** Gets the handle of a package
2464 * @param pkg a pointer to package
2465 * @return the alpm handle that the package belongs to
2466 */
2467alpm_handle_t *alpm_pkg_get_handle(alpm_pkg_t *pkg);
2468
2469/** Gets the name of the file from which the package was loaded.
2470 * @param pkg a pointer to package
2471 * @return a reference to an internal string
2472 */
2473const char *alpm_pkg_get_filename(alpm_pkg_t *pkg);
2474
2475/** Returns the package base name.
2476 * @param pkg a pointer to package
2477 * @return a reference to an internal string
2478 */
2479const char *alpm_pkg_get_base(alpm_pkg_t *pkg);
2480
2481/** Returns the package name.
2482 * @param pkg a pointer to package
2483 * @return a reference to an internal string
2484 */
2485const char *alpm_pkg_get_name(alpm_pkg_t *pkg);
2486
2487/** Returns the package version as a string.
2488 * This includes all available epoch, version, and pkgrel components. Use
2489 * alpm_pkg_vercmp() to compare version strings if necessary.
2490 * @param pkg a pointer to package
2491 * @return a reference to an internal string
2492 */
2493const char *alpm_pkg_get_version(alpm_pkg_t *pkg);
2494
2495/** Returns the origin of the package.
2496 * @return an alpm_pkgfrom_t constant, -1 on error
2497 */
2498alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg);
2499
2500/** Returns the package description.
2501 * @param pkg a pointer to package
2502 * @return a reference to an internal string
2503 */
2504const char *alpm_pkg_get_desc(alpm_pkg_t *pkg);
2505
2506/** Returns the package URL.
2507 * @param pkg a pointer to package
2508 * @return a reference to an internal string
2509 */
2510const char *alpm_pkg_get_url(alpm_pkg_t *pkg);
2511
2512/** Returns the build timestamp of the package.
2513 * @param pkg a pointer to package
2514 * @return the timestamp of the build time
2515 */
2516alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
2517
2518/** Returns the install timestamp of the package.
2519 * @param pkg a pointer to package
2520 * @return the timestamp of the install time
2521 */
2522alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
2523
2524/** Returns the packager's name.
2525 * @param pkg a pointer to package
2526 * @return a reference to an internal string
2527 */
2528const char *alpm_pkg_get_packager(alpm_pkg_t *pkg);
2529
2530/** Returns the package's MD5 checksum as a string.
2531 * The returned string is a sequence of 32 lowercase hexadecimal digits.
2532 * @param pkg a pointer to package
2533 * @return a reference to an internal string
2534 */
2535const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg);
2536
2537/** Returns the package's SHA256 checksum as a string.
2538 * The returned string is a sequence of 64 lowercase hexadecimal digits.
2539 * @param pkg a pointer to package
2540 * @return a reference to an internal string
2541 */
2542const char *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg);
2543
2544/** Returns the architecture for which the package was built.
2545 * @param pkg a pointer to package
2546 * @return a reference to an internal string
2547 */
2548const char *alpm_pkg_get_arch(alpm_pkg_t *pkg);
2549
2550/** Returns the size of the package. This is only available for sync database
2551 * packages and package files, not those loaded from the local database.
2552 * @param pkg a pointer to package
2553 * @return the size of the package in bytes.
2554 */
2555off_t alpm_pkg_get_size(alpm_pkg_t *pkg);
2556
2557/** Returns the installed size of the package.
2558 * @param pkg a pointer to package
2559 * @return the total size of files installed by the package.
2560 */
2561off_t alpm_pkg_get_isize(alpm_pkg_t *pkg);
2562
2563/** Returns the package installation reason.
2564 * @param pkg a pointer to package
2565 * @return an enum member giving the install reason.
2566 */
2567alpm_pkgreason_t alpm_pkg_get_reason(alpm_pkg_t *pkg);
2568
2569/** Returns the list of package licenses.
2570 * @param pkg a pointer to package
2571 * @return a pointer to an internal list of strings.
2572 */
2573alpm_list_t *alpm_pkg_get_licenses(alpm_pkg_t *pkg);
2574
2575/** Returns the list of package groups.
2576 * @param pkg a pointer to package
2577 * @return a pointer to an internal list of strings.
2578 */
2579alpm_list_t *alpm_pkg_get_groups(alpm_pkg_t *pkg);
2580
2581/** Returns the list of package dependencies as alpm_depend_t.
2582 * @param pkg a pointer to package
2583 * @return a reference to an internal list of alpm_depend_t structures.
2584 */
2585alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
2586
2587/** Returns the list of package optional dependencies.
2588 * @param pkg a pointer to package
2589 * @return a reference to an internal list of alpm_depend_t structures.
2590 */
2591alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg);
2592
2593/** Returns a list of package check dependencies
2594 * @param pkg a pointer to package
2595 * @return a reference to an internal list of alpm_depend_t structures.
2596 */
2597alpm_list_t *alpm_pkg_get_checkdepends(alpm_pkg_t *pkg);
2598
2599/** Returns a list of package make dependencies
2600 * @param pkg a pointer to package
2601 * @return a reference to an internal list of alpm_depend_t structures.
2602 */
2603alpm_list_t *alpm_pkg_get_makedepends(alpm_pkg_t *pkg);
2604
2605/** Returns the list of packages conflicting with pkg.
2606 * @param pkg a pointer to package
2607 * @return a reference to an internal list of alpm_depend_t structures.
2608 */
2609alpm_list_t *alpm_pkg_get_conflicts(alpm_pkg_t *pkg);
2610
2611/** Returns the list of packages provided by pkg.
2612 * @param pkg a pointer to package
2613 * @return a reference to an internal list of alpm_depend_t structures.
2614 */
2615alpm_list_t *alpm_pkg_get_provides(alpm_pkg_t *pkg);
2616
2617/** Returns the list of packages to be replaced by pkg.
2618 * @param pkg a pointer to package
2619 * @return a reference to an internal list of alpm_depend_t structures.
2620 */
2621alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg);
2622
2623/** Returns the list of files installed by pkg.
2624 * The filenames are relative to the install root,
2625 * and do not include leading slashes.
2626 * @param pkg a pointer to package
2627 * @return a pointer to a filelist object containing a count and an array of
2628 * package file objects
2629 */
2630alpm_filelist_t *alpm_pkg_get_files(alpm_pkg_t *pkg);
2631
2632/** Returns the list of files backed up when installing pkg.
2633 * @param pkg a pointer to package
2634 * @return a reference to a list of alpm_backup_t objects
2635 */
2636alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg);
2637
2638/** Returns the database containing pkg.
2639 * Returns a pointer to the alpm_db_t structure the package is
2640 * originating from, or NULL if the package was loaded from a file.
2641 * @param pkg a pointer to package
2642 * @return a pointer to the DB containing pkg, or NULL.
2643 */
2644alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg);
2645
2646/** Returns the base64 encoded package signature.
2647 * @param pkg a pointer to package
2648 * @return a reference to an internal string
2649 */
2650const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg);
2651
2652/** Extracts package signature either from embedded package signature
2653 * or if it is absent then reads data from detached signature file.
2654 * @param pkg a pointer to package.
2655 * @param sig output parameter for signature data. Callee function allocates
2656 * a buffer needed for the signature data. Caller is responsible for
2657 * freeing this buffer.
2658 * @param sig_len output parameter for the signature data length.
2659 * @return 0 on success, negative number on error.
2660 */
2661int alpm_pkg_get_sig(alpm_pkg_t *pkg, unsigned char **sig, size_t *sig_len);
2662
2663/** Returns the method used to validate a package during install.
2664 * @param pkg a pointer to package
2665 * @return an enum member giving the validation method
2666 */
2667int alpm_pkg_get_validation(alpm_pkg_t *pkg);
2668
2669/** Gets the extended data field of a package.
2670 * @param pkg a pointer to package
2671 * @return a reference to a list of alpm_pkg_xdata_t objects
2672 */
2673alpm_list_t *alpm_pkg_get_xdata(alpm_pkg_t *pkg);
2674
2675/** Returns whether the package has an install scriptlet.
2676 * @return 0 if FALSE, TRUE otherwise
2677 */
2678int alpm_pkg_has_scriptlet(alpm_pkg_t *pkg);
2679
2680/** Returns the size of the files that will be downloaded to install a
2681 * package.
2682 * @param newpkg the new package to upgrade to
2683 * @return the size of the download
2684 */
2685off_t alpm_pkg_download_size(alpm_pkg_t *newpkg);
2686
2687/** Set install reason for a package in the local database.
2688 * The provided package object must be from the local database or this method
2689 * will fail. The write to the local database is performed immediately.
2690 * @param pkg the package to update
2691 * @param reason the new install reason
2692 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2693 */
2694int alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason);
2695
2696
2697/* End of libalpm_pkg_t accessors */
2698/** @} */
2699
2700
2701/** @name Changelog functions
2702 * Functions for reading the changelog
2703 * @{
2704 */
2705
2706/** Open a package changelog for reading.
2707 * Similar to fopen in functionality, except that the returned 'file
2708 * stream' could really be from an archive as well as from the database.
2709 * @param pkg the package to read the changelog of (either file or db)
2710 * @return a 'file stream' to the package changelog
2711 */
2712void *alpm_pkg_changelog_open(alpm_pkg_t *pkg);
2713
2714/** Read data from an open changelog 'file stream'.
2715 * Similar to fread in functionality, this function takes a buffer and
2716 * amount of data to read. If an error occurs pm_errno will be set.
2717 * @param ptr a buffer to fill with raw changelog data
2718 * @param size the size of the buffer
2719 * @param pkg the package that the changelog is being read from
2720 * @param fp a 'file stream' to the package changelog
2721 * @return the number of characters read, or 0 if there is no more data or an
2722 * error occurred.
2723 */
2724size_t alpm_pkg_changelog_read(void *ptr, size_t size,
2725 const alpm_pkg_t *pkg, void *fp);
2726
2727/** Close a package changelog for reading.
2728 * @param pkg the package to close the changelog of (either file or db)
2729 * @param fp the 'file stream' to the package changelog to close
2730 * @return 0 on success, -1 on error
2731 */
2732int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp);
2733
2734/* End of changelog accessors */
2735/** @} */
2736
2737
2738/** @name Mtree functions
2739 * Functions for reading the mtree
2740 * @{
2741 */
2742
2743/** Open a package mtree file for reading.
2744 * @param pkg the local package to read the mtree of
2745 * @return an archive structure for the package mtree file
2746 */
2747struct archive *alpm_pkg_mtree_open(alpm_pkg_t *pkg);
2748
2749/** Read next entry from a package mtree file.
2750 * @param pkg the package that the mtree file is being read from
2751 * @param archive the archive structure reading from the mtree file
2752 * @param entry an archive_entry to store the entry header information
2753 * @return 0 on success, 1 if end of archive is reached, -1 otherwise.
2754 */
2755int alpm_pkg_mtree_next(const alpm_pkg_t *pkg, struct archive *archive,
2756 struct archive_entry **entry);
2757
2758/** Close a package mtree file.
2759 * @param pkg the local package to close the mtree of
2760 * @param archive the archive to close
2761 */
2762int alpm_pkg_mtree_close(const alpm_pkg_t *pkg, struct archive *archive);
2763
2764/* End of mtree accessors */
2765/** @} */
2766
2767
2768/* End of libalpm_packages */
2769/** @} */
2770
2771/** @addtogroup libalpm_trans Transaction
2772 * @brief Functions to manipulate libalpm transactions
2773 *
2774 * Transactions are the way to add/remove packages to/from the system.
2775 * Only one transaction can exist at a time.
2776 *
2777 * The basic workflow of a transaction is to:
2778 *
2779 * - Initialize with \link alpm_trans_init \endlink
2780 * - Choose which packages to add with \link alpm_add_pkg \endlink and \link alpm_remove_pkg \endlink
2781 * - Prepare the transaction with \link alpm_trans_prepare \endlink
2782 * - Commit the transaction with \link alpm_trans_commit \endlink
2783 * - Release the transaction with \link alpm_trans_release \endlink
2784 *
2785 * A transaction can be released at any time. A transaction does not have to be committed.
2786 * @{
2787 */
2788
2789/** Transaction flags */
2790typedef enum _alpm_transflag_t {
2791 /** Ignore dependency checks. */
2793 /* (1 << 1) flag can go here */
2794 /** Delete files even if they are tagged as backup. */
2796 /** Ignore version numbers when checking dependencies. */
2798 /** Remove also any packages depending on a package being removed. */
2800 /** Remove packages and their unneeded deps (not explicitly installed). */
2802 /** Modify database but do not commit changes to the filesystem. */
2804 /** Do not run hooks during a transaction */
2806 /** Use ALPM_PKG_REASON_DEPEND when installing packages. */
2808 /** Only download packages and do not actually install. */
2810 /** Do not execute install scriptlets after installing. */
2812 /** Ignore dependency conflicts. */
2814 /* (1 << 12) flag can go here */
2815 /** Do not install a package if it is already installed and up to date. */
2817 /** Use ALPM_PKG_REASON_EXPLICIT when installing packages. */
2819 /** Do not remove a package if it is needed by another one. */
2821 /** Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE). */
2823 /** Do not lock the database during the operation. */
2824 ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
2826
2827/** Returns the bitfield of flags for the current transaction.
2828 * @param handle the context handle
2829 * @return the bitfield of transaction flags
2830 */
2831int alpm_trans_get_flags(alpm_handle_t *handle);
2832
2833/** Returns a list of packages added by the transaction.
2834 * @param handle the context handle
2835 * @return a list of alpm_pkg_t structures
2836 */
2837alpm_list_t *alpm_trans_get_add(alpm_handle_t *handle);
2838
2839/** Returns the list of packages removed by the transaction.
2840 * @param handle the context handle
2841 * @return a list of alpm_pkg_t structures
2842 */
2843alpm_list_t *alpm_trans_get_remove(alpm_handle_t *handle);
2844
2845/** Initialize the transaction.
2846 * @param handle the context handle
2847 * @param flags flags of the transaction (like nodeps, etc; see alpm_transflag_t)
2848 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2849 */
2850int alpm_trans_init(alpm_handle_t *handle, int flags);
2851
2852/** Prepare a transaction.
2853 * @param handle the context handle
2854 * @param data the address of an alpm_list where a list
2855 * of alpm_depmissing_t objects is dumped (conflicting packages)
2856 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2857 */
2858int alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data);
2859
2860/** Commit a transaction.
2861 * @param handle the context handle
2862 * @param data the address of an alpm_list where detailed description
2863 * of an error can be dumped (i.e. list of conflicting files)
2864 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2865 */
2866int alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data);
2867
2868/** Interrupt a transaction.
2869 * @param handle the context handle
2870 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2871 */
2872int alpm_trans_interrupt(alpm_handle_t *handle);
2873
2874/** Release a transaction.
2875 * @param handle the context handle
2876 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2877 */
2878int alpm_trans_release(alpm_handle_t *handle);
2879
2880/** @name Add/Remove packages
2881 * These functions remove/add packages to the transactions
2882 * @{
2883 * */
2884
2885/** Search for packages to upgrade and add them to the transaction.
2886 * @param handle the context handle
2887 * @param enable_downgrade allow downgrading of packages if the remote version is lower
2888 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2889 */
2890int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade);
2891
2892/** Add a package to the transaction.
2893 * If the package was loaded by alpm_pkg_load(), it will be freed upon
2894 * \link alpm_trans_release \endlink invocation.
2895 * @param handle the context handle
2896 * @param pkg the package to add
2897 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2898 */
2899int alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg);
2900
2901/** Add a package removal to the transaction.
2902 * @param handle the context handle
2903 * @param pkg the package to uninstall
2904 * @return 0 on success, -1 on error (pm_errno is set accordingly)
2905 */
2906int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg);
2907
2908/* End of add/remove packages */
2909/** @} */
2910
2911
2912/* End of libalpm_trans */
2913/** @} */
2914
2915
2916/** \addtogroup libalpm_misc Miscellaneous Functions
2917 * @brief Various libalpm functions
2918 * @{
2919 */
2920
2921/** Check for new version of pkg in syncdbs.
2922 *
2923 * If the same package appears multiple dbs only the first will be checked
2924 *
2925 * This only checks the syncdb for a newer version. It does not access the network at all.
2926 * See \link alpm_db_update \endlink to update a database.
2927 */
2928alpm_pkg_t *alpm_sync_get_new_version(alpm_pkg_t *pkg, alpm_list_t *dbs_sync);
2929
2930/** Get the md5 sum of file.
2931 * @param filename name of the file
2932 * @return the checksum on success, NULL on error
2933 */
2934char *alpm_compute_md5sum(const char *filename);
2935
2936/** Get the sha256 sum of file.
2937 * @param filename name of the file
2938 * @return the checksum on success, NULL on error
2939 */
2940char *alpm_compute_sha256sum(const char *filename);
2941
2942/** Remove the database lock file
2943 * @param handle the context handle
2944 * @return 0 on success, -1 on error
2945 *
2946 * @note Safe to call from inside signal handlers.
2947 */
2948int alpm_unlock(alpm_handle_t *handle);
2949
2950/** Enum of possible compile time features */
2952 /** localization */
2954 /** Ability to download */
2956 /** Signature checking */
2959
2960/** Get the version of library.
2961 * @return the library version, e.g. "6.0.4"
2962 * */
2963const char *alpm_version(void);
2964
2965/** Get the capabilities of the library.
2966 * @return a bitmask of the capabilities
2967 * */
2968int alpm_capabilities(void);
2969
2970/** Drop privileges by switching to a different user.
2971 * @param handle the context handle
2972 * @param sandboxuser the user to switch to
2973 * @param sandbox_path if non-NULL, restrict writes to this filesystem path
2974 * @return 0 on success, -1 on failure
2975 */
2976int alpm_sandbox_setup_child(alpm_handle_t *handle, const char *sandboxuser, const char *sandbox_path);
2977
2978/* End of libalpm_misc */
2979/** @} */
2980
2981/* End of libalpm_api */
2982/** @} */
2983
2984#ifdef __cplusplus
2985}
2986#endif
2987#endif /* ALPM_H */
alpm_question_type_t type
Type of question.
Definition alpm.h:1076
alpm_question_type_t type
Type of question.
Definition alpm.h:1008
int install
Answer: whether or not to install pkg anyway.
Definition alpm.h:1010
int replace
Answer: whether or not to replace oldpkg with newpkg.
Definition alpm.h:1020
int optional
whether this file is optional and thus the errors could be ignored
Definition alpm.h:1182
alpm_question_type_t type
Type of question.
Definition alpm.h:1018
alpm_pkg_t * newpkg
New Package.
Definition alpm.h:880
int use_index
Answer: which provider to use (index from providers)
Definition alpm.h:1066
alpm_question_type_t type
The type of question.
Definition alpm.h:1093
alpm_event_type_t type
Type of event.
Definition alpm.h:874
const char * file
Filename of the file without the .pacnew suffix.
Definition alpm.h:882
alpm_event_scriptlet_info_t scriptlet_info
A scriptlet was ran.
Definition alpm.h:950
off_t downloaded
Amount of data downloaded.
Definition alpm.h:1188
const char * uid
UID of the key to import.
Definition alpm.h:1080
alpm_question_corrupted_t corrupted
Should a corrupted package be deleted?
Definition alpm.h:1104
int from_noupgrade
Whether the creation was result of a NoUpgrade or not.
Definition alpm.h:876
alpm_depend_t * depend
What providers provide for.
Definition alpm.h:1070
alpm_question_type_t type
Type of question.
Definition alpm.h:1000
alpm_event_type_t type
Type of event.
Definition alpm.h:866
alpm_package_operation_t operation
Type of operation.
Definition alpm.h:826
const char * name
Name of hook.
Definition alpm.h:916
alpm_event_package_operation_t package_operation
Package operation.
Definition alpm.h:946
alpm_event_hook_run_t hook_run
A hook was ran.
Definition alpm.h:962
alpm_event_type_t type
Type of event.
Definition alpm.h:888
alpm_question_any_t any
A question that can represent any question.
Definition alpm.h:1096
alpm_event_database_missing_t database_missing
A database is missing.
Definition alpm.h:952
alpm_pkg_t * newpkg
Package to replace with.
Definition alpm.h:1024
int resume
If the download will resume or start over.
Definition alpm.h:1196
alpm_errno_t reason
Error code indicating the reason for package invalidity.
Definition alpm.h:1048
alpm_pkg_t * newpkg
New package.
Definition alpm.h:830
alpm_pkg_t * oldpkg
Old package.
Definition alpm.h:878
size_t position
position of hook being run
Definition alpm.h:920
alpm_hook_when_t when
Type of hook.
Definition alpm.h:908
int answer
Answer.
Definition alpm.h:1002
alpm_question_select_provider_t select_provider
Provider selection.
Definition alpm.h:1108
alpm_event_pkg_retrieve_t pkg_retrieve
Download packages.
Definition alpm.h:964
alpm_pkg_t * oldpkg
Old package.
Definition alpm.h:890
alpm_question_install_ignorepkg_t install_ignorepkg
Should target in ignorepkg be installed anyway?
Definition alpm.h:1098
const char * line
Line of scriptlet output.
Definition alpm.h:848
alpm_list_t * packages
List of alpm_pkg_t* with unresolved dependencies.
Definition alpm.h:1058
alpm_event_type_t type
Type of event.
Definition alpm.h:846
size_t total
total hooks being run
Definition alpm.h:922
alpm_question_remove_pkgs_t remove_pkgs
Should unresolvable targets be removed from the transaction?
Definition alpm.h:1106
size_t num
Number of packages to download.
Definition alpm.h:930
off_t total
Total amount need to be downloaded.
Definition alpm.h:1190
alpm_event_type_t type
Type of event.
Definition alpm.h:824
const char * desc
Description of hook to be outputted.
Definition alpm.h:918
alpm_event_type_t type
Type of event it's always safe to access this.
Definition alpm.h:942
alpm_event_pacsave_created_t pacsave_created
A pacsave file was created.
Definition alpm.h:958
int skip
Answer: whether or not to skip packages.
Definition alpm.h:1056
alpm_pkg_t * oldpkg
Old package.
Definition alpm.h:828
off_t total_size
Total size of packages to download.
Definition alpm.h:932
alpm_question_type_t type
Type of question.
Definition alpm.h:1054
alpm_list_t * providers
List of alpm_pkg_t* as possible providers.
Definition alpm.h:1068
int result
download result code: 0 - download completed successfully 1 - the file is up-to-date -1 - error
Definition alpm.h:1208
alpm_question_type_t type
Type of question.
Definition alpm.h:1064
alpm_question_import_key_t import_key
Should a key be imported?
Definition alpm.h:1110
alpm_event_pkgdownload_t pkgdownload
A package was downloaded.
Definition alpm.h:954
alpm_question_replace_t replace
Should a package be replaced?
Definition alpm.h:1100
alpm_event_type_t type
Type of event.
Definition alpm.h:928
alpm_pkg_t * oldpkg
Package to be replaced.
Definition alpm.h:1022
alpm_event_type_t type
Type of event.
Definition alpm.h:836
alpm_pkg_t * pkg
Package with the optdep.
Definition alpm.h:838
const char * dbname
Name of the database.
Definition alpm.h:860
alpm_event_type_t type
Type of event.
Definition alpm.h:804
alpm_event_type_t type
Type of event.
Definition alpm.h:906
alpm_event_hook_t hook
Pre/post transaction hooks are being ran.
Definition alpm.h:960
alpm_conflict_t * conflict
Conflict info.
Definition alpm.h:1036
alpm_event_type_t type
Type of event.
Definition alpm.h:858
int remove
Answer: whether or not to remove filepath.
Definition alpm.h:1044
alpm_question_type_t type
Type of question.
Definition alpm.h:1042
alpm_event_pacnew_created_t pacnew_created
A pacnew file was created.
Definition alpm.h:956
alpm_question_conflict_t conflict
Should a conflicting package be removed?
Definition alpm.h:1102
alpm_event_optdep_removal_t optdep_removal
An optdept was remove.
Definition alpm.h:948
alpm_question_type_t type
Type of question.
Definition alpm.h:1032
alpm_db_t * newdb
DB of newpkg.
Definition alpm.h:1026
const char * filepath
File to remove.
Definition alpm.h:1046
alpm_pkg_t * pkg
The ignored package that we are deciding whether to install.
Definition alpm.h:1012
int remove
Answer: whether or not to remove conflict->package2.
Definition alpm.h:1034
alpm_depend_t * optdep
Optdep being removed.
Definition alpm.h:840
alpm_event_type_t type
Type of event.
Definition alpm.h:914
const char * file
Filename of the file without the .pacsave suffix.
Definition alpm.h:892
off_t total
Total bytes in file.
Definition alpm.h:1202
const char * fingerprint
Fingerprint the key to import.
Definition alpm.h:1082
alpm_event_any_t any
The any event type.
Definition alpm.h:944
const char * file
Name of the file.
Definition alpm.h:868
void(* alpm_cb_question)(void *ctx, alpm_question_t *question)
Question callback.
Definition alpm.h:1119
alpm_download_event_type_t
File download events.
Definition alpm.h:1168
alpm_hook_when_t
Kind of hook.
Definition alpm.h:896
alpm_progress_t
An enum over different kinds of progress alerts.
Definition alpm.h:1122
int(* alpm_cb_fetch)(void *ctx, const char *url, const char *localpath, int force)
A callback for downloading files.
Definition alpm.h:1229
alpm_question_type_t
Type of question.
Definition alpm.h:980
void(* alpm_cb_event)(void *ctx, alpm_event_t *event)
Event callback.
Definition alpm.h:972
void(* alpm_cb_progress)(void *ctx, alpm_progress_t progress, const char *pkg, int percent, size_t howmany, size_t current)
Progress callback.
Definition alpm.h:1158
alpm_event_type_t
Type of events.
Definition alpm.h:718
alpm_package_operation_t
An enum over the kind of package operations.
Definition alpm.h:808
void(* alpm_cb_download)(void *ctx, const char *filename, alpm_download_event_type_t event, void *data)
Type of download progress callbacks.
Definition alpm.h:1217
@ ALPM_DOWNLOAD_PROGRESS
A download made progress.
Definition alpm.h:1172
@ ALPM_DOWNLOAD_COMPLETED
A download completed.
Definition alpm.h:1176
@ ALPM_DOWNLOAD_INIT
A download was started.
Definition alpm.h:1170
@ ALPM_DOWNLOAD_RETRY
Download will be retried.
Definition alpm.h:1174
@ ALPM_HOOK_PRE_TRANSACTION
Definition alpm.h:898
@ ALPM_HOOK_POST_TRANSACTION
Definition alpm.h:900
@ ALPM_PROGRESS_DISKSPACE_START
Diskspace checking.
Definition alpm.h:1136
@ ALPM_PROGRESS_DOWNGRADE_START
Package downgrade.
Definition alpm.h:1128
@ ALPM_PROGRESS_REINSTALL_START
Package reinstall.
Definition alpm.h:1130
@ ALPM_PROGRESS_INTEGRITY_START
Package Integrity checking.
Definition alpm.h:1138
@ ALPM_PROGRESS_KEYRING_START
Checking signatures of packages.
Definition alpm.h:1142
@ ALPM_PROGRESS_UPGRADE_START
Package upgrade.
Definition alpm.h:1126
@ ALPM_PROGRESS_ADD_START
Package install.
Definition alpm.h:1124
@ ALPM_PROGRESS_CONFLICTS_START
Conflict checking.
Definition alpm.h:1134
@ ALPM_PROGRESS_LOAD_START
Loading packages from disk.
Definition alpm.h:1140
@ ALPM_PROGRESS_REMOVE_START
Package removal.
Definition alpm.h:1132
@ ALPM_QUESTION_CORRUPTED_PKG
Should a corrupted package be deleted?
Definition alpm.h:988
@ ALPM_QUESTION_INSTALL_IGNOREPKG
Should target in ignorepkg be installed anyway?
Definition alpm.h:982
@ ALPM_QUESTION_SELECT_PROVIDER
Provider selection.
Definition alpm.h:992
@ ALPM_QUESTION_REMOVE_PKGS
Should unresolvable targets be removed from the transaction?
Definition alpm.h:990
@ ALPM_QUESTION_CONFLICT_PKG
Should a conflicting package be removed?
Definition alpm.h:986
@ ALPM_QUESTION_REPLACE_PKG
Should a package be replaced?
Definition alpm.h:984
@ ALPM_QUESTION_IMPORT_KEY
Should a key be imported?
Definition alpm.h:994
@ ALPM_EVENT_CHECKDEPS_DONE
Dependencies were computed for a package.
Definition alpm.h:722
@ ALPM_EVENT_KEY_DOWNLOAD_DONE
Key downloading is finished.
Definition alpm.h:785
@ ALPM_EVENT_KEY_DOWNLOAD_START
Downloading missing keys into keyring.
Definition alpm.h:783
@ ALPM_EVENT_HOOK_START
Processing hooks will be started.
Definition alpm.h:792
@ ALPM_EVENT_TRANSACTION_DONE
Processing the package transaction is finished.
Definition alpm.h:738
@ ALPM_EVENT_PACKAGE_OPERATION_START
Package will be installed/upgraded/downgraded/re-installed/removed; See alpm_event_package_operation_...
Definition alpm.h:741
@ ALPM_EVENT_INTEGRITY_START
Target package's integrity will be checked.
Definition alpm.h:746
@ ALPM_EVENT_CHECKDEPS_START
Dependencies will be computed for a package.
Definition alpm.h:720
@ ALPM_EVENT_FILECONFLICTS_START
File conflicts will be computed for a package.
Definition alpm.h:724
@ ALPM_EVENT_DISKSPACE_START
Disk space usage will be computed for a package.
Definition alpm.h:769
@ ALPM_EVENT_DISKSPACE_DONE
Disk space usage was computed for a package.
Definition alpm.h:771
@ ALPM_EVENT_PACNEW_CREATED
A .pacnew file was created; See alpm_event_pacnew_created_t for arguments.
Definition alpm.h:787
@ ALPM_EVENT_PACSAVE_CREATED
A .pacsave file was created; See alpm_event_pacsave_created_t for arguments.
Definition alpm.h:790
@ ALPM_EVENT_SCRIPTLET_INFO
Scriptlet has printed information; See alpm_event_scriptlet_info_t for arguments.
Definition alpm.h:755
@ ALPM_EVENT_RESOLVEDEPS_START
Dependencies will be resolved for target package.
Definition alpm.h:728
@ ALPM_EVENT_DATABASE_MISSING
A configured repository database is missing; See alpm_event_database_missing_t for arguments.
Definition alpm.h:777
@ ALPM_EVENT_PACKAGE_OPERATION_DONE
Package was installed/upgraded/downgraded/re-installed/removed; See alpm_event_package_operation_t fo...
Definition alpm.h:744
@ ALPM_EVENT_DB_RETRIEVE_FAILED
Not all database files were successfully downloaded from a repository.
Definition alpm.h:761
@ ALPM_EVENT_INTEGRITY_DONE
Target package's integrity was checked.
Definition alpm.h:748
@ ALPM_EVENT_HOOK_DONE
Processing hooks is finished.
Definition alpm.h:794
@ ALPM_EVENT_PKG_RETRIEVE_FAILED
Not all package files were successfully downloaded from a repository.
Definition alpm.h:767
@ ALPM_EVENT_PKG_RETRIEVE_DONE
Package files were downloaded from a repository.
Definition alpm.h:765
@ ALPM_EVENT_INTERCONFLICTS_DONE
Inter-conflicts were checked for target package.
Definition alpm.h:734
@ ALPM_EVENT_LOAD_DONE
Target package is finished loading.
Definition alpm.h:752
@ ALPM_EVENT_FILECONFLICTS_DONE
File conflicts were computed for a package.
Definition alpm.h:726
@ ALPM_EVENT_LOAD_START
Target package will be loaded.
Definition alpm.h:750
@ ALPM_EVENT_PKG_RETRIEVE_START
Package files will be downloaded from a repository.
Definition alpm.h:763
@ ALPM_EVENT_HOOK_RUN_DONE
A hook has finished running.
Definition alpm.h:798
@ ALPM_EVENT_TRANSACTION_START
Processing the package transaction is starting.
Definition alpm.h:736
@ ALPM_EVENT_OPTDEP_REMOVAL
An optdepend for another package is being removed; See alpm_event_optdep_removal_t for arguments.
Definition alpm.h:774
@ ALPM_EVENT_INTERCONFLICTS_START
Inter-conflicts will be checked for target package.
Definition alpm.h:732
@ ALPM_EVENT_DB_RETRIEVE_START
Database files will be downloaded from a repository.
Definition alpm.h:757
@ ALPM_EVENT_KEYRING_DONE
Keyring checking is finished.
Definition alpm.h:781
@ ALPM_EVENT_RESOLVEDEPS_DONE
Dependencies were resolved for target package.
Definition alpm.h:730
@ ALPM_EVENT_DB_RETRIEVE_DONE
Database files were downloaded from a repository.
Definition alpm.h:759
@ ALPM_EVENT_KEYRING_START
Checking keys used to create signatures are in keyring.
Definition alpm.h:779
@ ALPM_EVENT_HOOK_RUN_START
A hook is starting.
Definition alpm.h:796
@ ALPM_PACKAGE_INSTALL
Package (to be) installed.
Definition alpm.h:810
@ ALPM_PACKAGE_UPGRADE
Package (to be) upgraded.
Definition alpm.h:812
@ ALPM_PACKAGE_REMOVE
Package (to be) removed (No newpkg)
Definition alpm.h:818
@ ALPM_PACKAGE_REINSTALL
Package (to be) re-installed.
Definition alpm.h:814
@ ALPM_PACKAGE_DOWNGRADE
Package (to be) downgraded.
Definition alpm.h:816
Context struct for when a download completes.
Definition alpm.h:1200
Context struct for when a download starts.
Definition alpm.h:1180
Context struct for when a download progresses.
Definition alpm.h:1186
Context struct for when a download retries.
Definition alpm.h:1194
An event that may represent any event.
Definition alpm.h:802
A database is missing.
Definition alpm.h:856
A pre/post transaction hook was ran.
Definition alpm.h:912
pre/post transaction hooks are to be ran.
Definition alpm.h:904
An optional dependency was removed.
Definition alpm.h:834
A package operation event occurred.
Definition alpm.h:822
A pacnew file was created.
Definition alpm.h:872
A pacsave file was created.
Definition alpm.h:886
Packages downloading about to start.
Definition alpm.h:926
A package was downloaded.
Definition alpm.h:864
A scriptlet was ran.
Definition alpm.h:844
A question that can represent any other question.
Definition alpm.h:998
Should a conflicting package be removed?
Definition alpm.h:1030
Should a corrupted package be deleted?
Definition alpm.h:1040
Should a key be imported?
Definition alpm.h:1074
Should target in ignorepkg be installed anyway?
Definition alpm.h:1006
Should unresolvable targets be removed from the transaction?
Definition alpm.h:1052
Should a package be replaced?
Definition alpm.h:1016
Provider selection.
Definition alpm.h:1062
Events.
Definition alpm.h:940
Questions.
Definition alpm.h:1091
alpm_group_t * alpm_db_get_group(alpm_db_t *db, const char *name)
Get a group entry from a package database.
Definition db.c:328
int alpm_db_unregister(alpm_db_t *db)
Unregister a package database.
Definition db.c:98
int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers)
Sets the list of servers for the database to use.
Definition db.c:160
int alpm_db_set_cache_servers(alpm_db_t *db, alpm_list_t *servers)
Sets the list of cache servers for the database to use.
Definition db.c:140
int alpm_db_add_cache_server(alpm_db_t *db, const char *url)
Add a download cache server to a database.
Definition db.c:187
alpm_list_t * alpm_db_get_cache_servers(const alpm_db_t *db)
Get the list of cache servers assigned to this db.
Definition db.c:134
int alpm_db_get_valid(alpm_db_t *db)
Check the validity of a database.
Definition db.c:299
alpm_list_t * alpm_db_get_groupcache(alpm_db_t *db)
Get the group cache of a package database.
Definition db.c:338
alpm_list_t * alpm_db_get_pkgcache(alpm_db_t *db)
Get the package cache of a package database.
Definition db.c:321
alpm_list_t * alpm_get_syncdbs(alpm_handle_t *handle)
Get the list of sync databases.
Definition handle.c:839
alpm_db_t * alpm_register_syncdb(alpm_handle_t *handle, const char *treename, int level)
Register a sync database of packages.
Definition db.c:40
int alpm_db_get_siglevel(alpm_db_t *db)
Get the signature verification level for a database.
Definition db.c:289
int alpm_db_remove_cache_server(alpm_db_t *db, const char *url)
Remove a download cache server from a database.
Definition db.c:225
int alpm_db_add_server(alpm_db_t *db, const char *url)
Add a download server to a database.
Definition db.c:206
const char * alpm_db_get_name(const alpm_db_t *db)
Get the name of a package database.
Definition db.c:283
int alpm_db_search(alpm_db_t *db, const alpm_list_t *needles, alpm_list_t **ret)
Searches a database with regular expressions.
Definition db.c:346
int alpm_db_set_usage(alpm_db_t *db, int usage)
Sets the usage of a database.
Definition db.c:356
alpm_list_t * alpm_db_get_servers(const alpm_db_t *db)
Get the list of servers assigned to this db.
Definition db.c:154
alpm_db_usage_t
The usage level of a database.
Definition alpm.h:1449
alpm_handle_t * alpm_db_get_handle(alpm_db_t *db)
Get the handle of a package database.
Definition db.c:277
alpm_pkg_t * alpm_db_get_pkg(alpm_db_t *db, const char *name)
Get a package entry from a package database.
Definition db.c:306
int alpm_unregister_all_syncdbs(alpm_handle_t *handle)
Unregister all package databases.
Definition db.c:78
alpm_db_t * alpm_get_localdb(alpm_handle_t *handle)
Get the database of locally installed packages.
Definition handle.c:833
int alpm_db_get_usage(alpm_db_t *db, int *usage)
Gets the usage of a database.
Definition db.c:363
int alpm_db_remove_server(alpm_db_t *db, const char *url)
Remove a download server from a database.
Definition db.c:251
int alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force)
Update package databases.
Definition be_sync.c:139
@ ALPM_DB_USAGE_SEARCH
Enable search for this database.
Definition alpm.h:1453
@ ALPM_DB_USAGE_SYNC
Enable refreshes for this database.
Definition alpm.h:1451
@ ALPM_DB_USAGE_ALL
Enable all usage levels.
Definition alpm.h:1459
@ ALPM_DB_USAGE_INSTALL
Enable installing packages from this database.
Definition alpm.h:1455
@ ALPM_DB_USAGE_UPGRADE
Enable sysupgrades with this database.
Definition alpm.h:1457
alpm_depend_t * depend
The dependency that was wanted.
Definition alpm.h:595
alpm_depend_t * reason
The conflict.
Definition alpm.h:608
char * desc
A description of why this dependency is needed (optional)
Definition alpm.h:583
char * name
Name of the provider to satisfy this dependency.
Definition alpm.h:579
char * version
Version of the provider to match against (optional)
Definition alpm.h:581
alpm_pkg_t * package2
The second package.
Definition alpm.h:606
char * target
Name of the package that has the dependency.
Definition alpm.h:593
alpm_fileconflicttype_t type
The type of conflict.
Definition alpm.h:620
char * target
The name of the package that caused the conflict.
Definition alpm.h:618
char * causingpkg
If the depmissing was caused by a conflict, the name of the package that would be installed,...
Definition alpm.h:598
char * file
The name of the file that the package conflicts with.
Definition alpm.h:622
char * ctarget
The name of the package that also owns the file if there is one.
Definition alpm.h:624
alpm_pkg_t * package1
The first package.
Definition alpm.h:604
alpm_depmod_t mod
How the version should match against the provider.
Definition alpm.h:587
unsigned long name_hash
A hash of name (used internally to speed up conflict checks)
Definition alpm.h:585
alpm_pkg_t * alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
Find a package satisfying a specified dependency.
Definition deps.c:289
void alpm_fileconflict_free(alpm_fileconflict_t *conflict)
Free a fileconflict and its members.
Definition conflict.c:289
char * alpm_dep_compute_string(const alpm_depend_t *dep)
Returns a newly allocated string representing the dependency information.
Definition deps.c:865
alpm_list_t * alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglist, alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps)
Checks dependencies and returns missing ones in a list.
Definition deps.c:300
alpm_depend_t * alpm_dep_from_string(const char *depstring)
Return a newly allocated dependency information parsed from a string should be used to free the depen...
Definition deps.c:458
alpm_pkg_t * alpm_find_dbs_satisfier(alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring)
Find a package satisfying a specified dependency.
Definition deps.c:751
alpm_list_t * alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist)
Check the package conflicts in a database.
Definition conflict.c:240
void alpm_depmissing_free(alpm_depmissing_t *miss)
Free a depmissing and its members.
Definition deps.c:65
void alpm_dep_free(alpm_depend_t *dep)
Free a dependency info structure.
Definition deps.c:38
void alpm_conflict_free(alpm_conflict_t *conflict)
Free a conflict and its members.
Definition conflict.c:64
alpm_depmod_t
Types of version constraints in dependency specs.
Definition alpm.h:546
alpm_fileconflicttype_t
File conflict type.
Definition alpm.h:566
@ ALPM_DEP_MOD_LE
Test for at most a version (package<=x.y.z)
Definition alpm.h:554
@ ALPM_DEP_MOD_GT
Test for greater than some version (package>x.y.z)
Definition alpm.h:556
@ ALPM_DEP_MOD_GE
Test for at least a version (package>=x.y.z)
Definition alpm.h:552
@ ALPM_DEP_MOD_LT
Test for less than some version (package<x.y.z)
Definition alpm.h:558
@ ALPM_DEP_MOD_ANY
No version constraint.
Definition alpm.h:548
@ ALPM_DEP_MOD_EQ
Test version equality (package=x.y.z)
Definition alpm.h:550
@ ALPM_FILECONFLICT_TARGET
The conflict results with a another target in the transaction.
Definition alpm.h:568
@ ALPM_FILECONFLICT_FILESYSTEM
The conflict results from a file existing on the filesystem.
Definition alpm.h:570
A conflict that has occurred between two packages.
Definition alpm.h:602
The basic dependency type.
Definition alpm.h:577
Missing dependency.
Definition alpm.h:591
File conflict.
Definition alpm.h:616
const char * alpm_strerror(alpm_errno_t err)
Returns the string corresponding to an error number.
Definition error.c:35
alpm_errno_t
libalpm's error type
Definition alpm.h:205
alpm_errno_t alpm_errno(alpm_handle_t *handle)
Returns the current error code from the handle.
Definition error.c:30
@ ALPM_ERR_SIG_INVALID
Signatures are invalid.
Definition alpm.h:301
@ ALPM_ERR_TRANS_NOT_NULL
A transaction is already initialized.
Definition alpm.h:257
@ ALPM_ERR_CONFLICTING_DEPS
Conflicting dependencies.
Definition alpm.h:306
@ ALPM_ERR_TRANS_NULL
A transaction has not been initialized.
Definition alpm.h:259
@ ALPM_ERR_SIG_MISSING
Signatures are missing.
Definition alpm.h:299
@ ALPM_ERR_DB_NULL
Database should not be null.
Definition alpm.h:235
@ ALPM_ERR_TRANS_NOT_LOCKED
Tried to commit transaction without locking the database.
Definition alpm.h:273
@ ALPM_ERR_OK
No error.
Definition alpm.h:207
@ ALPM_ERR_DB_REMOVE
Failed to remove entry from database.
Definition alpm.h:249
@ ALPM_ERR_GPGME
Error in gpgme.
Definition alpm.h:322
@ ALPM_ERR_UNSATISFIED_DEPS
Dependencies could not be satisfied.
Definition alpm.h:304
@ ALPM_ERR_EXTERNAL_DOWNLOAD
Error in external download program.
Definition alpm.h:320
@ ALPM_ERR_PKG_IGNORED
Package is in ignorepkg.
Definition alpm.h:280
@ ALPM_ERR_SYSTEM
A system error occurred.
Definition alpm.h:211
@ ALPM_ERR_MEMORY
Failed to allocate memory.
Definition alpm.h:209
@ ALPM_ERR_TRANS_NOT_PREPARED
Transaction has not been prepared.
Definition alpm.h:267
@ ALPM_ERR_LIBARCHIVE
Error in libarchive.
Definition alpm.h:316
@ ALPM_ERR_PKG_OPEN
Cannot open the package file.
Definition alpm.h:290
@ ALPM_ERR_PKG_NOT_FOUND
Package not found.
Definition alpm.h:278
@ ALPM_ERR_PKG_INVALID_SIG
Package has an invalid signature.
Definition alpm.h:286
@ ALPM_ERR_DB_CREATE
Failed to create database.
Definition alpm.h:233
@ ALPM_ERR_DB_VERSION
The localdb is in a newer/older format than libalpm expects.
Definition alpm.h:245
@ ALPM_ERR_DB_WRITE
Failed to write to the database.
Definition alpm.h:247
@ ALPM_ERR_DB_OPEN
Failed to open database.
Definition alpm.h:231
@ ALPM_ERR_BADPERMS
Permmision denied.
Definition alpm.h:213
@ ALPM_ERR_MISSING_CAPABILITY_SIGNATURES
Missing compile-time features.
Definition alpm.h:324
@ ALPM_ERR_TRANS_ABORT
Transaction was aborted.
Definition alpm.h:269
@ ALPM_ERR_TRANS_DUP_FILENAME
Duplicate filename in transaction.
Definition alpm.h:263
@ ALPM_ERR_RETRIEVE
Download failed.
Definition alpm.h:311
@ ALPM_ERR_PKG_INVALID_ARCH
Package has an invalid architecture.
Definition alpm.h:296
@ ALPM_ERR_TRANS_TYPE
Failed to interrupt transaction.
Definition alpm.h:271
@ ALPM_ERR_HANDLE_NOT_NULL
Handle should not be null.
Definition alpm.h:226
@ ALPM_ERR_HANDLE_NULL
Handle should be null.
Definition alpm.h:224
@ ALPM_ERR_DB_NOT_FOUND
The database could not be found.
Definition alpm.h:239
@ ALPM_ERR_TRANS_HOOK_FAILED
A hook failed to run.
Definition alpm.h:275
@ ALPM_ERR_HANDLE_LOCK
Failed to acquire lock.
Definition alpm.h:228
@ ALPM_ERR_DB_INVALID_SIG
Database has an invalid signature.
Definition alpm.h:243
@ ALPM_ERR_INVALID_REGEX
Invalid Regex.
Definition alpm.h:313
@ ALPM_ERR_NOT_A_FILE
Should be a file.
Definition alpm.h:215
@ ALPM_ERR_TRANS_DUP_TARGET
Duplicate target in transaction.
Definition alpm.h:261
@ ALPM_ERR_PKG_MISSING_SIG
Package does not have a signature.
Definition alpm.h:288
@ ALPM_ERR_PKG_INVALID
Package is invalid.
Definition alpm.h:282
@ ALPM_ERR_NOT_A_DIR
Should be a directory.
Definition alpm.h:217
@ ALPM_ERR_SERVER_BAD_URL
Server URL is in an invalid format.
Definition alpm.h:252
@ ALPM_ERR_LIBCURL
Error in libcurl.
Definition alpm.h:318
@ ALPM_ERR_PKG_INVALID_NAME
Package has an invalid name.
Definition alpm.h:294
@ ALPM_ERR_SERVER_NONE
The database has no configured servers.
Definition alpm.h:254
@ ALPM_ERR_DB_INVALID
Database is invalid.
Definition alpm.h:241
@ ALPM_ERR_TRANS_NOT_INITIALIZED
A transaction has not been initialized.
Definition alpm.h:265
@ ALPM_ERR_DISK_SPACE
Insufficient disk space.
Definition alpm.h:221
@ ALPM_ERR_FILE_CONFLICTS
Files conflict.
Definition alpm.h:308
@ ALPM_ERR_WRONG_ARGS
Function was called with invalid arguments.
Definition alpm.h:219
@ ALPM_ERR_PKG_CANT_REMOVE
Failed to remove package files.
Definition alpm.h:292
@ ALPM_ERR_PKG_INVALID_CHECKSUM
Package has an invalid checksum.
Definition alpm.h:284
@ ALPM_ERR_DB_NOT_NULL
Database should be null.
Definition alpm.h:237
char * name
Name of the file (without .pacsave extension)
Definition alpm.h:154
off_t size
Size of the file.
Definition alpm.h:138
char * hash
Hash of the filename (used internally)
Definition alpm.h:156
alpm_file_t * files
An array of files.
Definition alpm.h:148
size_t count
Amount of files in the array.
Definition alpm.h:146
char * name
Name of the file.
Definition alpm.h:136
mode_t mode
The file's permissions.
Definition alpm.h:140
alpm_file_t * alpm_filelist_contains(const alpm_filelist_t *filelist, const char *path)
Determines whether a package filelist contains a given path.
Definition filelist.c:121
Local package or package file backup entry.
Definition alpm.h:152
File in a package.
Definition alpm.h:134
Package filelist container.
Definition alpm.h:144
char * name
group name
Definition alpm.h:181
alpm_list_t * packages
list of alpm_pkg_t packages
Definition alpm.h:183
alpm_list_t * alpm_find_group_pkgs(alpm_list_t *dbs, const char *name)
Find group members across a list of databases.
Definition sync.c:255
Package group.
Definition alpm.h:179
alpm_handle_t * alpm_initialize(const char *root, const char *dbpath, alpm_errno_t *err)
Initializes the library.
Definition alpm.c:35
int alpm_release(alpm_handle_t *handle)
Release the library.
Definition alpm.c:98
A doubly linked list.
Definition alpm_list.h:51
alpm_loglevel_t
Logging Levels.
Definition alpm.h:1494
void(* alpm_cb_log)(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args)
The callback type for logging.
Definition alpm.h:1516
int alpm_logaction(alpm_handle_t *handle, const char *prefix, const char *fmt,...) __attribute__((format(printf
A printf-like function for logging.
@ ALPM_LOG_WARNING
Warning.
Definition alpm.h:1498
@ ALPM_LOG_ERROR
Error.
Definition alpm.h:1496
@ ALPM_LOG_DEBUG
Debug.
Definition alpm.h:1500
@ ALPM_LOG_FUNCTION
Function.
Definition alpm.h:1502
char * alpm_compute_md5sum(const char *filename)
Get the md5 sum of file.
Definition util.c:1141
int alpm_unlock(alpm_handle_t *handle)
Remove the database lock file.
Definition handle.c:144
int alpm_capabilities(void)
Get the capabilities of the library.
Definition alpm.c:114
int64_t alpm_time_t
The time type used by libalpm.
Definition alpm.h:126
alpm_caps
Enum of possible compile time features.
Definition alpm.h:2951
char * alpm_compute_sha256sum(const char *filename)
Get the sha256 sum of file.
Definition util.c:1154
const char * alpm_version(void)
Get the version of library.
Definition alpm.c:109
alpm_pkg_t * alpm_sync_get_new_version(alpm_pkg_t *pkg, alpm_list_t *dbs_sync)
Check for new version of pkg in syncdbs.
Definition sync.c:56
int alpm_sandbox_setup_child(alpm_handle_t *handle, const char *sandboxuser, const char *sandbox_path)
Drop privileges by switching to a different user.
Definition sandbox.c:32
@ ALPM_CAPABILITY_DOWNLOADER
Ability to download.
Definition alpm.h:2955
@ ALPM_CAPABILITY_NLS
localization
Definition alpm.h:2953
@ ALPM_CAPABILITY_SIGNATURES
Signature checking.
Definition alpm.h:2957
int alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs)
Sets the list of packages to ignore.
Definition handle.c:699
int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, unsigned short disable_dl_timeout)
Enables/disables the download timeout.
Definition handle.c:938
const char * alpm_option_get_dbext(alpm_handle_t *handle)
Gets the configured database extension.
Definition handle.c:356
int alpm_option_remove_noextract(alpm_handle_t *handle, const char *path)
Remove an entry from the no-extract list.
Definition handle.c:684
alpm_list_t * alpm_option_get_cachedirs(alpm_handle_t *handle)
Gets the currently configured cachedirs,.
Definition handle.c:272
int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps)
Sets the list of groups to ignore.
Definition handle.c:714
int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace)
Enable/disable checking free space before installing packages.
Definition handle.c:845
const char * alpm_option_get_root(alpm_handle_t *handle)
Returns the root path.
Definition handle.c:254
int alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile)
Sets the logfile path.
Definition handle.c:569
int alpm_option_remove_hookdir(alpm_handle_t *handle, const char *hookdir)
Remove a hookdir from the configured hookdirs.
Definition handle.c:495
int alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade)
Sets the list of no-upgrade files.
Definition handle.c:659
int alpm_option_match_noupgrade(alpm_handle_t *handle, const char *path)
Test if a path matches any of the globs in the no-upgrade list.
Definition handle.c:669
int alpm_option_remove_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep)
Remove an entry from the assume installed list.
Definition handle.c:793
void * alpm_option_get_fetchcb_ctx(alpm_handle_t *handle)
Returns the downloading callback.
Definition handle.c:212
int alpm_option_add_architecture(alpm_handle_t *handle, const char *arch)
Adds an allowed package architecture.
Definition handle.c:807
alpm_list_t * alpm_option_get_hookdirs(alpm_handle_t *handle)
Gets the currently configured hookdirs,.
Definition handle.c:266
int alpm_option_get_checkspace(alpm_handle_t *handle)
Get whether or not checking for free space before installing packages is enabled.
Definition handle.c:350
alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle)
Returns the callback used for operation progress.
Definition handle.c:242
void * alpm_option_get_questioncb_ctx(alpm_handle_t *handle)
Returns the callback used for questions.
Definition handle.c:236
const char * alpm_option_get_gpgdir(alpm_handle_t *handle)
Returns the path to libalpm's GnuPG home directory.
Definition handle.c:290
int alpm_option_set_architectures(alpm_handle_t *handle, alpm_list_t *arches)
Sets the allowed package architecture.
Definition handle.c:813
void * alpm_option_get_dlcb_ctx(alpm_handle_t *handle)
Returns the callback used to report download progress.
Definition handle.c:200
int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp)
Add a file to the ignored group list.
Definition handle.c:709
const char * alpm_option_get_lockfile(alpm_handle_t *handle)
Get the name of the database lock file.
Definition handle.c:284
alpm_list_t * alpm_option_get_overwrite_files(alpm_handle_t *handle)
Gets the currently configured overwritable files,.
Definition handle.c:332
int alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs)
Sets the cachedirs.
Definition handle.c:533
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level)
Set the remote file siglevel.
Definition handle.c:914
int alpm_option_set_parallel_downloads(alpm_handle_t *handle, unsigned int num_streams)
Sets number of parallel streams to download database and package files.
Definition handle.c:946
alpm_cb_log alpm_option_get_logcb(alpm_handle_t *handle)
Returns the callback used for logging.
Definition handle.c:182
alpm_cb_fetch alpm_option_get_fetchcb(alpm_handle_t *handle)
Returns the downloading callback.
Definition handle.c:206
const char * alpm_option_get_logfile(alpm_handle_t *handle)
Gets the filepath to the currently set logfile.
Definition handle.c:278
int alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir)
Remove a cachedir from the configured cachedirs.
Definition handle.c:549
void * alpm_option_get_logcb_ctx(alpm_handle_t *handle)
Returns the callback used for logging.
Definition handle.c:188
alpm_list_t * alpm_option_get_ignorepkgs(alpm_handle_t *handle)
Get the list of ignored packages.
Definition handle.c:320
int alpm_option_set_hookdirs(alpm_handle_t *handle, alpm_list_t *hookdirs)
Sets the hookdirs.
Definition handle.c:479
int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle)
Get the configured remote file siglevel.
Definition handle.c:928
int alpm_option_get_default_siglevel(alpm_handle_t *handle)
Get the default siglevel.
Definition handle.c:884
int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *path)
Add a file to the no-upgrade list.
Definition handle.c:654
int alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext)
Sets the database extension.
Definition handle.c:852
alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle)
Returns the callback used for events.
Definition handle.c:218
void * alpm_option_get_progresscb_ctx(alpm_handle_t *handle)
Returns the callback used for operation progress.
Definition handle.c:248
int alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb, void *ctx)
Sets the callback used for logging.
Definition handle.c:368
int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir)
Append a cachedir to the configured cachedirs.
Definition handle.c:515
int alpm_option_set_assumeinstalled(alpm_handle_t *handle, alpm_list_t *deps)
Sets the list of dependencies that are assumed to be met.
Definition handle.c:753
int alpm_option_get_usesyslog(alpm_handle_t *handle)
Returns whether to use syslog (0 is FALSE, TRUE otherwise).
Definition handle.c:302
int alpm_option_remove_architecture(alpm_handle_t *handle, const char *arch)
Removes an allowed package architecture.
Definition handle.c:821
int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg)
Remove an entry from the ignorepkg list.
Definition handle.c:704
int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *path)
Remove an entry from the no-upgrade list.
Definition handle.c:664
alpm_list_t * alpm_option_get_noextracts(alpm_handle_t *handle)
Get the list of no-extract files.
Definition handle.c:314
int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb, void *ctx)
Sets the callback used for events.
Definition handle.c:392
int alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb, void *ctx)
Sets the downloading callback.
Definition handle.c:384
alpm_list_t * alpm_option_get_ignoregroups(alpm_handle_t *handle)
Get the list of ignored groups.
Definition handle.c:326
int alpm_option_add_hookdir(alpm_handle_t *handle, const char *hookdir)
Append a hookdir to the configured hookdirs.
Definition handle.c:463
int alpm_option_set_default_siglevel(alpm_handle_t *handle, int level)
Set the default siglevel.
Definition handle.c:867
int alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep)
Add a depend to the assumed installed list.
Definition handle.c:739
int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb, void *ctx)
Sets the callback used for operation progress.
Definition handle.c:408
int alpm_option_set_sandboxuser(alpm_handle_t *handle, const char *sandboxuser)
Sets the user to switch to for sensitive operations.
Definition handle.c:605
int alpm_option_match_noextract(alpm_handle_t *handle, const char *path)
Test if a path matches any of the globs in the no-extract list.
Definition handle.c:689
int alpm_option_remove_overwrite_file(alpm_handle_t *handle, const char *glob)
Remove a file glob from the configured overwritable files globs.
Definition handle.c:734
const char * alpm_option_get_dbpath(alpm_handle_t *handle)
Returns the path to the database directory.
Definition handle.c:260
alpm_list_t * alpm_option_get_assumeinstalled(alpm_handle_t *handle)
Gets the list of dependencies that are assumed to be met.
Definition handle.c:338
int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level)
Set the local file siglevel.
Definition handle.c:890
int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog)
Sets whether to use syslog (0 is FALSE, TRUE otherwise).
Definition handle.c:618
int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp)
Remove an entry from the ignoregroup list.
Definition handle.c:719
int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
Sets the path to libalpm's GnuPG home directory.
Definition handle.c:594
int alpm_option_add_noextract(alpm_handle_t *handle, const char *path)
Add a file to the no-extract list.
Definition handle.c:674
int alpm_option_get_local_file_siglevel(alpm_handle_t *handle)
Get the configured local file siglevel.
Definition handle.c:904
int alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb, void *ctx)
Sets the callback used for questions.
Definition handle.c:400
alpm_cb_download alpm_option_get_dlcb(alpm_handle_t *handle)
Returns the callback used to report download progress.
Definition handle.c:194
int alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract)
Sets the list of no-extract files.
Definition handle.c:679
void * alpm_option_get_eventcb_ctx(alpm_handle_t *handle)
Returns the callback used for events.
Definition handle.c:224
alpm_list_t * alpm_option_get_architectures(alpm_handle_t *handle)
Returns the allowed package architecture.
Definition handle.c:344
const char * alpm_option_get_sandboxuser(alpm_handle_t *handle)
Returns the user to switch to for sensitive operations.
Definition handle.c:296
int alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb, void *ctx)
Sets the callback used to report download progress.
Definition handle.c:376
alpm_list_t * alpm_option_get_noupgrades(alpm_handle_t *handle)
Get the list of no-upgrade files.
Definition handle.c:308
int alpm_option_set_overwrite_files(alpm_handle_t *handle, alpm_list_t *globs)
Sets the overwritable files.
Definition handle.c:729
alpm_cb_question alpm_option_get_questioncb(alpm_handle_t *handle)
Returns the callback used for questions.
Definition handle.c:230
int alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg)
Add a file to the ignored package list.
Definition handle.c:694
int alpm_option_set_disable_sandbox(alpm_handle_t *handle, unsigned short disable_sandbox)
Enables/disables the sandbox.
Definition handle.c:955
int alpm_option_add_overwrite_file(alpm_handle_t *handle, const char *glob)
Append an overwritable file to the configured overwritable files.
Definition handle.c:724
int alpm_option_get_parallel_downloads(alpm_handle_t *handle)
Gets the number of parallel streams to download database and package files.
Definition handle.c:362
alpm_pkgreason_t
Package install reasons.
Definition alpm.h:2328
alpm_pkgreason_t alpm_pkg_get_reason(alpm_pkg_t *pkg)
Returns the package installation reason.
Definition package.c:339
size_t alpm_pkg_changelog_read(void *ptr, size_t size, const alpm_pkg_t *pkg, void *fp)
Read data from an open changelog 'file stream'.
Definition package.c:447
const char * alpm_pkg_get_packager(alpm_pkg_t *pkg)
Returns the packager's name.
Definition package.c:252
int alpm_pkg_mtree_next(const alpm_pkg_t *pkg, struct archive *archive, struct archive_entry **entry)
Read next entry from a package mtree file.
Definition package.c:469
alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg)
Returns the build timestamp of the package.
Definition package.c:238
alpm_list_t * alpm_pkg_get_depends(alpm_pkg_t *pkg)
Returns the list of package dependencies as alpm_depend_t.
Definition package.c:367
alpm_list_t * alpm_pkg_get_xdata(alpm_pkg_t *pkg)
Gets the extended data field of a package.
Definition package.c:491
alpm_list_t * alpm_pkg_get_provides(alpm_pkg_t *pkg)
Returns the list of packages provided by pkg.
Definition package.c:402
int alpm_pkg_free(alpm_pkg_t *pkg)
Free a package.
Definition package.c:38
const char * alpm_pkg_get_name(alpm_pkg_t *pkg)
Returns the package name.
Definition package.c:203
alpm_list_t * alpm_pkg_get_makedepends(alpm_pkg_t *pkg)
Returns a list of package make dependencies.
Definition package.c:388
int alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls, alpm_list_t **fetched)
Fetch a list of remote packages.
Definition dload.c:1285
alpm_list_t * alpm_pkg_compute_requiredby(alpm_pkg_t *pkg)
Computes the list of packages requiring a given package.
Definition package.c:554
int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg)
Test if a package should be ignored.
Definition package.c:829
const char * alpm_pkg_get_md5sum(alpm_pkg_t *pkg)
Returns the package's MD5 checksum as a string.
Definition package.c:259
int alpm_pkg_has_scriptlet(alpm_pkg_t *pkg)
Returns whether the package has an install scriptlet.
Definition package.c:484
alpm_list_t * alpm_pkg_get_licenses(alpm_pkg_t *pkg)
Returns the list of package licenses.
Definition package.c:353
off_t alpm_pkg_get_isize(alpm_pkg_t *pkg)
Returns the installed size of the package.
Definition package.c:332
alpm_filelist_t * alpm_pkg_get_files(alpm_pkg_t *pkg)
Returns the list of files installed by pkg.
Definition package.c:416
alpm_list_t * alpm_pkg_compute_optionalfor(alpm_pkg_t *pkg)
Computes the list of packages optionally requiring a given package.
Definition package.c:559
off_t alpm_pkg_get_size(alpm_pkg_t *pkg)
Returns the size of the package.
Definition package.c:325
alpm_handle_t * alpm_pkg_get_handle(alpm_pkg_t *pkg)
Gets the handle of a package.
Definition package.c:197
alpm_list_t * alpm_pkg_get_backup(alpm_pkg_t *pkg)
Returns the list of files backed up when installing pkg.
Definition package.c:423
int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, int level, alpm_pkg_t **pkg)
Create a package from a file.
Definition be_package.c:725
const char * alpm_pkg_get_version(alpm_pkg_t *pkg)
Returns the package version as a string.
Definition package.c:210
alpm_pkgfrom_t
Location a package object was loaded from.
Definition alpm.h:2338
int alpm_pkg_get_validation(alpm_pkg_t *pkg)
Returns the method used to validate a package during install.
Definition package.c:346
alpm_pkgvalidation_t
Method used to validate a package.
Definition alpm.h:2349
const char * alpm_pkg_get_arch(alpm_pkg_t *pkg)
Returns the architecture for which the package was built.
Definition package.c:318
off_t alpm_pkg_download_size(alpm_pkg_t *newpkg)
Returns the size of the files that will be downloaded to install a package.
Definition sync.c:689
const char * alpm_pkg_get_filename(alpm_pkg_t *pkg)
Gets the name of the file from which the package was loaded.
Definition package.c:183
alpm_list_t * alpm_pkg_get_conflicts(alpm_pkg_t *pkg)
Returns the list of packages conflicting with pkg.
Definition package.c:395
alpm_db_t * alpm_pkg_get_db(alpm_pkg_t *pkg)
Returns the database containing pkg.
Definition package.c:430
int alpm_pkg_vercmp(const char *a, const char *b)
Compare two version strings and determine which one is 'newer'.
Definition version.c:219
void * alpm_pkg_changelog_open(alpm_pkg_t *pkg)
Open a package changelog for reading.
Definition package.c:440
const char * alpm_pkg_get_base64_sig(alpm_pkg_t *pkg)
Returns the base64 encoded package signature.
Definition package.c:273
alpm_list_t * alpm_pkg_get_replaces(alpm_pkg_t *pkg)
Returns the list of packages to be replaced by pkg.
Definition package.c:409
alpm_pkg_t * alpm_pkg_find(alpm_list_t *haystack, const char *needle)
Find a package in a list by name.
Definition package.c:801
int alpm_pkg_get_sig(alpm_pkg_t *pkg, unsigned char **sig, size_t *sig_len)
Extracts package signature either from embedded package signature or if it is absent then reads data ...
Definition package.c:280
const char * alpm_pkg_get_base(alpm_pkg_t *pkg)
Returns the package base name.
Definition package.c:190
const char * alpm_pkg_get_desc(alpm_pkg_t *pkg)
Returns the package description.
Definition package.c:224
const char * alpm_pkg_get_sha256sum(alpm_pkg_t *pkg)
Returns the package's SHA256 checksum as a string.
Definition package.c:266
alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg)
Returns the install timestamp of the package.
Definition package.c:245
alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg)
Returns the origin of the package.
Definition package.c:217
alpm_list_t * alpm_pkg_get_checkdepends(alpm_pkg_t *pkg)
Returns a list of package check dependencies.
Definition package.c:381
int alpm_pkg_mtree_close(const alpm_pkg_t *pkg, struct archive *archive)
Close a package mtree file.
Definition package.c:477
int alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason)
Set install reason for a package in the local database.
Definition be_local.c:1184
struct archive * alpm_pkg_mtree_open(alpm_pkg_t *pkg)
Open a package mtree file for reading.
Definition package.c:462
int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp)
Close a package changelog for reading.
Definition package.c:455
alpm_list_t * alpm_pkg_get_groups(alpm_pkg_t *pkg)
Returns the list of package groups.
Definition package.c:360
const char * alpm_pkg_get_url(alpm_pkg_t *pkg)
Returns the package URL.
Definition package.c:231
int alpm_pkg_checkmd5sum(alpm_pkg_t *pkg)
Check the integrity (with md5) of a package from the sync cache.
Definition package.c:50
alpm_list_t * alpm_pkg_get_optdepends(alpm_pkg_t *pkg)
Returns the list of package optional dependencies.
Definition package.c:374
@ ALPM_PKG_REASON_EXPLICIT
Explicitly requested by the user.
Definition alpm.h:2330
@ ALPM_PKG_REASON_UNKNOWN
Failed parsing of local database.
Definition alpm.h:2334
@ ALPM_PKG_REASON_DEPEND
Installed as a dependency for another package.
Definition alpm.h:2332
@ ALPM_PKG_FROM_FILE
Loaded from a file via alpm_pkg_load.
Definition alpm.h:2340
@ ALPM_PKG_FROM_LOCALDB
From the local database.
Definition alpm.h:2342
@ ALPM_PKG_FROM_SYNCDB
From a sync database.
Definition alpm.h:2344
@ ALPM_PKG_VALIDATION_MD5SUM
The package is validated with md5.
Definition alpm.h:2355
@ ALPM_PKG_VALIDATION_SIGNATURE
The package is validated with a PGP signature.
Definition alpm.h:2359
@ ALPM_PKG_VALIDATION_NONE
The package does not have any validation.
Definition alpm.h:2353
@ ALPM_PKG_VALIDATION_SHA256SUM
The package is validated with sha256.
Definition alpm.h:2357
@ ALPM_PKG_VALIDATION_UNKNOWN
The package's validation type is unknown.
Definition alpm.h:2351
alpm_sigvalidity_t validity
The validity of the signature.
Definition alpm.h:473
alpm_time_t created
When the key was created.
Definition alpm.h:446
char pubkey_algo
A character representing the encryption algorithm used by the public key.
Definition alpm.h:460
unsigned int revoked
has the key been revoked
Definition alpm.h:452
void * data
The actual key data.
Definition alpm.h:436
unsigned int length
The length of the key.
Definition alpm.h:450
char * email
Email of the key's owner.
Definition alpm.h:444
char * fingerprint
The key's fingerprint.
Definition alpm.h:438
char * uid
UID of the key.
Definition alpm.h:440
alpm_pgpkey_t key
The key of the signature.
Definition alpm.h:469
alpm_sigstatus_t status
The status of the signature.
Definition alpm.h:471
char * name
Name of the key's owner.
Definition alpm.h:442
size_t count
The amount of results in the array.
Definition alpm.h:482
alpm_sigresult_t * results
An array of sigresults.
Definition alpm.h:484
alpm_time_t expires
When the key expires.
Definition alpm.h:448
int alpm_decode_signature(const char *base64_data, unsigned char **data, size_t *data_len)
Decode a loaded signature in base64 form.
Definition signing.c:38
alpm_sigvalidity_t
The trust level of a PGP key.
Definition alpm.h:422
alpm_sigstatus_t
PGP signature verification status return codes.
Definition alpm.h:405
int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist)
Check the PGP signature for the given database.
Definition signing.c:1011
int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist)
Check the PGP signature for the given package file.
Definition signing.c:1000
int alpm_extract_keyid(alpm_handle_t *handle, const char *identifier, const unsigned char *sig, const size_t len, alpm_list_t **keys)
Extract the Issuer Key ID from a signature.
Definition signing.c:1101
int alpm_siglist_cleanup(alpm_siglist_t *siglist)
Clean up and free a signature result list.
Definition signing.c:1021
alpm_siglevel_t
PGP signature verification options.
Definition alpm.h:379
@ ALPM_SIGVALIDITY_FULL
The signature is fully trusted.
Definition alpm.h:424
@ ALPM_SIGVALIDITY_MARGINAL
The signature is marginally trusted.
Definition alpm.h:426
@ ALPM_SIGVALIDITY_NEVER
The signature is never trusted.
Definition alpm.h:428
@ ALPM_SIGVALIDITY_UNKNOWN
The signature has unknown trust.
Definition alpm.h:430
@ ALPM_SIGSTATUS_SIG_EXPIRED
The signature has expired.
Definition alpm.h:411
@ ALPM_SIGSTATUS_VALID
Signature is valid.
Definition alpm.h:407
@ ALPM_SIGSTATUS_KEY_EXPIRED
The key has expired.
Definition alpm.h:409
@ ALPM_SIGSTATUS_KEY_UNKNOWN
The key is not in the keyring.
Definition alpm.h:413
@ ALPM_SIGSTATUS_INVALID
The signature is invalid.
Definition alpm.h:417
@ ALPM_SIGSTATUS_KEY_DISABLED
The key has been disabled.
Definition alpm.h:415
@ ALPM_SIG_DATABASE_MARGINAL_OK
Allow databases with signatures that are marginal trust.
Definition alpm.h:396
@ ALPM_SIG_DATABASE_OPTIONAL
Databases do not require a signature, but check databases that do have signatures.
Definition alpm.h:394
@ ALPM_SIG_USE_DEFAULT
The Default siglevel.
Definition alpm.h:401
@ ALPM_SIG_DATABASE
Databases require a signature.
Definition alpm.h:391
@ ALPM_SIG_PACKAGE_MARGINAL_OK
Definition alpm.h:386
@ ALPM_SIG_DATABASE_UNKNOWN_OK
Allow databases with signatures that are unknown trust.
Definition alpm.h:398
@ ALPM_SIG_PACKAGE
Packages require a signature.
Definition alpm.h:381
@ ALPM_SIG_PACKAGE_OPTIONAL
Packages do not require a signature, but check packages that do have signatures.
Definition alpm.h:384
@ ALPM_SIG_PACKAGE_UNKNOWN_OK
Allow packages with signatures that are unknown trust.
Definition alpm.h:388
A PGP key.
Definition alpm.h:434
Signature list.
Definition alpm.h:480
Signature result.
Definition alpm.h:467
int alpm_trans_interrupt(alpm_handle_t *handle)
Interrupt a transaction.
Definition trans.c:247
int alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
Add a package to the transaction.
Definition add.c:50
alpm_transflag_t
Transaction flags.
Definition alpm.h:2790
int alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
Prepare a transaction.
Definition trans.c:109
int alpm_trans_init(alpm_handle_t *handle, int flags)
Initialize the transaction.
Definition trans.c:45
alpm_list_t * alpm_trans_get_remove(alpm_handle_t *handle)
Returns the list of packages removed by the transaction.
Definition trans.c:445
int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
Add a package removal to the transaction.
Definition remove.c:49
int alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
Commit a transaction.
Definition trans.c:167
int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
Search for packages to upgrade and add them to the transaction.
Definition sync.c:200
int alpm_trans_get_flags(alpm_handle_t *handle)
Returns the bitfield of flags for the current transaction.
Definition trans.c:427
alpm_list_t * alpm_trans_get_add(alpm_handle_t *handle)
Returns a list of packages added by the transaction.
Definition trans.c:436
int alpm_trans_release(alpm_handle_t *handle)
Release a transaction.
Definition trans.c:264
@ ALPM_TRANS_FLAG_NODEPS
Ignore dependency checks.
Definition alpm.h:2792
@ ALPM_TRANS_FLAG_NOHOOKS
Do not run hooks during a transaction.
Definition alpm.h:2805
@ ALPM_TRANS_FLAG_RECURSE
Remove packages and their unneeded deps (not explicitly installed).
Definition alpm.h:2801
@ ALPM_TRANS_FLAG_NODEPVERSION
Ignore version numbers when checking dependencies.
Definition alpm.h:2797
@ ALPM_TRANS_FLAG_NOSAVE
Delete files even if they are tagged as backup.
Definition alpm.h:2795
@ ALPM_TRANS_FLAG_NOCONFLICTS
Ignore dependency conflicts.
Definition alpm.h:2813
@ ALPM_TRANS_FLAG_NOSCRIPTLET
Do not execute install scriptlets after installing.
Definition alpm.h:2811
@ ALPM_TRANS_FLAG_NEEDED
Do not install a package if it is already installed and up to date.
Definition alpm.h:2816
@ ALPM_TRANS_FLAG_UNNEEDED
Do not remove a package if it is needed by another one.
Definition alpm.h:2820
@ ALPM_TRANS_FLAG_ALLDEPS
Use ALPM_PKG_REASON_DEPEND when installing packages.
Definition alpm.h:2807
@ ALPM_TRANS_FLAG_RECURSEALL
Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE).
Definition alpm.h:2822
@ ALPM_TRANS_FLAG_CASCADE
Remove also any packages depending on a package being removed.
Definition alpm.h:2799
@ ALPM_TRANS_FLAG_ALLEXPLICIT
Use ALPM_PKG_REASON_EXPLICIT when installing packages.
Definition alpm.h:2818
@ ALPM_TRANS_FLAG_NOLOCK
Do not lock the database during the operation.
Definition alpm.h:2824
@ ALPM_TRANS_FLAG_DBONLY
Modify database but do not commit changes to the filesystem.
Definition alpm.h:2803
@ ALPM_TRANS_FLAG_DOWNLOADONLY
Only download packages and do not actually install.
Definition alpm.h:2809
char * name
Definition alpm.h:120
char * value
Definition alpm.h:121
The extended data type used to store non-standard package data fields.
Definition alpm.h:119
alpm_loglevel_t const char va_list args
Definition sandbox.h:40
alpm_loglevel_t level
Definition sandbox.h:40
__attribute__((format(printf, 3, 0))) void _alpm_sandbox_cb_log(void *ctx
alpm_loglevel_t const char * fmt
Definition sandbox.h:40