summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
AgeCommit message (Collapse)AuthorFilesLines
2007-12-28Add remove counterparts to alpm_option_add_* functionsAllan McRae1-0/+83
Fixes FS#7428. Added functions to remove cachedir, noupgrade, noextract, ignorepkg, holdpkg and ignoregrp. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> [Dan: fix whitespace] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10Update GNU GPL boilerplate and copyright datesDan McGee1-4/+2
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16War on whitespaceDan McGee1-3/+3
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add IgnoreGroup and --ignoregroup option.Nathan Jones1-0/+21
This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04libalpm: open the logstream on demandDan McGee1-23/+6
Don't open a stream to the logfile until necessary. This will allow us to catch any errors in opening the logfile instead of ignorning them. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04Clean up usage of extern variablesDan McGee1-0/+3
Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29libalpm/handle.c: make realpath() call portableDan McGee1-4/+3
BSD didn't support the NULL second argument GNU extension, so do it the old fashioned way. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29libalpm: introduce MALLOC and CALLOC macrosDan McGee1-6/+1
These macros take the place of the common 4 or 5 line blocks of code we had in most places that called malloc or calloc. This should reduce some code duplication and make memory allocation more standard in libalpm. Highlights: * Note that the MALLOC macro actually uses calloc, this is just for safety so that memory is initialized to 0. This can be easily changed in one place. * One malloc call was completely eliminated- it made more sense to do it on the stack. * The use of RET_ERR in public functions (mainly the alpm_*_new functions) was standardized, this makes sense so pm_errno is set. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19Download delta files if UseDelta is set.Nathan Jones1-0/+6
Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-17Avoid segfaults whet calling alpm_option_get_* before initializationStefano Esposito1-19/+164
When calling a function of the alpm_option_get_* group, you get a segfault if you don't call alpm_initialize() first. With this patch those functions set pm_errno to PM_ERR_HANDLE_NULL and return an error value if handle == NULL. (Dan: modified to meet pacman coding standards) Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-23libalpm: add newlines to all strings passed to log callbackDan McGee1-7/+7
This allows us to remove the hack in the frontend where we added a newline to everything coming out of the pm_printf functions, and instead let the developer put newlines where they want them. This should be the last hangover of that auto-newline stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21Post trial install changes, round oneDan McGee1-59/+123
A bunch of changes related to my first "real" install of pacman-git into /usr/local and trying to use it. * Shift some uses of free -> FREE in libalpm. * Move stat and sanity checks of config paths into libalpm from the config and argument parsing in pacman.c. * Fix issue where dbpath still was not defined early enough due to its requirement for being used in alpm_db_register. This should be rewritten so it doesn't have this dependency, but this will work for now. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10Fix issue with <dbpath>/db.lck being truncatedDan McGee1-2/+2
snprintf takes a length including the '\0' character, this wasn't accounted for originally. Fix it. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee1-1/+4
There is no real reason to burden our translators with these messages, as anyone helping to debug these will probably want them in English. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-09Clean up the alpm handleDan McGee1-30/+9
Add some comments in handle.h, and remove the pmaccess_t part that we don't even use. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27Remove lockfile configuration from frontend, make it job of libalpmDan McGee1-10/+7
I previously introduced some patches to make just about every path in pacman/libalpm configurable; doing this with the lockfile seemed a bit too far and we really should just place the lockfile where it belongs- with the DB that needs locking. More details in this thread: http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Allow multiple CacheDirs to be specifiedDan McGee1-8/+16
This should hopefully allow multiple cache dirs to be specified in pacman.conf and/or on the command line, and allow pacman to test each one for the package file. The first one found to be writeable is used as the download cache. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Remove logmask stuff from backend; switch logging callback to new pm_printfDan McGee1-8/+8
Remove the logmask functionality from the backend as it has been moved to the frontend, and change the logging callback function to use pm_printf. In addition, make much better use of va_list- use the args list instead of a arbitrarily chosen string to print to in the logging functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Const correctness!Dan McGee1-4/+5
Add some 'const' keywords all over the code to make it a bit more strict on what you can and can't do with data. This is especially important when we return pointers to the pacman frontend- ideally this would always be untouchable data. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04Rip alpm_parse_config out of libalpmDan McGee1-18/+0
Switch over to the new frontend parseconfig. * Fix a few issues in parseconfig * Remove unused callback upon database registration * Remove conf file related errors from error.c/alpm.h Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04Add a parseconfig to the pacman frontend that compilesDan McGee1-25/+28
Warning: this compiles but may not work as intended quite yet. :) Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04Remove hardcoded defines from libalpmDan McGee1-5/+5
Remove any use of the former path variables defined by the Makefiles or config.h. These are now runtime configurable only with pacman.conf (or by using flags on the command line). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-01Change -z|--showsize flag to ShowSize pacman.conf optionNathan Jones1-0/+6
Also cleaned up some duplicate printf lines related to the ShowSize option. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31Move DB and cache dirs away from there dependence on ROOTDIRDan McGee1-4/+15
This change allows us to use all autoconf specified paths, most notably $(localstatedir). It is quite a change and touches a lot of files, as all references to the DB and cache were done with the ROOTDIR as a prefix. * add --lock command-line option to pacman to specify the location of the lockfile (this can now be specified at configure time by setting the $localstatedir path). * Rip quite a few settings out of configure.ac as they are now picked by setting the paths during configure or make. * Fix bug with /tmp fallback for sync downloads not working correctly (related to root location, now the system tmp dir is used). * Simplified the parameters to some libalpm functions, and added get/set for the new lockfile option. * Renamed several of the DEFS to names without the PM_ prefix. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14Remove unnecessary casts on malloc and elsewhereDan McGee1-1/+1
We had many unnecessary casts, most of them dealing with malloc and other memory allocations. The variable type should take care of it; no need to do it explicitly. In addition, I caught a const error while removing the casts. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREEHANDLE macro and correctly type _alpm_handle_freeDan McGee1-4/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove FREETRANS macro and correctly type _alpm_trans_freeDan McGee1-1/+1
Remove an unnecessary macro, and get rid of the void pointer. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Clean up gettext on the libalpm sideDan McGee1-1/+0
Remove inclusion of libintl.h from all files, because we can do it once in util.c where the _() macro is defined. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-11* Fix group comparison issue and associated compilation warnings by usingDan McGee1-4/+4
the alpm strcmp operation which takes void* references. * We had this great visibility patch, but never actually took advantage of it. Added the right compile flag to make it work and added some more SYMEXPORTs where necessary to have a successful compile.
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee1-3/+5
reordering and adding ones that were forgotten (noticed when trying to compile after reordering). * Updated the HACKING file to include information on #include usage. * print -> vprint in "making dir" function in pactest.
2007-03-04* Fixed the handle realroot stuffAaron Griffin1-4/+6
* Added some {}
2007-03-04* Fixed a whole mess of extra '/' pathing issues when a different root isAaron Griffin1-23/+34
specified * Use db->path when appropriate * Commented out the FAKEROOT checks in libalpm. This should never ever be done. TODO test this quite a bit, as this will never cause the transactions to fail if RW operations are requested... right now it is totally up to the front end to decide when to fail * Use realpath() to canonicalize the root path when specified, so _alpm_makepath() doesn't freak out * Fixed some output/indent of MDFile and SHAFile algorithms * More efficient sprintf() usage in MDFile/SHAFile * Added real error output to _alpm_makepath
2007-03-04* handle changes: callbacks should check handle first, as there's a fewAaron Griffin1-2/+2
occasions where some alpm stuff could be used without initializing the library (vercmp is one). TODO make these functions (handle accessors) better by returning "library not initialized" instead of failing. * Removed NoUpgrade lines from pacman.conf - we need to test this! * Re-corrected the lib targets for src/util/* * make dist seems to have updated the po files
2007-02-21* Re-added a compare function for syncpkg's - it was removed without thinkingAaron Griffin1-24/+55
properly * Error when re-reading the DB for replacements, wrong info level * Removed an duplicate debug message "checking for package replacements" * Check ignorepkg for REAL upgrades... * Properly check the NOSAVE flag * some unlink_file (remove.c) cleanup * fix indent level on handle.c * Force libalpm paths to end with a '/' char * Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t) * Added some debug output to cache and db scanning ** All pactest tests succeed again, yay **
2007-02-12* Updated the README fileAaron Griffin1-11/+0
* Removed the handle->needles param. It's not needed not that alpm_list_t is public
2007-01-31Debug logging changes:Aaron Griffin1-0/+2
* The --debug params were goofy. New setup allows --debug without params, --debug=<level> where level 1=debug output, 2=debug and download output, 3=debug, download, and function tracing output. This seems more sane to me. * Removed PM_LOG_FLOW1 and PM_LOG_FLOW2. They were just confusing. When adding new functions, it is near impossible to determin if your output should be "flow1" or "flow2" without tracking all the way up the call chain. Rarely would one ever say "ok, lets just show "flow2" output. These have both been replaced with PM_LOG_DEBUG * Removed the need for the root parameter on alpm_initialize. it is now defaulted to PM_ROOT just like dbpath and cachedir. This allows alpm to be initialized BEFORE option parsing in the front end, saving us some duplicate variables in the frontend. * Cleaned up front end variables due to early alpm_initialize call.
2007-01-30K. Piche <kevin.piche@cgi.com>Aaron Griffin1-0/+4
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30K. Piche <kpiche@rogers.com>Aaron Griffin1-11/+11
* gcc visiblity changes Also modified _alpm_versioncmp -> alpm_versioncmp (public function) as per K. Piche's suggestions
2007-01-24This mainly deals with code clarity- removing currently unneededAaron Griffin1-8/+24
optimizations in order to make the code much more readable and type-checkable. Every enum in the library now has it's own type that should be used instead of the generic 'unsigned char'. In addition, several #define statements dealing with constants were converted to enums. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2007-01-19Preliminary checkin for alpm_list conversionAaron Griffin1-18/+18
* renamed pmlist_t -> alpm_list_t * made alpm_list_t a public type (alpm_list.h header) * removed additional storage for registered DBs in pacman source * some code cleanup * removed duplicate (pm)list_display functions from pacman source * misc code cleanup
2007-01-18Dan McGee <dpmcgee@gmail.com>Aaron Griffin1-1/+0
* Removed some unnecessary headers and library links * Made things static if possible * Cleaned up makefiles a bit * Fixed some old comments in the code * Fixed some errors the static code checker splint pointed out * Backwards arguments in a memset call in _alpm_db_read (could have been worse) * Other various small fixes Other: * Default to 80 columns when getcols cannot determine display width * Removal of ._install as a valid install file in packages
2006-12-05Corrected -Rsc operation - dependancy info was not being read from the DBAaron Griffin1-4/+4
2006-11-20* repo-add script - to add entries to a db file directly from package data ↵Aaron Griffin1-230/+116
(no PKGBUILD) * libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a typesafe _get_what_we_want(p) scheme [not 100% complete yet] * some const correctness changes * removal of PM_* types in alpm.h in favor of the pm*_t types used throughout libalpm
2006-10-31Numerous changes:Aaron Griffin1-4/+7
* Furthered the "lazy caching" to force the pkgcache to read nothing (INFRQ_NONE) by default. Anything requiring package data should now check the infolevel of each package and attempt to update it. This could be ironed out a bit more later (by using the front-end get_info function * Switched to libfetch. Drastic changes to the download code and the callback progress bar functions. Also fixed the return value of _alpm_downloadfiles_forreal. Downloading now supports http, ftp, https, and files urls, along with 'mtime's and numerous other fancy features from libfetch.
2006-10-21More extern moving - keep extern decls in the headers makes for easier/betterAaron Griffin1-12/+1
reuse.
2006-10-15Merged frugalware changes (too many to list). Also added some config fileAaron Griffin1-4/+132
handling changes (support [sections] to carry over to included files - this helps with backwards compatibility with existing pacman config files)
2006-05-15first stage of i18n stuff from VMiklosJudd Vinet1-13/+14
2006-03-02added a debug logAurelien Foret1-0/+1
2006-02-20the library must provide default values for main optionsAurelien Foret1-0/+3
2006-02-17prepend library function names with _alpm (helped with the patch from ↵Aurelien Foret1-3/+3
VMiklos <vmiklos@frugalware.org>) added log and event callbacks to sync_commit internal transactions