The package actually gets added in CheckPackages at line 2885
/* Handle install/remove logic now. */
if (match)
{
AddMultipleClasses(ptr->defines);
if (ptr->action == pkgaction_remove)
{
**** AppendItem(&pending_pkgs,name,NULL);
PackageList(ptr,name,ptr->pkgmgr,ptr->ver,ptr->cmp,&pending_pkgs);
}
else if (ptr->action == pkgaction_upgrade)
{
UpgradePackage(ptr,name,ptr->pkgmgr,ptr->ver,ptr->cmp);
}
}
And it adds it to the list regardless of the package manager. Are you
sure you don't have at something on the list when FreeBSDPackageList is
invoked?
Craig J. Martin, Sr. Systems/Applications Engineer | Travelocity | *W:
682.605.6374 | *M: 972.365.2038 | Loc: B1-268
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Martin, Craig
Sent: Tuesday, October 30, 2007 3:31 PM
To: Jo Rhett
Cc: bug-cfengine
Subject: RE: cfengine code for PackageList and PackageCheck
Yeah I noticed the ptr->action thing after I hit send.
When you do pkg_info -E in FreeBSDPackageList, does pkg_info return just
the version or the package name with the version attached? (i.e. 1.30 vs
httpd-1.30 or something like that)
Craig J. Martin, Sr. Systems/Applications Engineer | Travelocity | *W:
682.605.6374 | *M: 972.365.2038 | Loc: B1-268
-----Original Message-----
From: Jo Rhett [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 30, 2007 3:24 PM
To: Martin, Craig
Cc: bug-cfengine
Subject: Re: cfengine code for PackageList and PackageCheck
First, please retain CC to bug-cfengine, and join the list. That is
where development is happening. (or help-cfengine at least)
I can't do this work from my inbox, really ;-)
What you are observing is unique to the RPM implementation obviously.
The other platforms aren't using the same list for both.
Frankly, if you can set the list in PackageCheck and then have it
available in PackageList then more power to you -- it will be more
efficient. Obviously test to confirm that it does what you expect.
(if it exits after the first match, then it won't do what you need)
FYI: Exact word for word of what you wrote below doesn't match my
reading of the code, but I think I read between the lines to understand
what you meant. ptr->action is not defined in PackageList for example,
that's all part of the structure passed in do.c ...
Martin, Craig wrote:
> That's what I thought.
>
> I am expecting list pending_pkgs to be empty when I call PackaageList,
> but the package I want removed is already on the list by the time it
> gets to RPMPackageList.
>
> PackageCheck (called from CheckPackages, in do.c) discovers a package,
> that needs deleting, it sets ptr->action to pkgaction_remove and this
> causes the logic in CheckPackages to add the package to pending_pkgs.
> So why do I need to generate a list in PackageList, if I already have
> the package?
>
> Craig J. Martin, Sr. Systems/Applications Engineer | Travelocity | *W:
> 682.605.6374 | *M: 972.365.2038 | Loc: B1-268
>
> -----Original Message-----
> From: Jo Rhett [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 30, 2007 11:58 AM
> To: Martin, Craig
> Cc: bug-cfengine
> Subject: Re: cfengine code for PackageList and PackageCheck
>
> Martin, Craig wrote:
>> I am attempting to code the indicated functions for RPMs. We have
>> talked about this before. Since I didn't write it down and my memory
>> isn't what it used to be, what is the purpose of the package manager
>> specific version of the functions in the subject line (i.e.
>> RPMPackageList and RPMPackageCheck). I have been looking the FreeBSD
>> incarnations and they seem to do almost exactly the same thing.
>
> Yes, almost exactly is the key. Close enough I wish I had a useful
way
> to cache the information ;-)
>
> PackageCheck returns 0 or 1. Yes or no.
>
> PackageList fills an array with the matching packages.
>
> The former is used to determine if action is necessary. The later is
> used to determine which packages to remove.
>
--
Jo Rhett
senior geek
Silicon Valley Colocation
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine