summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2014-06-29libalpm: check for valid public key algorithmChristian Hesse1-0/+12
2014-06-24events: Make alpm_event_t an union of all event-specific structOlivier Brunel1-7/+22
Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24Update the question callbackOlivier Brunel5-45/+173
Much like with events, instead of using a bunch of void* arguments for all questions, we now send one pointer to an alpm_question_t union. This contains the type of question that was triggered. With this information, a question-specific struct can be accessed in order to get additional arguments. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24alpm.h: Move alpm_errno_t definition upOlivier Brunel1-84/+87
Because for the new question types, we'll need to use alpm_errno_t let's move its definition up. Of course to do so, we also need to move that of alpm_handle_t as well, so move all opaque structures on top. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-02Add compatibility with gpgme-1.5.0Allan McRae1-0/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-22dload: avoid using CURLOPT_FAILONERRORDave Reisner1-7/+8
Use of this flag causes connections to be closed on 404s -- a common occurrence when your config sets DatabaseOptional. Handle the error gracefully, so that the connection can be reused. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04register_syncdb: reject db names that contain /Andrew Gregory1-1/+2
alpm downloads databases based on basename causing [foo] and [bar/foo] to silently overwrite each other. Also remove an extra tab Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27Always supply base name and version info in .PKGFILE if neededAllan McRae1-0/+2
Provide pkgbase information for non-split packages with pkgbase set. Also record the version of the "base" package. This is useful for matching package files to source packages. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-08Use MALLOC throughtout libalpmAllan McRae4-15/+7
Use MALLOC instead of malloc for safety in libalpm. Some changes are pure refactoring, but for others this provides a success check for memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04sync_prepare: ignore explicitly removed conflictsAndrew Gregory1-0/+3
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Fix warnings with strict-overflow in gcc-4.9Allan McRae1-1/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Add events on pacnew/pacsave/pacorig file creationOlivier Brunel3-10/+81
ALPM still adds a warning to the log, but doesn't emit an event about said warning, instead using a specific event to let the frontend what happened/how to inform the user. Note that there are 2 cases for installing a .pacnew file, to not overwrite user changes and because file is in NoUpgrade. In the later case the warning was a bit different: it happened before and said "extracting" instead of "installed." Now both happen after and are phrased the same. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03restrict transaction package originsAndrew Gregory2-0/+4
This moves the "wrong args" error up from trans_commit to add_pkg when used with a local pkg and adds the error for remove_pkg when used with a sync pkg, which currently just removes the db entry. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Add events _PKGDOWNLOAD_{START, DONE, FAILED}Olivier Brunel2-0/+25
These will be emmitted when download a package file from a repository, indicating that the download starts, and whether it was successfull or not. Note that when multiple servers are available, no event is emmitted when switching to another server. (This doesn't apply to alpm_fetch_pkgurl(), but since it is called by the frontend, it shouldn't have problems knowing when the download starts and when it ends.) Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}Olivier Brunel2-0/+7
To go along with RETRIEVE_START, one other event will be emmitted once the downloads are done: RETRIEVE_DONE if all files were successfully downloaded, else RETRIEVE_FAILED. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Remove log_cb, add ALPM_EVENT_LOG insteadOlivier Brunel4-35/+30
When ALPM emits a log message, it still goes through _alpm_log() but instead of calling a specific log callback, it goes as an event. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Update the event callbackOlivier Brunel7-110/+191
Instead of using two void* arguments for all events, we now send one pointer to an alpm_event_t struct. This contains the type of event that was triggered. With this information, the pointer can then be typecasted to the event-specific struct in order to get additional arguments. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03be_local: Use alpm_greedy_growFlorian Pritz1-16/+3
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03be_package: Build the file list from MTREE if possibleFlorian Pritz1-4/+145
This greatly speeds up file list generation times by avoiding uncompressing the whole package. pacman -S base with a deliberate file conflict: before: 9.1 seconds after: 2.2 seconds Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03be_package: Refactor code adding a file to the files listFlorian Pritz1-27/+29
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03be_package: Refactor handling of simple path checksFlorian Pritz1-5/+22
This is used to deduplicate code when using the mtree as the file list source. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03util: Add _alpm_realloc() and _alpm_greedy_grow()Florian Pritz2-0/+64
These will be used in the following patches. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03Check if a file is in the package's file list before extractingFlorian Pritz1-0/+5
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-02-08_alpm_sync_prepare: fix unresolvable packages leakAndrew Gregory1-0/+1
If the user opted not to remove the unresolvable packages from the transaction, the list was neither free'd nor saved to the transaction to be free'd in trans_release. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04alpm: export *_free functionsAndrew Gregory7-21/+24
Front-ends should be able to free memory that alpm hands them. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02Do not remove source code references in PO/POT filesRafael Ferreira1-1/+1
FS#34240. This is useful for translators and has little cost to us since we moved to transifex for translations. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30_alpm_resolvedeps: free targ inside loopAndrew Gregory1-1/+2
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30sync_prepare: manually set pm_errnoAndrew Gregory1-2/+1
_alpm_resolvedeps resets pm_errno to 0 by calling alpm_checkdeps. Whenever the last call succeeded, pm_errno was not properly set, preventing pacman from properly handling the error and leaking additional memory. We know pm_errno should be ALPM_ERR_UNSATISFIED_DEPS if resolvedeps has failed, so just set it manually. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30local_db_populate: initialize empty pkgcacheAndrew Gregory1-0/+1
If the db directory did not exist when local_db_populate was called, the pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz51-51/+51
Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Rename ALPM_EVENT_OPTDEP_REQUIRED to _OPTDEP_REMOVALOlivier Brunel2-2/+2
Because this event is triggered when an optdepend for another package is being removed. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15sync_prepare: treat from_sync as a booleanAndrew Gregory1-2/+5
We only care that packages are being installed from a repo, not how many. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15base64.c: comment out unused variableAndrew Gregory1-0/+2
Commit e47eb9a7 commented out base64_encode, which left base64_enc_map unused, causing warnings under clang. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-15package.h: convert scriptlet field to intAndrew Gregory1-1/+1
It's a boolean, so signedness doesn't matter, and the public API already exposes it as an int through alpm_pkg_has_scriptlet(). Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10Consistently use #ifdefAllan McRae2-4/+4
Fix the occurances of #if to be #ifdef for consistency.
2014-01-10Fix build with --disable-gpgmeAllan McRae2-35/+31
The alpm_decode_signature function was made available for frontends to display signature information, but this required libalpm to be build with gpgme support. As that function did not require anything from gpgme, have it build unconditionally. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-10Fix compile warnings on systems without getmntentDan McGee1-0/+3
Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06check_keyring: plug memory leakAndrew Gregory1-0/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Reorder and reshape the package struct for better packingDan McGee1-12/+13
This shrinks down the total size of the package struct by a handful of bytes, saving us some memory and cache pressure when we are loading up the entirety of the sync and local databases. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Minor struct member reordering for packing concernsDan McGee3-5/+7
Noticed using clang and `-Wpadded`. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Use O_CLOEXEC as much as possible when opening filesDan McGee4-11/+18
When calling open(), use O_CLOEXEC as much as possible to ensure the file descriptor is closed when and if a process using libalpm forks. For most of these cases, and especially in utility functions, the file descriptor is opened and closed in the same function, so we don't have too much to worry about. However, for things like the log file and database lock file, we should ensure descriptors aren't left hanging around for children to touch. This patch is inspired by the problem in FS#36161, where an open file descriptor to the current working directory prevents chroot() from working on FreeBSD. We don't need this file descriptor in the child process, so open it (and now several others) with O_CLOEXEC. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Log more in search debug messageDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Remove -fgnu89-inline from compile optionsDan McGee1-3/+0
This was a hack done by me in commit d8e88aa0175fd back in 2007 that is no longer necessary, given a sufficiently smart compiler and one that supports the inline keyword. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Clear up definition of INFRQ_ALLDan McGee1-2/+3
Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae50-50/+50
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Copy validation field in _alpm_pkg_dupAllan McRae1-0/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update comment for local db entry creationAllan McRae1-2/+2
Mention mtree files do not need creation in addtion to install files. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06deps.c: remove filtered_depend functionsAndrew Gregory1-22/+10
filtered_dep was duplicating an alpm_depend_t solely for the purpose of overriding its depmod and would effectively cause alpm_checkdeps to ignore ALPM_TRANS_FLAG_NODEPVERSION if the duplication failed. Manually overriding/restoring the depmod for the original depend removes the duplication as a point of failure and fixes a memory leak where the duplicated depend was not being properly freed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Fix build warnings with --disable-nlsAllan McRae1-1/+1
The gettext functions return a "char *", so do the same for the defines in the case where gettext is unavailable. This prevents a number of warnings about const being dropped. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-12-19trans_prepare: always sort trans->remove by depsAndrew Gregory3-12/+16
Packages can be removed during a sync transaction either directly or due to conflicts and need to be sorted. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>