diff options
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 36 |
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 |
76 | end | 76 | end |
77 | 77 | ||
78 | local checkFile = function(f) | ||
79 | local h, e = io.open(f, "r") | ||
80 | if nil == h then return false else h:close(); return true end | ||
81 | end | ||
82 | |||
78 | local plurals = function(e, w) | 83 | local 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. " .. | 399 | "<p>Due to the nature of the tests, some errors or warnings will be counted several times. " .. |
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 .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. | 505 | web:write("<td>" .. ftp .. " </td><td>" .. http .. " </td><td>" .. https .. " </td><td>" .. rsync .. " </td><td>" .. dns .. |
476 | " </td><td>" .. protocol .. " </td><td>" .. sanity .. | 506 | " </td><td>" .. protocol .. " </td><td>" .. sanity .. |
477 | " </td><td>" .. integrity .. " </td><td>" .. updated .. "</td></tr>\n") | 507 | " </td><td>" .. integrity .. " </td><td>" .. updated .. " </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 |