]> code.ossystems Code Review - openembedded-core.git/commitdiff
distro_check: fix for natives, cross, and initial recipe types
authorSaul Wold <Saul.Wold@intel.com>
Fri, 27 Aug 2010 02:46:40 +0000 (19:46 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 2 Sep 2010 08:38:35 +0000 (09:38 +0100)
datetime checking is changed to be once per day

Signed-off-by: Saul Wold <Saul.Wold@intel.com>
distro_check: fix for natives, cross, and initial recipe types

Signed-off-by: Saul Wold <Saul.Wold@intel.com>
meta/classes/utility-tasks.bbclass
meta/lib/oe/distro_check.py

index b3609965e72c6787e4f9d39db4fc34fa679c6fa2..8e905308be5d96273f4948bcac94902977bbccbd 100644 (file)
@@ -488,6 +488,31 @@ do_buildall() {
        :
 }
 
+addhandler check_eventhandler
+python check_eventhandler() {
+    from bb.event import Handled, NotHandled
+    # if bb.event.getName(e) == "TaskStarted":
+
+    if bb.event.getName(e) == "BuildStarted":
+        import oe.distro_check as dc
+        tmpdir = bb.data.getVar('TMPDIR', e.data, 1)
+        distro_check_dir = os.path.join(tmpdir, "distro_check")
+        datetime = bb.data.getVar('DATETIME', e.data, 1)
+        """initialize log files."""
+        logpath = bb.data.getVar('LOG_DIR', e.data, 1)
+        bb.utils.mkdirhier(logpath)
+        logfile = os.path.join(logpath, "distrocheck.%s.csv" % bb.data.getVar('DATETIME', e.data, 1))
+        if not os.path.exists(logfile):
+                slogfile = os.path.join(logpath, "distrocheck.csv")
+                if os.path.exists(slogfile):
+                        os.remove(slogfile)
+                os.system("touch %s" % logfile)
+                os.symlink(logfile, slogfile)
+                bb.data.setVar('LOG_FILE', logfile, e.data)
+
+    return NotHandled
+}
+
 addtask distro_check
 do_distro_check[nostamp] = "1"
 python do_distro_check() {
@@ -495,12 +520,9 @@ python do_distro_check() {
     import oe.distro_check as dc
     localdata = bb.data.createCopy(d)
     bb.data.update_data(localdata)
-
-    tmpdir = bb.data.getVar('TMPDIR', localdata, 1)
+    tmpdir = bb.data.getVar('TMPDIR', d, 1)
     distro_check_dir = os.path.join(tmpdir, "distro_check")
     datetime = bb.data.getVar('DATETIME', localdata, 1)
-
-    # if distro packages list data is old then rebuild it 
     dc.update_distro_data(distro_check_dir, datetime)
 
     # do the comparison
@@ -510,3 +532,10 @@ python do_distro_check() {
     dc.save_distro_check_result(result, datetime, d)
 }
 
+addtask distro_checkall after do_distro_check
+do_distro_checkall[recrdeptask] = "do_distro_check"
+do_distro_checkall[nostamp] = "1"
+do_distro_checkall() {
+       :
+}
+
index 58972585a62e84b2f6776a4420087598556ed946..3f61630d1ac13b2c508d8e7770e5f08092b81058 100644 (file)
@@ -230,7 +230,7 @@ def update_distro_data(distro_check_dir, datetime):
         f = open(datetime_file, "r+b")
         fcntl.lockf(f, fcntl.LOCK_EX)
         saved_datetime = f.read()
-        if saved_datetime != datetime:
+        if saved_datetime[0:8] != datetime[0:8]:
             bb.note("The build datetime did not match: saved:%s current:%s" % (saved_datetime, datetime))
             bb.note("Regenerating distro package lists")
             create_distro_packages_list(distro_check_dir)
@@ -247,10 +247,33 @@ def compare_in_distro_packages_list(distro_check_dir, d):
     if not os.path.isdir(distro_check_dir):
         raise Exception("compare_in_distro_packages_list: invalid distro_check_dir passed")
         
+    localdata = bb.data.createCopy(d)
     pkglst_dir = os.path.join(distro_check_dir, "package_lists")
     matching_distros = []
+    pn = bb.data.getVar('PN', d, True)
     recipe_name = bb.data.getVar('PN', d, True)
-    tmp = bb.data.getVar('DISTRO_PN_ALIAS', d, True)
+    bb.note("Checking: %s" % pn)
+
+    if pn.find("-native") != -1:
+        pnstripped = pn.split("-native")
+        bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
+        bb.data.update_data(localdata)
+        recipe_name = pnstripped[0]
+
+    if pn.find("-cross") != -1:
+        pnstripped = pn.split("-cross")
+        bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
+        bb.data.update_data(localdata)
+        recipe_name = pnstripped[0]
+
+    if pn.find("-initial") != -1:
+        pnstripped = pn.split("-initial")
+        bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
+        bb.data.update_data(localdata)
+        recipe_name = pnstripped[0]
+
+    bb.note("Recipe: %s" % recipe_name)
+    tmp = bb.data.getVar('DISTRO_PN_ALIAS', localdata, True)
     distro_pn_aliases = {}
     if tmp:
         list = tmp.split(' ')
@@ -271,6 +294,8 @@ def compare_in_distro_packages_list(distro_check_dir, d):
                 f.close()
                 break
         f.close()
+
+    bb.note("Matching: %s" % matching_distros)
     return matching_distros
 
 def save_distro_check_result(result, datetime, d):
@@ -281,8 +306,8 @@ def save_distro_check_result(result, datetime, d):
         return
     if not os.path.isdir(logdir):
         os.makedirs(logdir)
-    result_file = os.path.join(logdir, "distro_check-" + datetime + ".results")
-    line = pn + " : "
+    result_file = os.path.join(logdir, "distrocheck.csv")
+    line = pn + ", "
     for i in result:
         line = line + i + ", "
     if result: