summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2011-06-14Rename and rework signing helper methodsDan McGee1-38/+36
* Don't name static methods with a gpgme_ prefix to avoid confusion with methods provided by the library. These are static and local to our file so just give them sane non-prefixed names. * Rework sigsum_test_bit() to not require assignment. * Don't balk if there is more than one signature available (for now, only check the first). * Fix error codes in publicly visible methods to return -1, not 0, if pkg or db are not provided. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Alpm pkg accessors: ensure pkg argument is non-NULLDan McGee1-0/+28
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Ensure handle is valid and pm_errno is reset when calling into APIDan McGee15-69/+128
We didn't do due diligence before and ensure prior pm_errno values weren't influencing what happened in further ALPM calls. I observed one case of early setup code setting pm_errno to PM_ERR_WRONG_ARGS and that flag persisting the entire time we were calling library code. Add a new CHECK_HANDLE() macro that does two things: 1) ensures the handle variable passed to it is non-NULL and 2) clears any existing pm_errno flag set on the handle. This macro can replace many places we used the ASSERT(handle != NULL, ...) pattern before. Several other other places only need a simple 'set to zero' of the pm_errno field. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Conflict check and skip_remove code cleanupsDan McGee2-39/+55
* Move several variables into better scope * const-ify a few variables * Avoid duplicating filelists if it is unnecessary * Better handling out out of memory condition when adding file conflicts to our list Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Small handle related cleanupsDan McGee3-5/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add handle argument to _alpm_pkg_should_ignore()Dan McGee4-13/+14
This allows callers to retrieve it from wherever is convenient, which may or may not be on the package object itself. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Remove alpm_db_get_url()Dan McGee2-20/+0
This method is old, it doesn't adequately check for a NULL server list, and can easily be done using better API method we provide these days. All former users of this method can get similar results by calling alpm_db_get_servers() and using the data from the returned server list. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add a helper method for retrieving the DB signature pathDan McGee2-0/+15
Note that is a bit different than the normal _alpm_db_path() method; the caller is expected to free the result. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14alpm_db_update(): refactor out sync dir create/checkDan McGee1-22/+31
This was a lot of stuff that can stand by itself for the most part. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Remove global handle variableDan McGee3-15/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Switch all logging to use handle directlyDan McGee22-368/+360
This is the last user of our global handle object. Once again the diff is large but the functional changes are not. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Move pm_errno onto the handleDan McGee29-383/+360
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add handle argument to two more alpm methodsDan McGee5-31/+39
This takes care of alpm_checkdeps() and alpm_find_dbs_satisfier(). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Require handle for alpm_checkconflicts()Dan McGee4-11/+15
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Require handle for alpm_pkg_load()Dan McGee4-13/+16
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add handle argument to alpm_(add|remove)_pkg()Dan McGee3-10/+15
This makes these functions consistent with the rest of the transaction related API calls. We do an additional assert to ensure the handle attached to the package is the same as the handle passed in. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Added initialization code for database siglevelKerrick Staley1-0/+1
The siglevel field of a newly created pmdb_t struct is now initialized when it is created in _alpm_db_new(). Signed-off-by: Kerrick Staley <mail@kerrickstaley.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Fix memory leak if package sig was invalidDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Fix all current return(x) usagesDan McGee1-2/+2
A few of these snuck in as of late, some from the table display patches that were using the previous format before we changed it after the 3.5.X major release. Noticed-by: Kerrick Staley <mail@kerrickstaley.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09commit_single_pkg(): Use handle object directlyDan McGee1-6/+6
Commit e68f5d9a3067141 did something a bit silly and changed the scriptlet calls to use 'newpkg->handle' rather than the 'handle' argument passed in. Use the handle directly. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle for alpm_sync_sysupgrade()Dan McGee2-5/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle for alpm_db_register_sync()Dan McGee2-5/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle argument to all alpm_trans_*() methodsDan McGee3-25/+30
Begin enforcing the need to pass a handle. This allows us to remove one more extern handle declaration from the backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle argument to all alpm_option_(get|set)_*() methodsDan McGee18-251/+202
This requires a lot of line changes, but not many functional changes as more often than not our handle variable is already available in some fashion. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle argument to alpm_logaction()Dan McGee7-30/+30
This is the first in a series of patches to update the API to remove the implicit global handle variable. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Kill all remaining 'PATH_MAX + 1' usagesDan McGee4-7/+7
The few remaining instances were utilized for buffers in calls to snprintf() and realpath(). Both of these functions will always ensure the returned value is padded with '\0', so there is no need for the extra byte. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09_alpm_lstat: only duplicate string if necessaryDan McGee1-7/+8
The vast majority of the time we will just be passing the same string value on to the lstat() call. The only time we need to duplicate it is if the path ends in '/'. In one run using a profiler, only 400 of the 200,000 calls (0.2%) required the string to be copied first. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-08Fix graph free valgrind warningsDan McGee1-11/+0
Due to the way we set up the graph structure, we don't always have good parent information. The changes made in dd8cf0c12dd5e assumed this, so back them out and just live with the dead pointers being there in the memory while we are cleaning up after ourselves. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-08Plug a memory leakDan McGee1-0/+1
Introduced by me in commit cc25576f8b54b3. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Merge branch 'maint'Dan McGee1-1/+1
Conflicts: lib/libalpm/add.c
2011-06-07New signatures for alpm initialize and releaseDan McGee7-91/+72
These new method signatures return and take handle objects to operate on so we can move away from the idea of one global handle in the API. There is also another important change and that deals with the setting of root and dbpaths. These are now done at initialization time instead of using setter methods. This allows the library to operate more safely knowing that paths won't change underneath it. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Add cachedirs one-by-one in set_cachedirs()Dan McGee1-2/+10
This addresses the issue where calling set_cachedirs() didn't canonicalize the passed-in paths. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Be consistent with memory treatment for plural option settersDan McGee1-5/+5
In all cases we should duplicate the passed-in list so the caller is free to do with it as it pleases. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Add helper methods for setting directory optionsDan McGee5-63/+64
This keeps duplicate code to a minimum. This will come in more handy as we refactor some of these option setters away. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Remove incorrect output when downloading onlyAllan McRae1-1/+1
When only downloading a package, pacman can produce some incorrect output. > pacman -Sddw nvidia-utils warning: nvidia-utils-270.41.19-1 is up to date -- reinstalling This line is now now silenced when using -Sw. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Use standard errno codes in return from _alpm_archive_fgetsDan McGee3-11/+28
This allows us to not require the context (e.g. handle) when calling this function. Also beef up the checks in the two callers of this function to bail if the last return code is not ARCHIVE_EOF, which is the expected value. This requires a change to one of the pactest return codes and the overall result of the test, but results in a much safer operating condition whereby invalid database entries will stop the operation. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle dependencies from sync/upgrade pathsDan McGee7-66/+55
This kills a lot more global handle business off. sync.c still requires the handle declaration for one reference that can't be changed yet; it will be removed in a future patch which isolates all of the necesary API changes. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from remove.cDan McGee5-36/+30
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from some package and db codeDan McGee6-41/+17
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from diskspace.cDan McGee3-14/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from util.cDan McGee6-38/+36
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Push down extern handle variable to files that need itDan McGee18-3/+48
This will make the patching process less invasive as we start to remove this variable from all source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Add handle attribute to pmpkg_t structDan McGee5-4/+10
Similar to what we just did for the database; this will make it easy to always know what handle a given package originated from. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Add handle attribute to pmdb_t structDan McGee5-2/+6
This is the first step in a long process to remove our dependence on the global handle variable we currently share in libalpm, with the goal to make things a bit more thread-safe and re-entrant. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove unnecessary handle != NULL assertsDan McGee2-15/+0
These are simple accessor functions for a struct; the handle never even comes into play when calling these functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove ALPM_LOG_FUNC macroDan McGee22-252/+0
The usefulness of this is rather limited due to it not being compiled into production builds. When you do choose to see the output, it is often overwhelming and not helpful. The best bet is to use a debugger and/or well-placed fprintf() statements. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01lib/dload.c: remove assumption in continuation logicDave Reisner1-5/+3
Callers to curl_download_internal now tell us if its okay to continue a transfer, so obey this instead of using a heuristic. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01dload: abort transfer on CURLOPT_LOW_SPEED_LIMITDave Reisner1-0/+2
If a connection drops below 1kb/s for 10s, curl will kill the transfer and we'll report failure. This is the average transfer speed over the delta defined by CURLOPT_LOW_SPEED_TIME, so setting a low value here shouldn't bother folks using 14.4k dial-up. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-01Merge branch 'maint'Dan McGee3-4/+3
2011-05-24alpm_list: fix typo in doxygen commentPang Yan Han1-1/+1
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>