Forum: Cfengine Help
Subject: Re: Package architecture specification being ignored by cf3
Author: daveseff
Link to topic: https://cfengine.com/forum/read.php?3,17577,20091#msg-20091

I have managed to verify and fix the bug on my end. I'm submitting the diff 
here for review. Mark B, I tried to follow your coding style). It treats each 
package arch as it's own package. If the end user has foo.i386 and needs 
foo.xxx (or vice versa) It will install the missing arch package. 

 
Index: verify_packages.c
===================================================================
--- verify_packages.c   (revision 1686)
+++ verify_packages.c   (working copy)
@@ -472,16 +472,6 @@
    no_version = true;
    CfOut(cf_verbose,""," -> Package version was not specified");
       
-   for (rp = a.packages.package_architectures; rp != NULL; rp=rp->next)
-      {
-      CfOut(cf_verbose,""," ... trying listed arch %s\n",rp->item);
-      strncpy(name,pp->promiser,CF_MAXVARSIZE-1);
-      strncpy(version,"*",CF_MAXVARSIZE-1);
-      strncpy(arch,rp->item,CF_MAXVARSIZE-1);
-      installed += PackageMatch(name,"*","*",a,pp);
-      matches += PackageMatch(name,version,arch,a,pp);
-      }
-   
    if (a.packages.package_architectures == NULL)
       {
       strncpy(name,pp->promiser,CF_MAXVARSIZE-1);
@@ -489,13 +479,26 @@
       strncpy(arch,"*",CF_MAXVARSIZE-1);
       installed = PackageMatch(name,"*","*",a,pp);
       matches = PackageMatch(name,version,arch,a,pp);
+      CfOut(cf_verbose,""," -> %d package(s) matching the name \"%s\" already 
installed\n",installed,name);
+      CfOut(cf_verbose,""," -> %d package(s) match the promise body's criteria 
fully\n",matches,name);
+      SchedulePackageOp(name,version,arch,installed,matches,no_version,a,pp);
       }
+   else
+      {
+      for (rp = a.packages.package_architectures; rp != NULL; rp=rp->next)
+         {
+         CfOut(cf_verbose,""," ... trying listed arch %s\n",rp->item);
+         strncpy(name,pp->promiser,CF_MAXVARSIZE-1);
+         strncpy(version,"*",CF_MAXVARSIZE-1);
+         strncpy(arch,rp->item,CF_MAXVARSIZE-1);
+         installed += PackageMatch(name,"*",arch,a,pp);
+         matches += PackageMatch(name,version,arch,a,pp);
+         CfOut(cf_verbose,""," -> %d package(s) matching the name \"%s\" 
already installed\n",installed,name);
+         CfOut(cf_verbose,""," -> %d package(s) match the promise body's 
criteria fully\n",matches,name);
+         
SchedulePackageOp(name,version,arch,installed,matches,no_version,a,pp);
+         }
+      }
    }
-
-CfOut(cf_verbose,""," -> %d package(s) matching the name \"%s\" already 
installed\n",installed,name);
-CfOut(cf_verbose,""," -> %d package(s) match the promise body's criteria 
fully\n",matches,name);
-
-SchedulePackageOp(name,version,arch,installed,matches,no_version,a,pp);
 }
 
 /*****************************************************************************/


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to