From 6f952a1e8dd51953942e2d1403312e2121126328 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 26 Dec 2019 02:10:04 +1000 Subject: Fix up Updated time checks. --- apt-panopticon.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index b7a35fc..d67e3d0 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -776,8 +776,6 @@ local parseRelease = function(host) local status, now = APT.execute('TZ="GMT" date "+%s"', false) now = tonumber(now:sub(2, -2)) for i, n in pairs(releases) do - local status, old = APT.execute([[TZ="GMT" date -d "$(grep '^Date:' results_old/pkgmaster.devuan.org/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']], false) - old = tonumber(old:sub(2, -2)) for l, o in pairs(releaseFiles) do if repoExists(i .. o) then postDownload(host, n, o) @@ -808,10 +806,12 @@ local parseRelease = function(host) else -- TODO - compare to the pkgmaster copy. if APT.testing('Updated') then - local status, new = APT.execute([[TZ="GMT" date -d "$(grep '^Date:' results/]] .. host .. [[/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']], false) + local status, pkt = APT.execute([[TZ="GMT" date -d "$(grep '^Date:' results/pkgmaster.devuan.org/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']], false) + pkt = tonumber(pkt:sub(2, -2)) + local status, new = APT.execute([[TZ="GMT" date -d "$(grep '^Date:' results/]] .. host .. [[/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']], false) new = tonumber(new:sub(2, -2)) - local upd = old + APT.mirrors[host].Updated - if old ~= new then + local upd = pkt + APT.mirrors[host].Updated + if pkt > new then if upd >= now then W('Release ' .. n .. ' not updated yet, should update @ ' .. os.date('!%F %T', upd), 'http', 'Updated', host) else -- cgit v1.1