summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* libalpm: check for valid public key algorithmChristian Hesse2014-06-29
|
* events: Make alpm_event_t an union of all event-specific structOlivier Brunel2014-06-24
| | | | | Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update the question callbackOlivier Brunel2014-06-24
| | | | | | | | | | | | 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>
* alpm.h: Move alpm_errno_t definition upOlivier Brunel2014-06-24
| | | | | | | | | | | 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>
* Add compatibility with gpgme-1.5.0Allan McRae2014-06-02
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: avoid using CURLOPT_FAILONERRORDave Reisner2014-05-22
| | | | | | | | | 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>
* register_syncdb: reject db names that contain /Andrew Gregory2014-05-04
| | | | | | | | | | 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>
* Always supply base name and version info in .PKGFILE if neededAllan McRae2014-03-27
| | | | | | | | 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>
* Use MALLOC throughtout libalpmAllan McRae2014-03-08
| | | | | | | | 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>
* sync_prepare: ignore explicitly removed conflictsAndrew Gregory2014-03-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix warnings with strict-overflow in gcc-4.9Allan McRae2014-03-03
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add events on pacnew/pacsave/pacorig file creationOlivier Brunel2014-03-03
| | | | | | | | | | | | | | 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>
* restrict transaction package originsAndrew Gregory2014-03-03
| | | | | | | | | 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>
* Add events _PKGDOWNLOAD_{START, DONE, FAILED}Olivier Brunel2014-03-03
| | | | | | | | | | | | | | | | 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>
* Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}Olivier Brunel2014-03-03
| | | | | | | | | 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>
* Remove log_cb, add ALPM_EVENT_LOG insteadOlivier Brunel2014-03-03
| | | | | | | | 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>
* Update the event callbackOlivier Brunel2014-03-03
| | | | | | | | | | | | 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>
* be_local: Use alpm_greedy_growFlorian Pritz2014-03-03
| | | | Signed-off-by: Florian Pritz <bluewind@xinu.at>
* be_package: Build the file list from MTREE if possibleFlorian Pritz2014-03-03
| | | | | | | | | | | 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>
* be_package: Refactor code adding a file to the files listFlorian Pritz2014-03-03
| | | | Signed-off-by: Florian Pritz <bluewind@xinu.at>
* be_package: Refactor handling of simple path checksFlorian Pritz2014-03-03
| | | | | | | This is used to deduplicate code when using the mtree as the file list source. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* util: Add _alpm_realloc() and _alpm_greedy_grow()Florian Pritz2014-03-03
| | | | | | These will be used in the following patches. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* Check if a file is in the package's file list before extractingFlorian Pritz2014-03-03
| | | | Signed-off-by: Florian Pritz <bluewind@xinu.at>
* _alpm_sync_prepare: fix unresolvable packages leakAndrew Gregory2014-02-08
| | | | | | | | | 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>
* alpm: export *_free functionsAndrew Gregory2014-02-04
| | | | | | | 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>
* Do not remove source code references in PO/POT filesRafael Ferreira2014-02-02
| | | | | | | 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>
* _alpm_resolvedeps: free targ inside loopAndrew Gregory2014-01-30
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* sync_prepare: manually set pm_errnoAndrew Gregory2014-01-30
| | | | | | | | | | | _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>
* local_db_populate: initialize empty pkgcacheAndrew Gregory2014-01-30
| | | | | | | | 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>
* Remove ts and sw from vim modeline when noet is setFlorian Pritz2014-01-28
| | | | | | | | | | | | 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>
* Rename ALPM_EVENT_OPTDEP_REQUIRED to _OPTDEP_REMOVALOlivier Brunel2014-01-28
| | | | | | | | 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>
* sync_prepare: treat from_sync as a booleanAndrew Gregory2014-01-15
| | | | | | | | 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>
* base64.c: comment out unused variableAndrew Gregory2014-01-15
| | | | | | | | 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>
* package.h: convert scriptlet field to intAndrew Gregory2014-01-15
| | | | | | | | 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>
* Consistently use #ifdefAllan McRae2014-01-10
| | | | Fix the occurances of #if to be #ifdef for consistency.
* Fix build with --disable-gpgmeAllan McRae2014-01-10
| | | | | | | | | 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>
* Fix compile warnings on systems without getmntentDan McGee2014-01-10
| | | | | Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* check_keyring: plug memory leakAndrew Gregory2014-01-06
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Reorder and reshape the package struct for better packingDan McGee2014-01-06
| | | | | | | | | 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>
* Minor struct member reordering for packing concernsDan McGee2014-01-06
| | | | | | | Noticed using clang and `-Wpadded`. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Use O_CLOEXEC as much as possible when opening filesDan McGee2014-01-06
| | | | | | | | | | | | | | | | | | | 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>
* Log more in search debug messageDan McGee2014-01-06
| | | | | Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove -fgnu89-inline from compile optionsDan McGee2014-01-06
| | | | | | | | | 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>
* Clear up definition of INFRQ_ALLDan McGee2014-01-06
| | | | | Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Copy validation field in _alpm_pkg_dupAllan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update comment for local db entry creationAllan McRae2014-01-06
| | | | | | Mention mtree files do not need creation in addtion to install files. Signed-off-by: Allan McRae <allan@archlinux.org>
* deps.c: remove filtered_depend functionsAndrew Gregory2014-01-06
| | | | | | | | | | | | 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>
* Fix build warnings with --disable-nlsAllan McRae2014-01-06
| | | | | | | | 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>
* trans_prepare: always sort trans->remove by depsAndrew Gregory2013-12-19
| | | | | | | | 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>