On Fri, Jul 27, 2007 at 04:48:42PM -0500, Aaron Griffin wrote:
On 7/15/07, Xavier <shiningxc@gmail.com> wrote:
I've benn looking at that function again, and here is what I saw in Andrew's commit : +/* TODO: This should use _alpm_checkdeps() */ int pacman_deptest(alpm_list_t *targets)
As I tried to explain there : http://www.archlinux.org/pipermail/pacman-dev/2007-June/008654.html
checkdeps isn't really what we want. Here, we just want to check that a list of dependencies from the PKGBUILD is already installed locally. checkdeps however checks if we can install a package, by checking its dependencies. And checkdeps gets this information from the sync or local databases, it can't really get the deps list from an external PKGBUILD.
But there is at least one way to do that, it's creating a dummy package, with the same list of dependencies as in the PKGBUILD, and work with that in libalpm. I looked at the history of deptest(), and it's actually what Aurelien did at some point : http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=0756af675d6b99a1c... http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=cda9c6671ced31a7d...
But it was rather messy, so Aaron cleaned that : http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=4dd6c9222879198ea...
So well, I still have the same opinion that in my earlier answer to Andrew, what pacman_deptest does is just the mythic "search for satisfier" function that Nagy has been talked about for ages, and that is used everywhere in the code :)
Going through email here, and bringing things up. To get me back up to speed better - what is actionable here? Are you saying you don't like Andrew's change, or do you have something that supersedes it?
No, Andrew's change was a minor one and was right. I was just referring to the "TODO : use _alpm_checkdeps". I was mostly pointing out that using checkdeps wasn't straightforward. And that for using it, I believe there is a need of creating dummy package. So that either Aurelien's way of creating dummy packages would need to be restored, or that another one should be implemented. The current code is ok, but if this code was going to be refactored, there are 2 ways : 1) reimplement dummy packages and use _alpm_checkdeps 2) refactor the search for satisfier code in libalpm and use that here. So instead of the current : /* TODO: This should use _alpm_checkdeps() */ it could be something like that : /* TODO: This could either use _alpm_checkdeps() after reintroducing a way of * creating dummy packages, or the search for satisfier code here could be refactored * in a function in libalpm. */ or no TODO at all, since the current code is alright. It's just that some refactoring work could help here, but not more than in many other parts of libalpm/pacman.