Commit 86d4f63f authored by Jan-Tarek Butt's avatar Jan-Tarek Butt

firmware-bot: integrate auto generated html site

parent e6743942
......@@ -29,7 +29,7 @@ if io.open(PID_PART, "r") ~=nil then
io.stderr:write("The firmware-bot is still running.\n")
os.exit(1)
else
-- io.close(io.open(PID_PART, "w"))
io.close(io.open(PID_PART, "w"))
end
local function clean_pid(exit_code)
......@@ -160,7 +160,7 @@ local function get_ecdsa_pubkeys(site_conf)
end
--ret = { index , table }
--table = { name , version }
--table = { version , version }
-- { branch, prefix }
-- { sgigned, Num }
-- { persons, table1 }
......@@ -173,7 +173,7 @@ local function check_manifest_signature(signscript, pub_keys, firmware_dir)
local version = {}
-- Get firmware version
for v in string.gmatch(dir, "([^%%/]+)") do
version["name"] = v
version["version"] = v
end
-- get manifest branch
for man in io.popen(string.format("find %s -type f | grep .manifest", dir), "r"):lines() do
......@@ -201,6 +201,56 @@ local function check_manifest_signature(signscript, pub_keys, firmware_dir)
return ret
end
--Generating HTML site
local function genertate_html(content, dir)
local html_table = "<table style=\"width:100%%\" border=\"1\">\n"
local control = {}
control["version"] = nil
control["branch"] = nil
control["sgigned"] = nil
control["persons"] = nil
-- Get table header
for i,t in pairs(content) do
for k,v in pairs(t) do
if k:match("version") and control["version"] == nil then
control["version"] = "\t\t<th>"..k.."</th>\n"
end
if k:match("branch") and control["branch"] == nil then
control["branch"] = "\t\t<th>"..k.."</th>\n"
end
if k:match("sgigned") and control["sgigned"] == nil then
control["sgigned"] = "\t\t<th>"..k.."</th>\n"
end
if k:match("persons") and control["persons"] == nil then
control["persons"] = "\t\t<th>"..k.."</th>\n"
end
end
end
html_table = html_table.."\t<tr>\n"..control["branch"]..control["version"]..control["sgigned"]..control["persons"].."\t</tr>\n"
-- fill kontent
for i,t in pairs(content) do
local content = {}
content["version"] = "\t\t<td>"..t["version"].."</td>\n"
content["branch"] = "\t\t<td>"..t["branch"].."</td>\n"
content["sgigned"] = "\t\t<td>"..t["sgigned"].."</td>\n"
content["persons"] = "\t\t<td>"
for k,v in pairs(t["persons"]) do
content["persons"] = content["persons"]..v.."\n"
end
content["persons"] = content["persons"].."</td>\n"
html_table = html_table.."\t<tr>\n"..content["branch"]..content["version"]..content["sgigned"]..content["persons"].."\t</tr>\n"
end
html_table = html_table.."</table>"
-- Prepare hpml file and write it
local f = io.open("firmware.html", "r")
local content = f:read("*all")
f:close()
content = string.gsub(content, "|A|",html_table)
local f = io.open(dir.."/status.html", "w")
f:write(content)
f:close()
os.execute("cp default.css "..dir.."/default.css")
end
-- check if all md5, sha1 and sha2 checksum files exsist and generate them
generate_checksum(FIRMWARE_DIR)
......@@ -212,7 +262,7 @@ check_manifest_symlink(FIRMWARE_DIR)
checkout_git("/tmp/", "gluon", GLUON_GIT, GLUON_BRANCH)
-- checkout siteconf git
--checkout_git("/tmp", "siteconf", SITECONF_GIT, "master")
checkout_git("/tmp", "siteconf", SITECONF_GIT, "master")
-- get ecdsa keys
local pub_keys = get_ecdsa_pubkeys(SITE_CONF)
......@@ -223,24 +273,9 @@ if next(pub_keys) then
tab = check_manifest_signature(GLUON_SIGNTEST, pub_keys, FIRMWARE_DIR)
end
if next(tab) then
for i, t in pairs(tab) do
for k, v in pairs(t) do
if not k:match("persons") then
io.stderr:write(k.."\t"..v.."\n")
else
for i,p in pairs(v) do
io.stderr:write(" "..p.."\n")
end
end
end
end
genertate_html(tab,FIRMWARE_DIR)
else
io.stderr:write("got nil entry\n")
end
clean_pid(0)
-- signatur checker
-- symlink creator
-- static html generate
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment