On Nov 7, 2007, at 3:56 PM, Martin, Craig wrote: > So, basically the pkg_info -E command gives you versions of a > particular > package (with package name and the version in the string that is > returned)
Yes. > Then you put each line of the output on the list pointed to by > pkglist. > The list pointed to by pkglist already has an element with name of a > package that was put on the list because it was associated with a > pkg_remove action in the parsing phase, but the code for > FreeBSDPackageList doesn't really access that list until its starts > adding to it with AppendItem. No, those lists are discrete. > After returning from PackageList, in CheckPackages, you have a list > pointed to by pending_pkgs with one element, that has the package > name, > and an element for every package of that name with the version that > matched the comparison against the desired version. This eventually > gets passed to ProcessPendingPackages? > > My main question is why do you need the first element with the package > name? You are not accessing that element in the function > FreeBSDPackageList and you already have the package name and version > from the input file in the ptr structure. It's not actually there. With FreeBSDPackageList I only get back the list of the relevant packages. > If I comment out the call to AppendItem, in CheckPackages (do.c line > 2885), right before the call to PackageList, I get the get exactly > what > I want, the remove command with a list of all the packages (with > version > and revison number) that matched the cmp from the input file This has something to do with the code for your package manager, because the behavior you describe does not exist for FreeBSD. So we need to look at the code in your package manager routines and see if it is re-using the same pkglist or something. "cfagent -q -d" is very informative about what is passed in and out of each routine. Why don't you send me your patch as it stands (without touching AppendItem) and the output of that command showing the behavior? -- Jo Rhett senior geek Silicon Valley Colocation Support Phone: 408-400-0550 _______________________________________________ Bug-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/bug-cfengine
