[pacman-dev] [PATCH] alpm_checkdeps clean-up <- some notes
Nagy Gabor
ngaba at bibl.u-szeged.hu
Sun Dec 2 17:09:03 EST 2007
Idézés Xavier <shiningxc at gmail.com>:
> On Sat, Dec 01, 2007 at 11:25:45PM +0100, Nagy Gabor wrote:
> > > 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.
> >
>
> Well, I rebased your -Ru patch, and it seems to work fine (at least it
> didn't
> break any pactest), but just in case, here is the important part of the
> rebased patch
> (I will attach the whole patch as well) :
>
> @@ -295,10 +296,17 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int
> reversedeps,
> pmpkg_t *lp = i->data;
> for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
> pmdepend_t *depend = j->data;
> + int found = 0;
> + pmpkg_t *causingpkg = NULL;
> /* we won't break this depend, if it is
> already broken, we ignore it */
> + for(k = modified; k && !found; k = k->next)
> {
> + causingpkg = k->data;
> + found = alpm_depcmp(causingpkg,
> depend);
> + }
> +
> /* 1. check upgrade list for satisfiers */
> /* 2. check dblist for satisfiers */
> - if(alpm_list_find(modified, depend,
> satisfycmp) &&
> + if(found &&
> !alpm_list_find(upgrade, depend,
> satisfycmp) &&
> !alpm_list_find(dblist, depend,
> satisfycmp)) {
> char *missdepstring =
> alpm_dep_get_string(depend);
> @@ -306,7 +314,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int
> reversedeps,
> missdepstring,
> alpm_pkg_get_name(lp));
> free(missdepstring);
> miss = _alpm_depmiss_new(lp->name,
> depend->mod,
> - depend->name,
> depend->version);
> + depend->name,
> depend->version, alpm_pkg_get_name(causingpkg));
> baddeps = alpm_list_add(baddeps,
> miss);
> }
> }
>
Looks fine. We also can modify alpm_list_find to return NULL if no element was
found or return with a pointer to the "found" element.
Bye
----------------------------------------------------
SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/
More information about the pacman-dev
mailing list