NEXT:
+ * Unbreak --wc-mode and allow specifying multiple results, including
+ intermediary dependencies. Beware this changes wc-mode buildid from "scratch"
+ to "scratch-<buildid>".
* Include revision ID in SVN sourceid calculation, fixing various issue with
moving tags and branch mode. Also fix licenceid calculation for svn sources.
* Fix error message for unknown chroot tarball extension.
local server, location = res.build_mode.storage(info.project_location,
info.release_id)
local location1 = string.format("%s/%s/%s", location, r,
- res.build_mode.buildid(res.buildid))
+ e2tool.buildid(info, r))
local cache_flags = {
check_only = true
}
e2lib.log(4, string.format("result_available(%s)", tostring(r)))
local res = info.results[r]
local mode = res.build_mode
- local buildid = res.build_mode.buildid(e2tool.buildid(info, r))
+ local buildid = e2tool.buildid(info, r)
local sbid = e2tool.bid_display(buildid)
local rc, re
local e = err.new("error while checking if result is available: %s", r)
local d = info.results[dep]
local buildid = e2tool.buildid(info, dep)
- local dep_set = res.build_mode.dep_set(buildid)
- local server, location = res.build_mode.storage(info.project_location,
+ local dep_set = d.build_mode.dep_set(buildid)
+ local server, location = d.build_mode.storage(info.project_location,
info.release_id)
e2lib.log(3, string.format("searching for dependency %s in %s:%s",
dep, server, location))
end
local server, location = res.build_mode.storage(info.project_location,
info.release_id)
- local buildid = res.build_mode.buildid(e2tool.buildid(info, r))
+ local buildid = e2tool.buildid(info, r)
local sourcefile = string.format("%s/result.tar", tmpdir)
local location1 = string.format("%s/%s/%s/result.tar", location, r, buildid)
local cache_flags = {
local err = require("err")
local e2option = require("e2option")
local strict = require("strict")
+local hash = require("hash")
--- source_set_* get the source set identifier
-- @class function
return buildid
end
+local buildid_scratch_cache = {}
+
local function buildid_scratch(buildid)
- return "scratch"
+ --- XXX: Always returning a fixed buildid string does not work when
+ -- the scratch results gets used by results not in scratch mode.
+ -- eg. if we have a result graph like this: root->tag->wc-mode->tag
+ -- the final tag would only be built once and then cached globally.
+ --
+ -- Ideally we would use the hash of the wc-mode result.tar (and making sure
+ -- that its checksum is stable), but getting it requires some bigger
+ -- changes that are currently not possible.
+ --
+ -- Next best thing is to generate a random buildid. However, since
+ -- buildid_scratch() is called multiple times, we need to cache the result
+ -- to make the new buildid stable.
+
+ -- calculate buildid only once to make stable.
+ if buildid_scratch_cache[buildid] then
+ return buildid_scratch_cache[buildid]
+ end
+
+ local rfile, msg, rstr
+ local hc, newbuildid
+
+ rfile, msg = io.open("/dev/urandom")
+ if not rfile then
+ e2lib.abort(msg)
+ end
+
+ rstr = rfile:read(16)
+ if not rstr or string.len(rstr) ~= 16 then
+ e2lib.abort("could not get 16 bytes of entrophy")
+ end
+
+ rfile:close()
+
+ hc = hash.hash_start()
+ hash.hash_append(hc, buildid)
+ hash.hash_append(hc, rstr)
+
+ newbuildid = hash.hash_finish(hc)
+ newbuildid = "scratch-" .. newbuildid
+ buildid_scratch_cache[buildid] = newbuildid
+
+ return buildid_scratch_cache[buildid]
end
function policy.init(info)