Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2011-06-09Require handle argument to all alpm_trans_*() methodsDan McGee
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 McGee
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 McGee
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 McGee
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 McGee
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 McGee
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 McGee
Introduced by me in commit cc25576f8b54b3. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/add.c
2011-06-07New signatures for alpm initialize and releaseDan McGee
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 McGee
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 McGee
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 McGee
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 McRae
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 McGee
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 McGee
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 McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from some package and db codeDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from diskspace.cDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Remove global handle from util.cDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03Push down extern handle variable to files that need itDan McGee
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 McGee
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 McGee
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 McGee
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 McGee
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 Reisner
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 Reisner
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 McGee
2011-05-24alpm_list: fix typo in doxygen commentPang Yan Han
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-19Bail early if we don't have a valid lockfile pathDan McGee
This addresses FS#24292. If one does the bad thing of not checking pm_errno after calling set_dbpath(), you may not realize the initialization process went wrong and calling trans_init() resulted in a segfault. If we don't have a lockfile path, bail out and have trans_init() fail. Also remove a ALPM_LOG_FUNC call that was causing pm_errno to return "no handle"; this was due to a log call in the handle setup (whereby the log attempts to use a callback attached to the handle). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-19Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/trans.c src/pacman/query.c
2011-05-16Fix segfault when uninstalling broken backed-up symlinkDan McGee
Issue FS#24230. If a symlink is broken and included in the removal process of a package, we blew up and segfaulted due to alpm_compute_md5sum() returning NULL and then performing a strcmp() operation. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-16trans.c: create transaction prior to checking DB versionDave Reisner
The addition of the DB version check introduces a lag time between the lockfile creation and the transaction initialization. In cases where the local DB is large enough and/or the user's disk is slow enough, this time is significant enough that its possible for a user to send a SIGINT and leave behind a db.lck file. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Remove sync DB reregister checkDan McGee
It's your own damn fault if you do this, and this code is remnants from an old time when we weren't very good at coding. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Merge branch 'maint'Dan McGee
2011-05-05Don't null-check handle lists before settingDan McGee
This needlessly prevents the easiest way available of clearing any of these values. We can also do the same for the 'arch' value. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Improve database server APIDan McGee
Currently we have one call that has all sorts of crazy behavior and doesn't make a whole lot of sense. Go from one method to the normal four methods we have for all of our other lists we use in the library to make it a lot easier for a frontend to manipulate server lists. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Ensure populate error return codes are consistentDan McGee
It must be -1 to differentiate it from a number of packages loaded count. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Logging changes during DB loadDan McGee
The switch from FUNCTION to DEBUG was ill-advised inside the local database load. Instead, add a DEBUG level logger to both local and sync database loads that shows the number of packages processed. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05dload: ensure we return success if we found files on any mirrorDan McGee
We were erroring out in the case where a first (possibly bogus) mirror would cause the download process to return a failure code, even though subsequent servers had the file. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Dan broke my patchAllan McRae
Add a missing space. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-05-04Fix incorrect memory allocation assignmentDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04dload: make sure we never print a bogus error bufferDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04Deal with unused function parameters correctlyAllan McRae
This started off removing the "(void)foo" hacks to work around unused function parameters and ended up fixing every warning generated by -Wunused-parameter. Dan: rename to UNUSED. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04Fix warnings reported by -Wwrite-stringsDan McGee
These are places where we stuck a string constant in a variable not marked as const. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04Reduce duplicate signing debug code and fix logic conditionDan McGee
We had a lot of similar looking code that we can collapse down into a function. This also fixes errors seen when turning on some gcc warnings and implicitly casting away the const-ness of the string. Free the list when we are done with it as well. Also, fix a logic error where we should be checking with &&, not ||. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-27Allow conditional compilation with GPGMEDan McGee
This makes it possible to omit usage of -lgpgme, just as we can do for -lcurl and -lcrypto. Thanks to Rémy Oudompheng for an initial stab at this. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24signing: add more detail to unexpected signature count errorDan McGee
Do a quick loop and count of the returned data so we can show how many signatures were parsed and read. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24Enhance GPGME debug outputDan McGee
Add some lookup functions for nice names for the various types used by the library, and remove some fields that are of little use to us in the debug output. This should make looking at key loading and verification a bit easier, especially in determining what makes up our good and bad criteria. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24Perform package verification at package load timeDan McGee
Both md5sum verification and PGP verification can and should be done at package load time. This allows verification to happen as early as possible for packages provided by filename and loaded in the frontend, and moves more stuff out of sync_commit that doesn't really belong there. This should also set the stage for simplified parallel loading of packages later down the road. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24sync_commit: refactor out validate_deltasDan McGee
More stuff going on in the pre-committing stage that can be in a static method to make things a bit more clear. Signed-off-by: Dan McGee <dan@archlinux.org>