From 18dd54b8f0ba73abd84397977712926d3491f088 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 25 Dec 2019 23:10:15 +1000 Subject: Use proper time and date format, and check for the directory before tarballing it up. --- apt-panopticommon.lua | 6 +++--- apt-panopticon-report-email-web.lua | 4 ++-- apt-panopticon.lua | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 37b43e4..55f0e40 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -378,7 +378,7 @@ local log = function(v, t, s, prot, test, host) end end if v <= APT.verbosity then - if 3 <= APT.verbosity then t = os.date() .. " " .. t end + if 3 <= APT.verbosity then t = os.date('!%F %T') .. " " .. t end print(t .. ": " .. s) end if nil ~= APT.logFile then @@ -390,9 +390,9 @@ local log = function(v, t, s, prot, test, host) if 2 == v then colour = "blue " end -- TIMEOUT if 3 == v then colour = "white " end -- INFO if 4 == v then colour = "gray " end -- DEBUG - APT.logFile:write(os.date() .. " " .. t .. ": " .. s .. "
\n") + APT.logFile:write(os.date('!%F %T') .. " " .. t .. ": " .. s .. "
\n") else - APT.logFile:write(os.date() .. " " .. t .. ": " .. s .. "\n") + APT.logFile:write(os.date('!%F %T') .. " " .. t .. ": " .. s .. "\n") end APT.logFile:flush() end diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 23608d3..42fb19e 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -198,7 +198,7 @@ if nil == email then C("opening mirrors file - " .. e) else "Due to the nature of the tests, some errors or warnings will be \ncounted several times. " .. "Refer to the logs on the web page for details.\n\n" .. "Please see below the current status of the Devuan Package Mirror \nnetwork:\n\n" .. - "==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====\n" .. + "==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====\n" .. "[skip] means that the test hasn't been written yet.\n\n") for k, v in APT.orderedPairs(APT.mirrors) do email:write(k .. "....\n") @@ -345,7 +345,7 @@ if nil == web then C("opening mirrors file - " .. e) else "https://pkgmaster.devuan.org/mirror_list.txt

\n" .. "

Due to the nature of the tests, some errors or warnings will be counted several times.   " .. "The links in the table and DNS list go to the detailed testing logs.

\n\n" .. - "
\n

==== package mirror status " .. os.date("!%Y-%m-%d %H:%M") .. " GMT ====

\n" .. + "
\n

==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====

\n" .. "

[FAILED] or [OK]" .. " means the tested thing is supported for that mirror.

\n" .. diff --git a/apt-panopticon.lua b/apt-panopticon.lua index b2827b4..ba5c064 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -1009,9 +1009,9 @@ else local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") local adt = fadt:read('*l') fadt:close() - if nil ~= adt then os.execute('ionice -c3 nice -n 19 tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz &') end - local dt = os.date('!%Y-%m-%d-%H-%M') - local fodt = io.popen('TZ="GMT" date -r results/stamp +%Y-%m-%d-%H-%M 2>/dev/null', 'r') + if (nil ~= adt) and APT.checkFile(adt) then os.execute('ionice -c3 nice -n 19 tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz &') end + local dt = os.date('!%F-%H-%M') + local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') local odt = fodt:read('*l') fodt:close() if nil ~= odt then os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') end @@ -1086,7 +1086,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. f = f:sub(9, -1) APT.logFile:write('
\n
\n

' .. f .. '

\n') for l in io.lines('results/' .. f) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() @@ -1102,7 +1102,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. g = g:sub(9, -1) APT.logFile:write('
\n
\n

' .. g .. '

\n') for l in io.lines('results/' .. g) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() @@ -1116,7 +1116,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. f = f:sub(9, -1) APT.logFile:write('
\n
\n

' .. f .. '

\n') for l in io.lines('results/' .. f) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() -- cgit v1.1