aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon-report-email-web.lua
diff options
context:
space:
mode:
authoronefang2019-12-03 06:27:15 +1000
committeronefang2019-12-03 06:27:15 +1000
commitfb617ad2e22c3c7ad705cb6748da57b5417985b2 (patch)
tree52c0cd25416ad4931c8e31747b66bac02a5f0cb2 /apt-panopticon-report-email-web.lua
parentDon't leave those massive unpacked Packages files around. (diff)
downloadapt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.zip
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.gz
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.bz2
apt-panopticon-fb617ad2e22c3c7ad705cb6748da57b5417985b2.tar.xz
Test and report speed.
Diffstat (limited to 'apt-panopticon-report-email-web.lua')
-rwxr-xr-xapt-panopticon-report-email-web.lua36
1 files changed, 33 insertions, 3 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index fc1f345..131c803 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -75,6 +75,11 @@ dumpTableHTMLSub = function (table, space)
75 return r 75 return r
76end 76end
77 77
78local checkFile = function(f)
79 local h, e = io.open(f, "r")
80 if nil == h then return false else h:close(); return true end
81end
82
78local plurals = function(e, w) 83local plurals = function(e, w)
79 local result = "" 84 local result = ""
80 if 1 == e then 85 if 1 == e then
@@ -393,7 +398,7 @@ if nil == web then C("opening mirrors file - " .. e) else
393 "<a href='https://pkgmaster.devuan.org/mirror_list.txt'>https://pkgmaster.devuan.org/mirror_list.txt</a></p>\n" .. 398 "<a href='https://pkgmaster.devuan.org/mirror_list.txt'>https://pkgmaster.devuan.org/mirror_list.txt</a></p>\n" ..
394 "<p>Due to the nature of the tests, some errors or warnings will be counted several times. &nbsp; " .. 399 "<p>Due to the nature of the tests, some errors or warnings will be counted several times. &nbsp; " ..
395 "The links in the table and DNS list go to the detailed testing logs.</p>\n\n" .. 400 "The links in the table and DNS list go to the detailed testing logs.</p>\n\n" ..
396 "<hr>\n<h2>==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====</h2>\n<table>\n" .. 401 "<hr>\n<h2>==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====</h2>\n" ..
397 402
398 "<p>[<font color='red'><b>FAILED</b></font>] or [<font color='lime'><b>OK</b></font>]" .. 403 "<p>[<font color='red'><b>FAILED</b></font>] or [<font color='lime'><b>OK</b></font>]" ..
399 " means the tested thing is supported for that mirror.</p>\n" .. 404 " means the tested thing is supported for that mirror.</p>\n" ..
@@ -407,7 +412,8 @@ if nil == web then C("opening mirrors file - " .. e) else
407 "<p>The time in the Updated column is how often the mirror updates itself.</p>" .. 412 "<p>The time in the Updated column is how often the mirror updates itself.</p>" ..
408 "<p>Mirrors with a <font style='background-color:dimgrey'>grey background</font> are not active (though may be usable as part of the DNS-RR).</p>\n" .. 413 "<p>Mirrors with a <font style='background-color:dimgrey'>grey background</font> are not active (though may be usable as part of the DNS-RR).</p>\n" ..
409 "<p>[<font color='grey'><b>skip</b></font>] means that the test hasn't been written yet.</p>\n" .. 414 "<p>[<font color='grey'><b>skip</b></font>] means that the test hasn't been written yet.</p>\n" ..
410 "<tr><th></th><th>FTP</th><th>HTTP</th><th>HTTPS</th><th>RSYNC</th><th>DNS round robin</th><th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th></tr>\n" 415 "<table>\n<tr><th></th><th>FTP</th><th>HTTP</th><th>HTTPS</th><th>RSYNC</th><th>DNS round robin</th>" ..
416 "<th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th><th colspan='2'>Speed</th></tr>\n"
411 ) 417 )
412 for k, v in orderedPairs(mirrors) do 418 for k, v in orderedPairs(mirrors) do
413 local results = loadfile("results/" .. k .. ".lua")() 419 local results = loadfile("results/" .. k .. ".lua")()
@@ -439,6 +445,7 @@ if nil == web then C("opening mirrors file - " .. e) else
439 local updated = status(k, results, "Updated") 445 local updated = status(k, results, "Updated")
440 local rate = v.Rate 446 local rate = v.Rate
441 if nil ~= rate then updated = updated .. ' ' .. rate end 447 if nil ~= rate then updated = updated .. ' ' .. rate end
448 local min, max, spd = 999999999999, 0, ''
442 449
443 -- DNS-RR test. 450 -- DNS-RR test.
444 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then 451 if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then
@@ -470,11 +477,34 @@ if nil == web then C("opening mirrors file - " .. e) else
470 end 477 end
471 end 478 end
472 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end 479 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end
480
481 for i, mt in pairs({'Release', 'Packages', 'META'}) do
482 if checkFile("results/curl-" .. mt .. "-" .. k .. ".log") then
483 for l in io.lines("results/curl-" .. mt .. "-" .. k .. ".log") do
484 local speed, crrnt = l:match('^%c *%d+ +%d+k? +%d+ +%d+k? +%d+ +%d+ +(%d+k?) +%d+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +[%d%-]+:[%d%-]+:[%d%-]+ +(%d+k?)')
485 if nil ~= speed then
486 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end
487 if 'k' == crrnt:sub(-1, -1) then crrnt = crrnt:sub(1, -2) .. '000' end
488 speed = tonumber(speed)
489 crrnt = tonumber(crrnt)
490 if speed < min and speed ~= 0 then min = speed end
491 if speed > max then max = speed end
492 if crrnt < min and crrnt ~= 0 then min = crrnt end
493 if crrnt > max then max = crrnt end
494 end
495 end
496 end
497 end
498 if 0 == max then
499 spd = '<td></td><td></td>'
500 else
501 spd = string.format('<td align="right">%d -></td><td align="right">%d</td>', min, max)
502 end
473 end 503 end
474 504
475 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns .. 505 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns ..
476 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity .. 506 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity ..
477 "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. "</td></tr>\n") 507 "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. "&nbsp;</td>" .. spd .. "</tr>\n")
478 if "" ~= v.Active then 508 if "" ~= v.Active then
479 web:write("<tr><td style='background-color:dimgrey'>" .. active .. "</td></tr>\n") 509 web:write("<tr><td style='background-color:dimgrey'>" .. active .. "</td></tr>\n")
480 end 510 end