summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2014-08-04replace strdup with STRDUPAndrew Gregory3-11/+7
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04handle_unlock: log error when lock file is missingAndrew Gregory1-6/+14
Problems due to concurrent running instances of pacman can be difficult to diagnose. Log a warning to make it more obvious that that's what happened, that it's a bad idea, and hopefully encourage people who do things like removing the lock file to run pacman from an install script to at least be courteous enough to put it back when they're done. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04handle_unlock: log lock removal failureAndrew Gregory3-11/+6
Rather than have individual callers log failure, just do it directly in _alpm_handle_unlock. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04signing.c: remove useless error checkAndrew Gregory1-1/+0
CHECK_ERR checks gpg_err which is a local variable. Calling gpg_op_import_result cannot modify it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04deps.c: use alpm_list_find_ptrAndrew Gregory1-8/+3
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04dep_graph_init: filter ignored packages by nameAndrew Gregory1-1/+1
Ignored packages are from the transaction remove list which consists of duplicated packages so a direct pointer comparison is not appropriate. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04handle: factor out string list option handlingAndrew Gregory2-58/+39
Consolidates repeated code and replaces dangerous strdup calls with STRDUP. Also fix a couple variables named "pkg" that refer to file paths. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03sync_prepare: remove useless check for replacersAndrew Gregory1-2/+0
Since 017184fa, alpm_sync_sysupgrade will not add both a replacement and a literal upgrade to the transaction. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03move _alpm_lstat into util-commonAndrew Gregory6-32/+5
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03filelist_intersection: manually compare pathsAndrew Gregory1-34/+22
Prevents the need to modify paths, removing strndup as an unchecked point of failure, and lengths only need to be calculated if the paths match. Also removed an old comment regarding directory/symlink compatibility. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
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>