aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--apt-panopticommon.lua13
-rwxr-xr-xapt-panopticon.lua39
2 files changed, 29 insertions, 23 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index 54e2be1..ea6346e 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -317,13 +317,14 @@ APT.html = false
317 317
318APT.logName = function(host, a2, a3) 318APT.logName = function(host, a2, a3)
319 local name = host 319 local name = host
320 if nil ~= a2 then name = name .. "_" .. a2 end 320 if (nil ~= a2) and ('' ~= a2) then name = name .. "_" .. a2 end
321 if nil ~= a3 then name = name .. "_" .. a3 end 321 if (nil ~= a3) and ('' ~= a3) then name = name .. "_" .. a3 end
322 return 'results/LOG_' .. name .. '.html' 322 name = 'LOG_' .. name .. '.html'
323 return {'results/' .. name, '<a href="' .. name:gsub("/", "_") .. '">' .. name:gsub("/", "_") .. '</a>'}
323end 324end
324 325
325APT.logOpen = function(host, a2, a3) 326APT.logOpen = function(host, a2, a3)
326 local name = APT.logName(host, a2, a3) 327 local name = APT.logName(host, a2, a3)[1]
327 if APT.checkFile(name) then return false end 328 if APT.checkFile(name) then return false end
328 APT.logFile, e = io.open(name, "a+") 329 APT.logFile, e = io.open(name, "a+")
329 if nil == APT.logFile then C('opening log file (' .. name .. ') - ' .. e); return false end 330 if nil == APT.logFile then C('opening log file (' .. name .. ') - ' .. e); return false end
@@ -422,7 +423,7 @@ APT.testing = function(t, host)
422end 423end
423 424
424APT.execute = function (s) 425APT.execute = function (s)
425 D(" executing <pre><code>" .. s .. "</code></pre>") 426 D(" executing - &nbsp; <code>" .. s .. "</code>")
426 --[[ Damn os.execute() 427 --[[ Damn os.execute()
427 Lua 5.1 says it returns "a status code, which is system-dependent" 428 Lua 5.1 says it returns "a status code, which is system-dependent"
428 Lua 5.2 says it returns true/nil, "exit"/"signal", the status code. 429 Lua 5.2 says it returns true/nil, "exit"/"signal", the status code.
@@ -441,7 +442,7 @@ APT.execute = function (s)
441end 442end
442 443
443APT.fork = function(s) 444APT.fork = function(s)
444 D(" forking <pre><code>" .. s .. "</code></pre>") 445 D(" forking - &nbsp; <code>" .. s .. "</code>")
445 os.execute(s .. " &") 446 os.execute(s .. " &")
446end 447end
447 448
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 649346a..13adead 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -377,7 +377,8 @@ checkHEAD = function (host, URL, r, retry, sanity)
377 if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end 377 if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end
378 if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end 378 if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end
379 I(" Now checking redirected host " .. u) 379 I(" Now checking redirected host " .. u)
380 APT.fork("ionice -c3 nice -n 19 " .. downloadLock .. "REDIR-" .. check .. ".log" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file) 380 APT.fork("ionice -c3 nice -n 19 " .. downloadLock .. "REDIR-" .. check .. ".log.txt" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file)
381 D('logging to ' .. APT.logName(pu.host, nil, file)[2])
381 end 382 end
382 end 383 end
383 end 384 end
@@ -451,6 +452,7 @@ checkHost = function (orig, host, path, ip, file)
451 if orig == host then 452 if orig == host then
452 D("checkHost " .. orig .. "" .. file) 453 D("checkHost " .. orig .. "" .. file)
453 APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " -o " .. orig .. path .. " " .. file) 454 APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " -o " .. orig .. path .. " " .. file)
455 D('logging to ' .. APT.logName(ph.host, nil, file)[2])
454 else D("checkHost " .. orig .. " -> " .. host) end 456 else D("checkHost " .. orig .. " -> " .. host) end
455 end 457 end
456end 458end
@@ -495,15 +497,16 @@ local download = "curl" ..
495 " --fail-early" .. 497 " --fail-early" ..
496 " --max-time " .. APT.options.maxtime.value .. 498 " --max-time " .. APT.options.maxtime.value ..
497 " --retry " .. APT.options.retries.value .. 499 " --retry " .. APT.options.retries.value ..
498 " -R -v -z 'results/stamp.old' " 500 " -R -v -z 'results/stamp.old' --stderr results/"
499local downloads = function(host, URL, meta, release, list) 501local downloads = function(host, URL, meta, release, list)
500 if nil == URL then URL = "" end 502 if nil == URL then URL = "" end
501 local lock = meta .. "-" .. host .. ".log" 503 local files = 'curl-' .. meta .. '-' .. host .. '.files.txt'
502 local log = " --stderr results/curl-" .. meta .. "-" .. host .. ".log" 504 local lock = meta .. "-" .. host .. ".log.txt"
503 local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock .. " " .. download .. log .. " -K results/curl-" .. meta .. '-' .. host .. ".files" 505 local log = "curl-" .. meta .. "-" .. host .. ".log.txt"
506 local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock .. " " .. download .. log .. " -K results/" .. files
504 if APT.testing("IPv4") and (not APT.testing("IPv6")) then cm = cm .. ' -4' end 507 if APT.testing("IPv4") and (not APT.testing("IPv6")) then cm = cm .. ' -4' end
505 if (not APT.testing("IPv4")) and APT.testing("IPv6") then cm = cm .. ' -6' end 508 if (not APT.testing("IPv4")) and APT.testing("IPv6") then cm = cm .. ' -6' end
506 f, e = io.open("results/curl-" .. meta .. '-' .. host .. ".files", "a+") 509 f, e = io.open("results/curl-" .. meta .. '-' .. host .. ".files.txt", "a+")
507 if nil == f then C("opening curl downloads list file - " .. e); return end 510 if nil == f then C("opening curl downloads list file - " .. e); return end
508 511
509 if nil ~= list then 512 if nil ~= list then
@@ -531,6 +534,7 @@ local downloads = function(host, URL, meta, release, list)
531 end 534 end
532 f:close() 535 f:close()
533 APT.fork(cm) 536 APT.fork(cm)
537 D('logging to <a href="' .. log .. '">' .. log .. '</a>, with <a href="' .. files .. '">these files</a>')
534end 538end
535 539
536 540
@@ -847,16 +851,16 @@ drwxr-x--- 2 www-data www-data 4096 2019-12-23 01:02:57.000000000 +1000 aptly
847 851
848]] 852]]
849os.execute('sleep 1') -- Wait for things to start up before checking for them. 853os.execute('sleep 1') -- Wait for things to start up before checking for them.
850 while 0 < APT.checkExes(downloadLock .. list.out .. "-" .. host .. ".log") do 854 while 0 < APT.checkExes(downloadLock .. list.out .. "-" .. host .. ".log.txt") do
851 D('*&lt;* About to yield coroutine while waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log') 855 D('*&lt;* About to yield coroutine while waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log.txt')
852 coroutine.yield() 856 coroutine.yield()
853 D('*&gt;* Resumed coroutine while waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log') 857 D('*&gt;* Resumed coroutine while waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log.txt')
854 end 858 end
855 D('*&gt;* Resumed coroutine NO LONGER waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log') 859 D('*&gt;* Resumed coroutine NO LONGER waiting on - 0 < APT.checkExes(' .. downloadLock .. list.out .. '-' .. host .. '.log.txt')
856 860
857 local min, max, spd = 999999999999, 0 861 local min, max, spd = 999999999999, 0
858 if APT.checkFile("results/curl-" .. list.out .. "-" .. host .. ".log") then 862 if APT.checkFile("results/curl-" .. list.out .. "-" .. host .. ".log.txt") then
859 for l in io.lines("results/curl-" .. list.out .. "-" .. host .. ".log") do 863 for l in io.lines("results/curl-" .. list.out .. "-" .. host .. ".log.txt") do
860 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?)') 864 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?)')
861 if nil ~= speed then 865 if nil ~= speed then
862 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end 866 if 'k' == speed:sub(-1, -1) then speed = speed:sub(1, -2) .. '000' end
@@ -869,7 +873,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them.
869 if crrnt > max then max = crrnt end 873 if crrnt > max then max = crrnt end
870 end 874 end
871 if l:find('timed out') ~= nil then 875 if l:find('timed out') ~= nil then
872 E(" TIMEOUT " .. timeouts + 1 .. ', details in curl-' .. list.out .. '-' .. host .. '.log', 'http', '', host) 876 E(" TIMEOUT " .. timeouts + 1 .. ', details in <a href="curl-' .. list.out .. '-' .. host .. '.log.txt">curl-' .. list.out .. '-' .. host .. '.log.txt</a>', 'http', '', host)
873 timeouts = timeouts + 1 877 timeouts = timeouts + 1
874 APT.results["timeout"] = true 878 APT.results["timeout"] = true
875 end 879 end
@@ -943,6 +947,7 @@ if 0 < #arg then
943 elseif v1 == "AAAA" then 947 elseif v1 == "AAAA" then
944 if APT.testing("IPv6") then APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k1 .. " " .. file) end 948 if APT.testing("IPv6") then APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k1 .. " " .. file) end
945 end 949 end
950 D('logging to ' .. APT.logName(pu.host, k1, file)[2])
946 end 951 end
947 else 952 else
948 if v == "A" then 953 if v == "A" then
@@ -950,6 +955,7 @@ if 0 < #arg then
950 elseif v == "AAAA" then 955 elseif v == "AAAA" then
951 if APT.testing("IPv6") then APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file) end 956 if APT.testing("IPv6") then APT.fork("ionice -c3 ./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file) end
952 end 957 end
958 D('logging to ' .. APT.logName(pu.host, k, file)[2])
953 end 959 end
954 end 960 end
955 end 961 end
@@ -990,9 +996,9 @@ if 0 < #arg then
990 996
991 if APT.origin and APT.options.referenceSite.value ~= pu.host then 997 if APT.origin and APT.options.referenceSite.value ~= pu.host then
992os.execute('sleep 1') -- Wait for things to start up before checking for them. 998os.execute('sleep 1') -- Wait for things to start up before checking for them.
993 while 0 < APT.checkExes(downloadLock .. "Release-" .. pu.host .. ".log") do os.execute("sleep 10") end 999 while 0 < APT.checkExes(downloadLock .. "Release-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end
994 while 0 < APT.checkExes(downloadLock .. "Packages-" .. pu.host .. ".log") do os.execute("sleep 10") end 1000 while 0 < APT.checkExes(downloadLock .. "Packages-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end
995 while 0 < APT.checkExes(downloadLock .. "package-" .. pu.host .. ".log") do os.execute("sleep 10") end 1001 while 0 < APT.checkExes(downloadLock .. "package-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end
996 os.execute("sleep 5") 1002 os.execute("sleep 5")
997 if not APT.keep then os.execute("rm -fr results/" .. pu.host .. " 2>/dev/null") end 1003 if not APT.keep then os.execute("rm -fr results/" .. pu.host .. " 2>/dev/null") end
998 os.execute('rm results/STATUS_' .. pu.host .. '_* 2>/dev/null') 1004 os.execute('rm results/STATUS_' .. pu.host .. '_* 2>/dev/null')
@@ -1012,7 +1018,6 @@ else
1012 if nil ~= dt then os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') end 1018 if nil ~= dt then os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') end
1013 os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp') 1019 os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp')
1014 if not APT.keep then 1020 if not APT.keep then
1015 os.execute("rm -f results/*.log 2>/dev/null")
1016 os.execute("rm -f results/*.html 2>/dev/null") 1021 os.execute("rm -f results/*.html 2>/dev/null")
1017 os.execute("rm -f results/*.txt 2>/dev/null") 1022 os.execute("rm -f results/*.txt 2>/dev/null")
1018 end 1023 end