From be99b28da3cab12b0dfe65de6b3f1f6aa642b0f3 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 3 Jan 2020 01:05:19 +1000 Subject: Make a couple of convenience strings. --- apt-panopticon.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 6558474..582866b 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -826,24 +826,26 @@ local parseRelease = function(host) end end - if APT.checkFile('results/' .. host .. '/merged/dists/' .. n .. '/Release') then - os.execute('sort -k 3 results/' .. host .. '/merged/dists/' .. n .. '/Release >results/' .. host .. '/merged/dists/' .. n .. '/Release.SORTED') + local fR = 'results/' .. host .. '/merged/dists/' .. n .. '/Release' + local fRp = APT.options.referenceSite.value .. '/merged/dists/' .. n .. '/Release.SORTED' + if APT.checkFile(fR) then + os.execute('sort -k 3 ' .. fR .. ' >' .. fR .. '.SORTED') local outFile = 'results/NEW_' .. list.out .. '_' .. n .. '.txt' - if APT.checkFile('results_old/' .. APT.options.referenceSite.value .. '/merged/dists/' .. n .. '/Release.SORTED') then + if APT.checkFile('results_old/' .. fRp) then if APT.options.referenceSite.value == host then outFile = outFile .. '.tmp' - os.execute('diff -U 0 results_old/' .. APT.options.referenceSite.value .. '/merged/dists/' .. n .. '/Release.SORTED ' .. - 'results/' .. APT.options.referenceSite.value .. '/merged/dists/' .. n .. '/Release.SORTED ' .. + os.execute('diff -U 0 results_old/' .. fRp .. ' ' .. + 'results/' .. fRp .. ' ' .. '| grep -v "@@" | grep "^+" | grep "Packages.xz$" | cut -c 77- >' .. outFile) -- TODO - Maybe check the date in Release, though since they are updated daily, is there any point? Perhaps it's for checking amprolla got run? -- Also check if that date is in the future, apt recently got a check for that, though not sure why. - os.execute('rm -f results/' .. host .. '/merged/dists/' .. n .. '/Release 2>/dev/null; ') + os.execute('rm -f ' .. fR .. ' 2>/dev/null; ') else -- TODO - compare to the pkgmaster copy. if APT.testing('Updated') then - local pkt = APT.exe([[TZ="GMT" date -d "$(grep '^Date:' results/pkgmaster.devuan.org/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']]):Do().result + local pkt = APT.exe([[TZ="GMT" date -d "$(grep '^Date:' results/]] .. fRp .. [[ | cut -d ' ' -f 2-)" '+%s']]):Do().result pkt = tonumber(pkt:sub(2, -2)) - local new = APT.exe([[TZ="GMT" date -d "$(grep '^Date:' results/]] .. host .. [[/merged/dists/]] .. n .. [[/Release.SORTED | cut -d ' ' -f 2-)" '+%s']]):Do().result + local new = APT.exe([[TZ="GMT" date -d "$(grep '^Date:' ]] .. fR .. [[.SORTED | cut -d ' ' -f 2-)" '+%s']]):Do().result new = tonumber(new:sub(2, -2)) local upd = pkt + APT.mirrors[host].Updated local updd = pkt + (APT.mirrors[host].Updated * 1.5) -- Give the mirror time to actually do the update. -- cgit v1.1