]> git.e2factory.org Git - e2factory.git/commitdiff
add buildid logging to help with debugging
authorTobias Ulmer <tu@emlix.com>
Wed, 25 Apr 2018 13:05:42 +0000 (15:05 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 25 Apr 2018 13:06:02 +0000 (15:06 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
15 files changed:
local/chroot.lua
local/cscache.lua
local/e2tool.lua
local/environment.lua
local/licence.lua
local/policy.lua
local/project.lua
local/result.lua
plugins/collect_project.lua
plugins/cvs.lua
plugins/files.lua
plugins/git.lua
plugins/gitrepo.lua
plugins/licencesrc.lua
plugins/svn.lua

index d1ae964507c2a2617ecf71ece1c26b654428b94e..1084374727ecb7f3a29e6b5840914215ee3af976 100644 (file)
@@ -135,6 +135,8 @@ function chroot.chroot:chrootgroupid()
     end
 
     self._chrootgroupid = hash.hash_finish(hc)
+    e2lib.logf(4, "BUILDID: name=%q chrootgroupid=%s",
+        self._name, self._chrootgroupid)
     return self._chrootgroupid
 end
 --- @section end
index 95e3407bd440f81e04a4658ce1f84436f253b49f..301ed05d6fee02e003411c5692a247d6db28fd58 100644 (file)
@@ -96,6 +96,12 @@ function cs_cache_class:lookup(filename, digest_type)
 
     hce.use = os.time()
 
+    if not hce.logged then
+        e2lib.logf(4, "BUILDID: file %q cached SHA1=%s SHA256=%s", filename,
+            tostring(hce.sha1), tostring(hce.sha256))
+        hce.logged = true
+    end
+
     return cs
 end
 
@@ -131,6 +137,9 @@ function cs_cache_class:insert(filename, checksum, digest_type)
         sha256 = checksum
     end
 
+    e2lib.logf(4, "BUILDID: file %q SHA1=%s SHA256=%s", filename,
+        tostring(sha1), tostring(sha256))
+
     if not e2lib.exists(filename, false) then
         return
     end
@@ -153,6 +162,7 @@ function cs_cache_class:insert(filename, checksum, digest_type)
         dev = sb.dev,
         ino = sb.ino,
         use = 0,
+        logged = true, -- limit buildid logging to once per file
     }
 end
 
index 9cd587c683e12ee152c747f916ef36da855eda38..fda1dcb14446d62b5b05acd7601ac9f0fe5e3878 100644 (file)
@@ -333,7 +333,7 @@ end
 -- @return FileID string: hash value, or false on error.
 -- @return an error object on failure
 function e2tool.file_class:fileid()
-    local rc, re, e, hc, cs
+    local rc, re, e, hc, cs, fid
     local cs_done = false
 
     e = err.new("error calculating file id for file: %s", self:servloc())
@@ -397,7 +397,9 @@ function e2tool.file_class:fileid()
         hash.hash_append(hc, self._copy)
     end
 
-    return hash.hash_finish(hc)
+    fid = hash.hash_finish(hc)
+    e2lib.logf(4, "BUILDID: %s fileid=%s", self:servloc(), fid)
+    return fid
 end
 
 --- Verify file addressed by server name and location matches configured
index f23b634f1c9e732dba131153cd1bdf90658bf9b5..f321f7d23599b98c0aa065c2e156e56523e220e2 100644 (file)
@@ -25,12 +25,18 @@ local err = require("err")
 local hash = require("hash")
 local strict = require("strict")
 
+-- Sequential ID for debugging.
+-- Keeps track of various env tables between runs.
+local environment_seqid = 1
+
 --- create new environment
 -- @return environment
 function environment.new()
     local env = {}
     local meta = { __index = environment }
     setmetatable(env, meta)
+    env.seqid = environment_seqid
+    environment_seqid = environment_seqid + 1
     env.dict = {}
     env.sorted = {}
     return env
@@ -57,11 +63,14 @@ end
 function environment.envid(env)
     assertIsTable(env)
     assertIsTable(env.sorted)
+    local eid
     local hc = hash.hash_start()
     for var, val in env:iter() do
         hash.hash_append(hc, var..val)
     end
-    return hash.hash_finish(hc)
+    eid = hash.hash_finish(hc)
+    e2lib.logf(4, "BUILDID: seqid=%d envid=%s", env.seqid, eid)
+    return eid
 end
 
 --- merge environment from merge into env.
index 53fc01b2d8bf6f5258fd6b47ecc2f97fb0857dbe..8c3224fb4f0447eaa216dd6fec441c7fb5da6f05 100644 (file)
@@ -110,6 +110,8 @@ function licence.licence:licenceid()
         return false, e:cat(re)
     end
 
+    e2lib.logf(4, "BUILDID: name=%s licenceid=%s", self._name, self._licenceid)
+
     return self._licenceid
 end
 --- @section end
index e61a6a649e474b98ac078ba6d64bdd19e4996497..6ff17bea626becfe4f5ad65379bd7f8b864216c5 100644 (file)
@@ -138,6 +138,8 @@ local function buildid_scratch(buildid)
     newbuildid = "scratch-" .. newbuildid
     buildid_scratch_cache[buildid] = newbuildid
 
+    e2lib.logf(4, "BUILDID: buildid=%s buildid_scratch=%s", buildid, newbuildid)
+
     return buildid_scratch_cache[buildid]
 end
 
index 4dfb1af9d2d18fc5525f732070c34f5bc4ccfb0e..bb134389ec2fe997a1a5e0dbdccf90f54d1dd1d6 100644 (file)
@@ -355,6 +355,7 @@ function project.projid()
     end
 
     _projid_cache = hash.hash_finish(hc)
+    e2lib.logf(4, "BUILDID: projid=%s", _projid_cache)
 
     return _projid_cache
 end
index d0ee4450b54a968b94e7b74ea01642694e60fa0c..d0822110a5d056e35b91c23d4d7f5ec165e07df1 100644 (file)
@@ -531,6 +531,8 @@ function result.result_class:buildid()
 
     self._buildid = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: result=%s buildid=%s", self._name, self._buildid)
+
     return build_mode.buildid(self._buildid)
 end
 
index 74cfe93fa5228a4bbc22dd94726ed608c7cad48d..aa51e77eb7d511a4a793a8837cdd14f2101759ee 100644 (file)
@@ -488,6 +488,8 @@ function collect_project_class:buildid()
 
     assertIsStringN(bid)
 
+    e2lib.logf(4, "BUILDID: cp result=%s buildid=%s", self._name, bid)
+
     return bid
 end
 
index 0157ce14135de9658ccc4fa64cf5618482793913..91b3ea743bf686260f86efb226ad67dc15066589 100644 (file)
@@ -260,6 +260,9 @@ function cvs.cvs_source:sourceid(sourceset)
 
     self._sourceids[sourceset] = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: source=%s sourceset=%s sourceid=%s",
+        self._name, sourceset, self._sourceids[sourceset])
+
     return self._sourceids[sourceset]
 end
 
index e30c488374510fa70bbb1b9ece04a527b7d2e0f3..19e419d4ff77db03f953f8a9fb239937a9bed144 100644 (file)
@@ -381,6 +381,8 @@ function files.files_source:sourceid(sourceset)
 
     self._sourceid = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: source=%s sourceid=%s", self._name, self._sourceid)
+
     return self._sourceid
 end
 
index 6cba144551f25882c14614ea1712461196b58899..b13f684908bebf437c64163e2268b41d10bd4237 100644 (file)
@@ -245,6 +245,9 @@ function git.git_source:sourceid(sourceset)
     self._commitids[sourceset] = id
     self._sourceids[sourceset] = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: source=%s sourceset=%s sourceid=%s",
+        self._name, sourceset, self._sourceids[sourceset])
+
     return self._sourceids[sourceset]
 end
 
index bc3eb0dae3a5e6a79567cf7c8ca940050a1bffaa..2e17755133f0df4c50e80dca97599d27f6f38d5e 100644 (file)
@@ -193,6 +193,10 @@ function gitrepo_source:sourceid(sourceset)
     hash.hash_append(hc, out)
 
     self._sourceids[sourceset] = hash.hash_finish(hc)
+
+    e2lib.logf(4, "BUILDID: source=%s sourceset=%s sourceid=%s",
+        self._name, sourceset, self._sourceids[sourceset])
+
     return self._sourceids[sourceset]
 end
 
index 30cd3d5637735b585e6815e724124d9c11961c3c..6734bddbeb1e1f7c89466b6731f7502059b94d45 100644 (file)
@@ -175,6 +175,8 @@ function licence_source:sourceid(sourceset)
 
     self._sourceid = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: source=%s sourceid=%s", self._name, self._sourceid)
+
     return self._sourceid
 end
 
index 92475ba6920c321a63b1c1fa2ba25abd6c3d8ce4..94c739c876a501b970aa7287db027649e18c33a7 100644 (file)
@@ -306,6 +306,9 @@ function svn.svn_source:sourceid(sourceset)
 
     self._sourceids[sourceset] = hash.hash_finish(hc)
 
+    e2lib.logf(4, "BUILDID: source=%s sourceset=%s sourceid=%s",
+        self._name, sourceset, self._sourceids[sourceset])
+
     return self._sourceids[sourceset]
 end