end
--- project id.
+-- @return Project ID or false on error.
+-- @return Error object on failure
local function projid(info)
if info.projid then
return info.projid
}
local fileid, e = e2tool.fileid(info, f)
if not fileid then
- e2lib.abort(e)
+ return false, e
end
hc:hash_line(location) -- the filename
hc:hash_line(fileid) -- the file content
return e2tool.env_by_result(info, resultname):id()
end
---- get the pbuildid for a result, calculating it if required
--- XXX this function always succeeds or aborts
+--- Get the pbuildid for a result, calculating it if required.
-- @param info
-- @param resultname
--- @return the buildid
+-- @return Build ID or false on error.
+-- @return Error object on failure.
function e2tool.pbuildid(info, resultname)
local e = err.new("error calculating result id for result: %s",
- resultname)
+ resultname)
local r = info.results[resultname]
if r.pbuildid then
return r.build_mode.buildid(r.pbuildid)
local rc, re, sourceid =
scm.sourceid(info, s, source_set)
if not rc then
- return nil, e:cat(re)
+ return false, e:cat(re)
end
hash.hash_line(hc, s) -- source name
hash.hash_line(hc, sourceid) -- sourceid
-- them via results/sources. Include them explicitly here.
local lid, re = e2tool.licenceid(info, l)
if not lid then
- return nil, e:cat(re)
+ return false, e:cat(re)
end
hash.hash_line(hc, lid) -- licence id
end
}
local fileid, re = e2tool.fileid(info, f)
if not fileid then
- return nil, e:cat(re)
+ return false, e:cat(re)
end
hc:hash_line(fileid) -- build script hash
end
-- nil -> error
-- false -> don't modify the hash
if hash == nil then
- e2lib.abort(e:cat(re))
+ return false, e:cat(re)
elseif hash ~= false then
hc:hash_line(hash)
end
e2lib.logf(4, "hash data for resultid %s\n%s", resultname, hc.data)
r.resultid = hash.hash_finish(hc) -- result id (without deps)
+ local projid, re = projid(info)
+ if not projid then
+ return false, e:cat(re)
+ end
hc = hash.hash_start()
- local projid = projid(info)
hc:hash_line(projid) -- project id
hash.hash_line(hc, r.resultid) -- result id
for _,d in ipairs(r.depends) do
local id, re = e2tool.pbuildid(info, d)
if not id then
- e2lib.abort(re)
+ return false, re
end
hash.hash_line(hc, id) -- buildid of dependency
end
-- pbuildids of collected results
local pbid, re = e2tool.pbuildid(info, c)
if not pbid then
- e2lib.abort(re)
+ return false, re
end
hash.hash_line(hc, pbid)
end
-- nil -> error
-- false -> don't modify the hash
if hash == nil then
- e2lib.abort(e:cat(re))
+ return false, e:cat(re)
elseif hash ~= false then
hc:hash_line(hash)
end