4. Hmm, how am I supposed to rebase your unneeded patch now? :) Seems like the "causingpkg" is now hidden behind the alpm_list_find + satisfycmp function. Well, then you must compute it... If we know a dependency that would be broken after -R, we just find a satisfier in the target list and keep that target.
One note (the same holds for checkconflicts): Using pmdb_t* in the parameter list is "elegant" but usually only pkgcache is needed <- I mean checkdeps now. Sometimes alpm_list_t* pkgcache param would be more efficient: You must do a "checkdeps loop" in -Ru, because consider the following example: "pacman -Ru a b c" where localpkg->a->b->c (-> stands for 'depends on') First -Ru will detect that you cannot remove a, because that would break ->a dependency of localpkg, thus it removes a from the target list. In the next loop it will detect then you cannot remove b neither ... But after a target-removal it is enough to pass the old targetlist to checkdeps instead of the whole localdb, since we know that all packages of localdb - oldtargetlist won't be broken after newtargetlist removal. Bye