<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8385</bug_id>
          
          <creation_ts>2015-09-23 22:58:14 +0000</creation_ts>
          <short_desc>Autobuilder does not always pick up changes in buildset configs</short_desc>
          <delta_ts>2016-05-09 17:36:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>5</classification_id>
          <classification>Infrastructure</classification>
          <product>AutoBuilder</product>
          <component>autobuilder</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tracy Graydon">tracy.graydon</reporter>
          <assigned_to name="Alex Franco">alejandro.franco</assigned_to>
          <cc>alejandro.hernandez</cc>
    
    <cc>elizabeth.flanagan</cc>
    
    <cc>infras.ab.watcher</cc>
    
    <cc>Infras.watcher</cc>
    
    <cc>leonardo.sandoval.gonzalez</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54582</commentid>
    <comment_count>0</comment_count>
    <who name="Tracy Graydon">tracy.graydon</who>
    <bug_when>2015-09-23 22:58:14 +0000</bug_when>
    <thetext>The autobuilder does not always pick up changes in buildset configs, requiring user to go in and delete existing build data from yocto-worker/&lt;project&gt;, tmp dirs, etc. This may even go as far as necessitating the blasting of the database and running the autobuilder set up again. (That bears more investigation to be certain.) 

Initial investigation by Alejandro traces back to the ConfigParer lib. I will defer to him to comment more on that. 

1) Is there a known work around for this issue?

2) There seems like there should be a more graceful way to force the update, f one does not already exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54585</commentid>
    <comment_count>1</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-09-24 05:13:00 +0000</bug_when>
    <thetext>I added a new Test buildstep to a certain buildset, which was not picked up by the autobuilder.
For the sake of simplicity the new buildstep will be executed after the GetDistroVersion and before CreateAutoConf, say the buildset contains something like this:

steps: [{&apos;SetDest&apos;:{}},
        {&apos;CheckOutLayers&apos;: {}},
        {&apos;RunPreamble&apos;: {}},
        {&apos;GetDistroVersion&apos; : {&apos;distro&apos;: &apos;poky&apos;}},
        {&apos;Test&apos; :{}},
        {&apos;CreateAutoConf&apos;: {&apos;machine&apos;: &apos;qemux86&apos;, &apos;SDKMACHINE&apos; : &apos;i686&apos;,
                            &apos;distro&apos;: &apos;poky&apos;, &apos;buildhistory&apos; : True}},
...

I was able to trace this issue back to the ConfigParser library, it is invoked  by lib/python2.7/site-packages/autobuilder/Autobuilder.py on the function ParseConfig like the following:

import ConfigParser  
...
self.config = ConfigParser.ConfigParser()  
self.configdir=os.path.dirname(self.cfile)  
self.configfiles = [ join(self.configdir,f) for f in listdir(self.configdir) if isfile(join(self.configdir,f)) and (f != &apos;autobuilder.conf&apos;) ]  
    try:  
        self.config.read(self.configfiles)
...
self.buildsets=self.config.sections()  
self.configdict = {}  
for section in self.buildsets:  
    self.configdict[section]= dict(self.config.items(section))

Basically, after parsing the self.configfiles it creates a dictionary for every section (see https://docs.python.org/2/library/configparser.html), when reading that dictionary we can see that it is already missing the new buildstep:

[{&apos;SetDest&apos;: {}}, {&apos;CheckOutLayers&apos;: {}}, {&apos;RunPreamble&apos;: {}}, {&apos;GetDistroVersion&apos;: {&apos;distro&apos;: &apos;poky&apos;}}, {&apos;CreateAutoConf&apos;: {&apos;machine&apos;: &apos;qemux86&apos;, &apos;SDKMACHINE&apos; : &apos;i686&apos;,&apos;distro&apos;: &apos;poky&apos;, &apos;buildhistory&apos; : True}}}

This means the data is coming incomplete from ConfigParser, which comes from the HOST, we need to find out how it is caching the data (I didn&apos;t see any documentation regarding ConfigParser cache) and also find a way to force it to reparse the config files more easily.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54586</commentid>
    <comment_count>2</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-09-24 05:44:21 +0000</bug_when>
    <thetext>Well, I figured out what the problem was, the issue is that emacs creates temporary files ending with a &quot;~&quot;, so for buildset_test.conf we also have buildset_test.conf~ which is also parsed by ConfigParser, and apparently, if it ends up being parsed after the original file, it overrides the values obtained from the original configuration, so if a temporary file is old enough, it won&apos;t have the latest changes of the original file, which will cause the issue.

We can either assume the user won&apos;t have these temporary files, or maybe ignore them, I will send a patch to ignore these files since I feel a more robust system is a better solution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58806</commentid>
    <comment_count>3</comment_count>
    <who name="Tracy Graydon">tracy.graydon</who>
    <bug_when>2016-02-10 00:07:53 +0000</bug_when>
    <thetext>Alejandro, have you seen this issue recur? I have not seen it in awhile and haven&apos;t been able to replicate what I was seeing. (Similar issue with no temp files.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60508</commentid>
    <comment_count>4</comment_count>
    <who name="Alex Franco">alejandro.franco</who>
    <bug_when>2016-03-29 21:26:27 +0000</bug_when>
    <thetext>Currently reproducing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60628</commentid>
    <comment_count>5</comment_count>
    <who name="Alex Franco">alejandro.franco</who>
    <bug_when>2016-03-31 21:07:06 +0000</bug_when>
    <thetext>Tested with several conf files in buildset-config, which contain the same buildset (with a different branch, to see the changes) but have different names, including filenames ending in ~

e.g:

MORE_3~.conf
nightly-x86-64.conf
~nightly-x86-64.conf
nightly-x86-64.conf~
z_anotherfile.conf~

The behavior I observed:

The AB config parser will read all files ending in .conf (it skips other cases, including files ending in .conf~) regardless of the rest of the file names, and read the buildsets in them. It will match the names found under the section [BuildSets] to buildset names created as sections in those config files (e.g. [nightly-x86-64]).

I can not reproduce the AB reading config from files ending in ~

I propose adding a WARNING when a buildset section is found more than once</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60633</commentid>
    <comment_count>6</comment_count>
    <who name="Alex Franco">alejandro.franco</who>
    <bug_when>2016-03-31 21:31:52 +0000</bug_when>
    <thetext>Also it seems this has been resolved by Beth Flanagan&apos;s commit:

http://git.yoctoproject.org/cgit/cgit.cgi/yocto-autobuilder/commit/lib/python2.7/site-packages/autobuilder/Autobuilder.py?id=4b9bfc3c0b429589714cfc157532559ebd73ef43</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>