summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.h
AgeCommit message (Collapse)AuthorFilesLines
2012-12-14Add public functions for accessing mtree dataAllan McRae1-0/+21
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Do not warn about missing database if being downloadedAllan McRae1-1/+3
When a configured repo database is not already downloaded, a warning message such as "warning: database file for 'testing' does not exist" is printed. Disable this warning when the database is scheduled to be downloaded in the transaction. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Make alpm_pkg_find publicAllan McRae1-0/+7
This function is particularly useful, so make it public. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add "Optional for" to package information outputAllan McRae1-0/+8
Much like packages that require a give package are displayed in the "Required by" field of its information output, alos display packages that optionally require the package. Inspired-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Notify of removed package required as optdependAllan McRae1-1/+4
When a package is being removed, provide a notification (via a callback) if any local package requires it as an optdepend. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add resolved_path to alpm_filelist_tAllan McRae1-0/+1
Add an array to hold the resolved paths of the files in alpm_filelist_t. When the file name and its resolved file name are identical, the pointer to the original file name is used to avoid duplicate memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-02Move filelist functions into separate source fileDan McGee1-1/+15
We have a few of these and might as well gather them together. This also cleans up the code a bit by using an enum instead of integer values, as well as makes a "search for file in filelist" function public so frontends can do better than straight linear search of the filelists. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01Fix wrong parameter name in alpm_db_update's signatureBarbu Paul - Gheorghe1-1/+1
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
2012-04-07Prefix alpm_pkgfrom_t members with ALPM_Allan McRae1-3/+3
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Add information on how an installed package was validatedAllan McRae1-0/+15
When installing a package, store information on which validation method was used and output this on "pacman -Qi" operations. e.g. Validated By : SHA256 Sum Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature. Dan: just a few very minor tweaks. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Hook new optdepend structures upBenedikt Morbach1-1/+1
No new behaviour introduced, everything should work exactly as before. Dan: refactored to use the single alpm_depend_t structure. Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Allow alpm_depend_t to have a descriptionDan McGee1-0/+1
This is the first step in parsing and handling optdepends. There is no behavior change introduced in this commit; however, depends that contain a ": " string will now be parsed as having a description and it will be stored in the depend structure. Later patches will utilize this new field as appropriate. This is heavily based on the work of Benedikt, who did something similar but introduced a new type for this rather than only a new field to the existing type. Heavily-influenced-by: Benedikt Morbach <benedikt.morbach@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Update copyright yearsAllan McRae1-1/+1
Add 2012 to the copyright range for all libalpm and pacman source files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13Merge branch 'maint'Dan McGee1-3/+3
Conflicts: lib/libalpm/sync.c src/util/pactree.c
2012-02-07Fix a handful of comment typos or misspellingsDan McGee1-3/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06ALPM API adjustments for sanity and consistencyDan McGee1-19/+20
This makes several small adjustments to our exposed method names, and in one case, parameters. The justification here is to make methods less odd in their naming convention. If a method takes an alpm_db_t argument, the method should be named 'alpm_db_*', but perhaps more importantly, if it doesn't take a database as the first parameter, it should not. Summary of changes: alpm_db_register_sync -> alpm_register_syncdb alpm_db_unregister_all -> alpm_unregister_all_syncdbs alpm_option_get_localdb -> aplpm_get_localdb alpm_option_get_syncdbs -> aplpm_get_syncdbs alpm_db_readgroup -> alpm_db_get_group alpm_db_set_pkgreason -> alpm_pkg_set_reason All methods keep the same argument list except for alpm_pkg_set_reason; there we drop the 'handle' argument as it can be retrieved from the passed in package object. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06alpm.h: enum cleanups, comment formatting cleanupDan McGee1-27/+23
Don't use trailing commas in enums if people really want to use a strict C89 compiler, and document why on earth one particular enum uses bitmask values when it doesn't seem necessary. With comments, shoot for more consistency. When something is a one-liner, keep it that way and move the whole /** sequence */ to one line. When it needs more than one line, ensure we format most of them in a similar fashion. Two minor function signature adjustments are made that don't change anything other than matching the parameter name (name -> filename) and fitting in with our coding style (type* var -> type *var). Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-19Allow UseDelta option to specify a delta ratioDan McGee1-2/+2
Rework the frontend and backend to allow passing a ratio value in for UseDelta rather than having a hardcoded #define-d 0.7 value always used. This is useful for those with fast connections, who would likely benefit from tuning this ratio to lower values; it is also useful for general testing purposes. The libalpm API changes for this, but we do support the old config file format with a no-value 'UseDelta' option; in this case we simply use the old default of 0.7. We clamp the ratio values to a sane range between 0.0 and 2.0, allowing ratios above 1.0 for testing purposes. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07Clean up <inttypes.h> header inclusionsDan McGee1-1/+1
In both cases we can go with the slightly leaner <stdint.h> header include since we aren't using the print macros. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-21add key algo to import msgFlorian Pritz1-0/+1
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-21change gpg import message to resemble gpg --list-keysFlorian Pritz1-0/+2
Dan: const pointers, don't worry about bitfields. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14create a typedef for enum _alpm_errno_tJonathan Conder1-5/+5
This is consistent with the other enums and structs, and should be slightly more readable. Signed-off-by: Jonathan Conder <jonno.conder@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Introduce alpm_time_t typeDan McGee1-7/+9
This will always be a 64-bit signed integer rather than the variable length time_t type. Dates beyond 2038 should be fully supported in the library; the frontend still lags behind because 32-bit platforms provide no localtime64() or equivalent function to convert from an epoch value to a broken down time structure. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Update Doxyfile and fix some documentation errors caught by DoxygenDan McGee1-5/+8
A few parameters were outdated or wrongly named, and a few things were explicitly linked that Doxygen wasn't able to resolve. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Add status and check for key being disabledDan McGee1-0/+1
Because we aren't using gpgv and a dedicated keyring that is known to be all safe, we should honor this flag being set on a given key in the keyring to know to not honor it. This prevents a key from being reimported that a user does not want to be used- instead of deleting, one should mark it as disabled. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Add new import key question enum value and stub frontend functionDan McGee1-0/+1
This is for eventual use by the PGP key import code. Breaking this into a separate commit now makes the following patches a bit easier to understand. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Add alpm_capabilities() method and enumerationDan McGee1-0/+8
This allows a frontend program to query, at runtime, what the library supports. This can be useful for sanity checking during config- requiring a downloader or disallowing signature settings, for example. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20Split package validation and load loopsDan McGee1-0/+5
This adds a some new callback event and progress codes for package loading, which was formerly bundled in with package validation before. The main sync.c loop where loading occurred is now two loops running sequentially. The behavior should not change with this patch outside of progress and event display; more changes will come in following patches. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19Remove const specifier from changelog_read() void parameterDan McGee1-1/+1
This shouldn't really be declared with const, and causes a compile error when -Wcast-qual is used. Remove the const specifier from the function specification and all implementations. Also fix one other trivial -Wcast-qual warning in _alpm_db_cmp(). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19Remove dead changelog_feof() codeDan McGee1-2/+0
We never ended up using or really needing this; kill it for now knowing it is in git history if ever needed again. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-03Former transaction callback rename refactorDan McGee1-125/+125
Put all the callback stuff in alpm.h in one spot, and make the following renames for clarity with the new structure: ALPM_TRANS_EVT_* --> ALPM_EVENT_* ALPM_TRANS_CONV_* --> ALPM_QUESTION_* ALPM_TRANS_PROGRESS_* --> ALPM_PROGRESS_* alpm_option_get_convcb() --> alpm_option_get_questioncb() alpm_option_set_convcb() --> alpm_option_set_questioncb() Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-03Move all callbacks up to the handle levelDan McGee1-16/+25
This was just disgusting before, unnecessary to limit these to only usage in a transaction. Still a lot of more room for cleanup but we'll start by attaching them to the handle rather than the transaction we may or may not even want to use these callbacks. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-03Clean up handling of size fieldsDan McGee1-1/+2
We currently have csize, isize, and size concepts, and sometimes the difference isn't clear. Ensure the following holds: * size (aka csize): always the compressed size of the package; available for everything except local packages (where it will return 0) * isize: always the installed size of the package; available for all three package types Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Allow access to package origin dataDan McGee1-0/+5
Add new alpm_pkg_get_origin() method, use it in the front end now that the enum constants are publicly available. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Removed multiple definitions of pkgfrom_tDiogo Sousa1-0/+6
libalpm now exports type alpm_pkgfrom_t in alpm.h, which may be used by frontends. Pacman now uses alpm_pkgfrom_t instead of replicating that type (pkg_from as was in src/pacman/package.h) Updated API change in README. Signed-off-by: Diogo Sousa <diogogsousa@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-29Refactor signature result return formatDan McGee1-7/+21
I was trying to take a shortcut and not introduce a wrapper struct for the signature results, so packed it all into alpm_sigresult_t in the first iteration. However, this is painful when one wants to add new fields or only return information regarding a single signature. Refactor the type into a few components which are exposed to the end user, and will allow a lot more future flexibility. This also exposes more information regarding the key to the frontend than was previously available. The "private" void *data pointer is used by the library to store the actual key object returned by gpgme; it is typed this way so the frontend has no expectations of what is there, and so we don't have any hard gpgme requirement in our public API. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15Parse conflicts/provides/replaces at database load timeDan McGee1-6/+6
We did this with depends way back in commit c244cfecf654d3 in 2007. We can do it with these fields as well. Of note is the inclusion of provides even though only '=' is supported- we'll parse other things, but no guarantees are given as to behavior, which is more or less similar to before since we only looked for the equals sign. Also of note is the non-inclusion of optdepends; this will likely be resolved down the road. The biggest benefactors of this change will be the resolving code that formerly had to parse and reparse several of these fields; it only happens once now at load time. This does lead to the disadvantage that we will now always be parsing this information up front even if we never need it in the split form, but as these are uncommon fields and our parser is quite efficient it shouldn't be a big concern. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15Load and allow access to sha256sumDan McGee1-1/+8
This adds a field in the package struct for this checksum type as well as allowing access via the API to it. The frontend is now able to display any read value. Note that this does not implement any use or verification of the value internally. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15Add ALPM sha256sum routinesDan McGee1-0/+1
These mirror ones we already have for md5sums. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15pacman/package: show presence of signature in in -SiDave Reisner1-0/+6
adds a new API method: alpm_pkg_get_base64_sig [Dan: don't use a new header string in frontend] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15alpm.h: fix inconsistency in function prototypeDave Reisner1-2/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09Conflict comparison performance enhancementsDan McGee1-0/+2
* Add *_hash fields to conflict struct and populate them * Remove unnecessary backwards string comparisons Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-09Attempt to fix up some of the brokenness around failed package loadsDan McGee1-0/+1
This is a bit of a mess, due to the fact that we have a progress meter running. It is also ironic that we are in the midst of a method named "commit" when we haven't done a damn thing yet, and can still fail hard if either a checksum or signature is invalid or unrecognized. Adapt the former test_md5sum method to be invoked for any of the various failure types, which at least gives the user some indication of what packages are failing. A second patch will be needed to actually show worthwhile error codes, but this is going to involve modifying the actual data passed with the callback. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-29Revamp signing checksDan McGee1-5/+17
This ensures we are actually making correct use of the information gpgme is returning to us. Marginal being allowed was obvious before, but Unknown should deal with trust level, and not the presence or lack thereof of a public key to validate the signature with. Return status and validity information in two separate values so check methods and the frontend can use them independently. For now, we treat expired keys as valid, while expired signatures are invalid. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21Convert package filelists to an array instead of linked listDan McGee1-2/+9
This accomplishes quite a few things with one rather invasive change. 1. Iteration is much more performant, due to a reduction in pointer chasing and linear item access. 2. Data structures are smaller- we no longer have the overhead of the linked list as the file struts are now laid out consecutively in memory. 3. Memory allocation has been massively reworked. Before, we would allocate three different pieces of memory per file item- the list struct, the file struct, and the copied filename. What this resulted in was massive fragmentation of memory when loading filelists since the memory allocator had to leave holes all over the place. The new situation here now removes the need for any list item allocation; allocates the file structs in contiguous memory (and reallocs as necessary), leaving only the strings as individually allocated. Tests using valgrind (massif) show some pretty significant memory reductions on the worst case `pacman -Ql > /dev/null` (366387 files on my machine): Before: Peak heap: 54,416,024 B Useful heap: 36,840,692 B Extra heap: 17,575,332 B After: Peak heap: 38,004,352 B Useful heap: 28,101,347 B Extra heap: 9,903,005 B Several small helper methods have been introduced, including a list to array conversion helper as well as a filelist merge sort that works directly on arrays. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14Make alpm_db_set_pkgreason() arguments more saneDan McGee1-3/+4
This can only ever operate on the local database, and a local package at that. Change the function signature to take a handle and package object, add the relevant asserts, and ensure the frontend can detect the package not found condition when finding packages to pass to this method. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05Allow frontend access to signature verification informationDan McGee1-0/+2
Show output in -Qip for each package signature, which includes the UID string from the key ("Joe User <joe@example.com>") and the validity of said key. Example output: Signatures : Valid signature from "Dan McGee <dpmcgee@gmail.com>" Unknown signature from "<Key Unknown>" Invalid signature from "Dan McGee <dpmcgee@gmail.com>" Also add a backend alpm_sigresult_cleanup() function since memory allocation took place on this object, and we need some way of freeing it. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05signing: move to new signing verification and return schemeDan McGee1-20/+47
This gives us more granularity than the former Never/Optional/Always trifecta. The frontend still uses these values temporarily but that will be changed in a future patch. * Use 'siglevel' consistenly in method names, 'level' as variable name * The level becomes an enum bitmask value for flexibility * Signature check methods now return a array of status codes rather than a simple integer success/failure value. This allows callers to determine whether things such as an unknown signature are valid. * Specific signature error codes mostly disappear in favor of the above returned status code; pm_errno is now set only to PKG_INVALID_SIG or DB_INVALID_SIG as appropriate. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03Merge remote-tracking branch 'allan/ALPM'Dan McGee1-124/+124
Conflicts: lib/libalpm/be_local.c lib/libalpm/be_package.c lib/libalpm/conflict.c lib/libalpm/diskspace.c lib/libalpm/dload.c lib/libalpm/remove.c
2011-07-03Move alpm filelists to a struct objectDan McGee1-0/+7
This allows us to capture size and mode data when building filelists from package files. Future patches will take advantage of this newly available information, and frontends can use it as well. Signed-off-by: Dan McGee <dan@archlinux.org>