{ name = "base",
server = "chroot",
files = {
- "chroot/20080916/base.tar.gz",
+ {
+ location = "chroot/20080916/base.tar.gz",
+ sha1 = "adc83b19e793491b1c6ea0fd8b46cd9f32e592fc",
+ },
},
},
{ name = "host-gcc",
server = "chroot",
files = {
- "chroot/20080916/binutils.tar.gz",
- "chroot/20080916/gcc34.tar.gz",
+ {
+ -- server is inherited from the group if not configured here
+ server = "chroot",
+ location = "chroot/20080916/binutils.tar.gz",
+ sha1 = "55b6aaa6f91b7cd6bf7e47dbb7af548ef8bb85e8",
+ },
+ {
+ location = "chroot/20080916/gcc34.tar.gz",
+ sha1 = "7f69da1b33b39f124cc37331711de8e12bbbc758",
+ },
},
},
}
if res.build_config.groups[grp.name] then
for _, f in ipairs(grp.files) do
local flags = { cache = true }
- local rc, re = cache.cache_file(info.cache, grp.server, f, flags)
+ local rc, re = cache.cache_file(info.cache, f.server, f.location,
+ flags)
if not rc then
return false, e:cat(re)
end
- local path, re = cache.file_path(info.cache, grp.server, f, flags)
+ local path, re = cache.file_path(info.cache, f.server, f.location,
+ flags)
if not path then
return false, e:cat(re)
end
e2lib.mkdir(destdir, "-p")
for _,file in pairs(grp.files) do
local cache_flags = {}
- local server = grp.server
- rc, re = cache.fetch_file(info.cache, server, file,
- destdir, nil, cache_flags)
+ rc, re = cache.fetch_file(info.cache, file.server,
+ file.location, destdir, nil, cache_flags)
if not rc then
return false, e:cat(re)
end
+ -- XXX organize for checksum checking when building
+ -- XXX the project out of the collect_project result
end
end
-- project/licences/<licence>/<files>
end
hash.hash_line(hc, lid) -- licence id
end
- local groupid = e2tool.chrootgroupid(info, "base")
+ local groupid, re = e2tool.chrootgroupid(info, "base")
+ if not groupid then
+ return nil, e:cat(re)
+ end
hc:hash_line(groupid)
if r.chroot then
for _,g in ipairs(r.chroot) do
end
function e2tool.chrootgroupid(info, groupname)
+ local e = new_error("calculating chroot group id failed for group %s",
+ groupname)
local g = info.chroot.groups_byname[groupname]
if g.groupid then
return g.groupid
end
local hc = hash.hash_start()
hc:hash_line(g.name)
- hc:hash_line(g.server)
for _,f in ipairs(g.files) do
- hc:hash_line(f)
- -- XXX hash each file?
+ hc:hash_line(f.server)
+ hc:hash_line(f.location)
+ if f.sha1 then
+ hc:hash_line(f.sha1)
+ else
+ local h, re = e2tool.hash_file(info, f.server,
+ f.location)
+ if not h then
+ return false, e:cat(re)
+ end
+ hc:hash_line(h)
+ end
end
e2lib.log(4, string.format("hash data for chroot group %s\n%s",
groupname, hc.data))
e:append("in group: %s", grp.name)
e:append(" list of files is empty")
else
- for _,l in ipairs(grp.files) do
- if type(l) ~= "string" then
- e:append("in group: %s", grp.name)
- e:append(" file list contains non-string element")
- end
+ for _,f in ipairs(grp.files) do
+ local inherit = {
+ server = grp.server,
+ }
+ local keys = {
+ server = {
+ mandatory = true,
+ type = "string",
+ inherit = true,
+ },
+ location = {
+ mandatory = true,
+ type = "string",
+ inherit = false,
+ },
+ sha1 = {
+ mandatory = false,
+ type = "string",
+ inherit = false,
+ },
+ }
+ local rc, re = check_tab(f, keys, inherit)
+ if not rc then
+ e:append("in group: %s", grp.name)
+ e:cat(re)
+ end
+ if f.server ~= info.root_server_name and not f.sha1 then
+ e:append("in group: %s", grp.name)
+ e:append("file entry for remote file without `sha1` attribute")
+ end
end
end
end
s2 = " "
end
p2(s1, s2, grp.name, grp.name)
- p3(s1, s2, "server", grp.server)
- p3t(s1, s2, "files", grp.files)
+ for _,f in ipairs(grp.files) do
+ p3(s1, s2, "file", string.format("%s:%s", f.server, f.location))
+ end
if grp.groupid then
p3(s1, s2, "groupid", grp.groupid)
end