diff options
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 36 | ||||
-rwxr-xr-x | apt-panopticon.lua | 12 |
2 files changed, 40 insertions, 8 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 |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index d2fa9b9..8566dad 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -745,9 +745,9 @@ local downloadLock = "flock -n results/curl-" | |||
745 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L --max-time " .. options.maxtime.value .. " -z 'results/stamp.old' -v -R " | 745 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -f -L --max-time " .. options.maxtime.value .. " -z 'results/stamp.old' -v -R " |
746 | local downloads = function(host, URL, release, list) | 746 | local downloads = function(host, URL, release, list) |
747 | if nil == URL then URL = "" end | 747 | if nil == URL then URL = "" end |
748 | local lock = "%s-" .. host .. ".lock" | 748 | local lock = "META-" .. host .. ".lock" |
749 | local log = " --stderr results/curl-%s_" .. host .. ".log" | 749 | local log = " --stderr results/curl-META-" .. host .. ".log" |
750 | local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock:format("META") .. " " .. download .. log:format("META") .. " -K results/" .. host .. ".curl" | 750 | local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock .. " " .. download .. log .. " -K results/" .. host .. ".curl" |
751 | if testing("IPv4") and (not testing("IPv6")) then cm = cm .. ' -4' end | 751 | if testing("IPv4") and (not testing("IPv6")) then cm = cm .. ' -4' end |
752 | if (not testing("IPv4")) and testing("IPv6") then cm = cm .. ' -6' end | 752 | if (not testing("IPv4")) and testing("IPv6") then cm = cm .. ' -6' end |
753 | f, e = io.open("results/" .. host .. ".curl", "a+") | 753 | f, e = io.open("results/" .. host .. ".curl", "a+") |
@@ -968,7 +968,8 @@ if 0 < #arg then | |||
968 | if 4 > (totalTimeouts) then | 968 | if 4 > (totalTimeouts) then |
969 | if origin and (options.roundRobin.value ~= pu.host) then | 969 | if origin and (options.roundRobin.value ~= pu.host) then |
970 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end | 970 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end |
971 | os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") | 971 | os.execute( "rm -f results/" .. pu.host .. ".curl; rm results/curl-META-" .. pu.host .. ".lock; " .. |
972 | "mv results/curl-META-" .. pu.host .. ".log results/curl-Release-" .. pu.host .. ".log") | ||
972 | for i, n in pairs(releases) do | 973 | for i, n in pairs(releases) do |
973 | for l, o in pairs(releaseFiles) do | 974 | for l, o in pairs(releaseFiles) do |
974 | if repoExists(i .. o) then | 975 | if repoExists(i .. o) then |
@@ -998,7 +999,8 @@ if 0 < #arg then | |||
998 | 999 | ||
999 | downloads(pu.host, pu.path, "", "") | 1000 | downloads(pu.host, pu.path, "", "") |
1000 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end | 1001 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end |
1001 | os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") | 1002 | os.execute( "rm -f results/" .. pu.host .. ".curl; rm results/curl-META-" .. pu.host .. ".lock; " .. |
1003 | "mv results/curl-META-" .. pu.host .. ".log results/curl-Packages-" .. pu.host .. ".log") | ||
1002 | 1004 | ||
1003 | for i, n in pairs(releases) do | 1005 | for i, n in pairs(releases) do |
1004 | local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r") | 1006 | local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r") |