summaryrefslogtreecommitdiff
path: root/lib/libalpm/conflict.h
AgeCommit message (Collapse)Author
2013-01-03Update copyright year for 2013Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-02Move filelist functions into separate source fileDan McGee
We have a few of these and might as well gather them together. This also cleans up the code a bit by using an enum instead of integer values, as well as makes a "search for file in filelist" function public so frontends can do better than straight linear search of the filelists. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20Update copyright yearsAllan McRae
Add 2012 to the copyright range for all libalpm and pacman source files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-21Convert package filelists to an array instead of linked listDan McGee
This accomplishes quite a few things with one rather invasive change. 1. Iteration is much more performant, due to a reduction in pointer chasing and linear item access. 2. Data structures are smaller- we no longer have the overhead of the linked list as the file struts are now laid out consecutively in memory. 3. Memory allocation has been massively reworked. Before, we would allocate three different pieces of memory per file item- the list struct, the file struct, and the copied filename. What this resulted in was massive fragmentation of memory when loading filelists since the memory allocator had to leave holes all over the place. The new situation here now removes the need for any list item allocation; allocates the file structs in contiguous memory (and reallocs as necessary), leaving only the strings as individually allocated. Tests using valgrind (massif) show some pretty significant memory reductions on the worst case `pacman -Ql > /dev/null` (366387 files on my machine): Before: Peak heap: 54,416,024 B Useful heap: 36,840,692 B Extra heap: 17,575,332 B After: Peak heap: 38,004,352 B Useful heap: 28,101,347 B Extra heap: 9,903,005 B Several small helper methods have been introduced, including a list to array conversion helper as well as a filelist merge sort that works directly on arrays. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-03Move alpm filelists to a struct objectDan McGee
This allows us to capture size and mode data when building filelists from package files. Future patches will take advantage of this newly available information, and frontends can use it as well. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-28Rename pmfileconflict_t to alpm_fileconflict_tAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmconflict_t to alpm_conflict_tAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdb_t to alpm_db_tAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmhandle_t to alpm_handle_tAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-16Make struct pmconflict_t publicDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16Make pmfileconflict_t type publicDan McGee
This removes the need to write accessor methods for every type we have, and simplifies the API. Any type that doesn't need magic* can be converted in this fashion to make it easier for frontend applications to use, as well as make it less of a pain to introduce new such structs in the future. * "magic" meaning something like pmpkg_t where values can be lazy loaded. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13Move pm_errno onto the handleDan McGee
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13Require handle for alpm_checkconflicts()Dan McGee
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-02-16Conflict checking code cleanupDan McGee
* Make conflict_isin() static; it is used nowhere else. * Remove does_conflict(): it turns out to be replaceable by a single call to _alpm_depcmp(). By pushing it up, we can reduce calls to _alpm_splitdep() from 60,368 to 16,940 during one test -Su operation I ran. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Update copyright years for 2011Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Bump copyright dates to 2010Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08Add a new reason field to pmconflict_t structNagy Gabor
Sometimes "foo conflicts with bar" information is not enough, see this thread: http://bbs.archlinux.org/viewtopic.php?id=77647. That's why I added a new reason field to our pmconflict_t struct that stores the packager- defined conflict that induced the fact that package1 conflicts with package2. I modified the front-end (in callback.c, sync.c, upgrade.c) to print this new information as well. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2009-07-01Update copyright headers and messagesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11Fix for trans001.py (FS#9088)Nagy Gabor
From now on _alpm_db_find_fileconflicts() works with upgrade and remove target lists (like checkdeps), which makes it transaction independent (we still need a trans param because of the progressbar). This is a small step towards the universal transaction. So we call this function directly from sync.c before commiting the remove transaction. This is much safer, but we can get false fileconflict error alarms in some tricky cases ("symlinks puzzle" etc). The patch on find_fileconflict looks complex, but it is mainly an "indent-patch", the new code-part can be found after the /* check remove list ... */ comment, and I modified something around the "file has changed hand" case (see comment modifications in the code). Unfortunately sync.c became more ugly, because we have to create 2 parallel internal transactions: to avoid duplicated work, upgrade transaction is used to load package data (filelists). This problem will disappear, when we finally get rid of internal transactions. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27New _alpm_conflict_dup functionNagy Gabor
Added function to cleanly duplicate a conflict. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-23Add new public alpm_checkdbconflicts function.Chantry Xavier
This function has a limited purpose, but might be interesting to do a sanity check from a frontend (eg testdb). Also removed the private _alpm_checkconflicts function to avoid confusion. This function was used only once in libalpm, in sync.c, and was just a single line anyway. Having to do it manually makes it explicit that we are looking for two kind of conflicts (targ vs targ and db vs targ). Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11Use dynamic string allocation in package structuresDan McGee
This also affects all structures with static strings, such as depmiss, conflict, etc. This should help a lot with memory usage, and hopefully make things a bit more "idiot proof". Currently our pactest pass/fail rate is identical before and after this patch. This is not to say it is a perfect patch- I have yet to pull valgrind out. However, this should be quite safe to use in all situations from here on out, and we can start plugging the memleaks. Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10Update GNU GPL boilerplate and copyright datesDan McGee
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-25_alpm_checkconflicts splitNagy Gabor
_alpm_innerconflicts: check for target<->target conflicts _alpm_outerconflicts: check for target<->localpkg conflicts This will be useful in sync.c clean-up and in testdb.c As an application the patch also fixes a misleading message (and a memleak) in add.c Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18Add the pmconflict_t type.Nagy Gabor
pmdepmissing_t was used for two totally different things : missing dependencies, and dependency conflicts. So this patch simply adds a type for dep conflicts, and convert the code to use it. This fix the TODO in conflict.c : /* TODO WTF is a 'depmissing' doing indicating a conflict? */ Additionally, the code in conflict.c now eliminates the duplicated conflicts. If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored. However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too. This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot). Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18Simple s/conflict/fileconflict/ renaming.Chantry Xavier
The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-16War on whitespaceDan McGee
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee
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-02-20* Updated conflict checking one last time. You can finally have a file moveDan McGee
from one package to another seemlessly (knock on wood). This is implemented through the use of two skip lists in the trans struct- skip_add and skip_remove, which replace the former trans->skiplist. * Removed an unnecessary function parameter, added a necessary one. * If a package has no backup files, print '(none)' under the heading so it is more obvious. * Updated my TODO list.
2007-01-24This mainly deals with code clarity- removing currently unneededAaron Griffin
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 Griffin
* 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
2006-11-20* repo-add script - to add entries to a db file directly from package data ↵Aaron Griffin
(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-20A handful of minor changes:Aaron Griffin
* Removed the PMList typedef, in favor of the same naming scheme other structs use 'pmlist_t' * Added a time stamp on debug output, to make it more informational * Moved alpm_db_register to _alpm_db_register, making the public function not take a callback parameter
2006-10-15Applied Frugalware patch from Christian Hamar alias krix <krics@linuxforum.hu>Aaron Griffin
for file-conflict progress bar Also did some CVS cleanup, removing some of the autogenerated files that shouldn't have been there
2006-02-17prepend library function names with _alpm (helped with the patch from ↵Aurelien Foret
VMiklos <vmiklos@frugalware.org>) added log and event callbacks to sync_commit internal transactions
2006-02-05added a pmconflict_t structure to handle file conflictsAurelien Foret
2006-01-15pulled out conflict checkings from checkdeps() in its own function: ↵Aurelien Foret
checkconflicts()
2006-01-02patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSIONJudd Vinet
2005-10-07Merging in recent fixes/additions from 2.9.7Judd Vinet
2005-03-22moved db_find_conflicts from db.c to conflict.cAurelien Foret