aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-28 22:47:24 +1000
committeronefang2019-12-28 22:47:24 +1000
commit3468d711b6ca49f476d87bf2acf9ca5e8fbd2728 (patch)
tree7cad00d45d9ef2ab1563980e20708a85514aa737
parentThe answer to life, the universe, and input validation. (diff)
downloadapt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.zip
apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.gz
apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.bz2
apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.xz
Better first time calculation in the update script.
-rwxr-xr-xapt-panopticon-update-data.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua
index 8ab9254..105a1c7 100755
--- a/apt-panopticon-update-data.lua
+++ b/apt-panopticon-update-data.lua
@@ -9,7 +9,7 @@ local E = APT.E
9local C = APT.C 9local C = APT.C
10local arg, sendArgs = APT.parseArgs({...}) 10local arg, sendArgs = APT.parseArgs({...})
11 11
12local oldest = 0 12local oldest = os.date('!%s') - (60 * 60)
13 13
14local fixResults = function(f) 14local fixResults = function(f)
15 if APT.checkFile(f) then 15 if APT.checkFile(f) then
@@ -46,16 +46,13 @@ os.execute('touch ' .. lock)
46 46
47 47
48if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end 48if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end
49local files = io.popen('ls -1 results_*.tar.xz 2>/dev/null; ls -1 results_*/results_*.tar.xz 2>/dev/null') 49local files = io.popen('ls -1 results_*/results_*.tar.xz 2>/dev/null; ls -1 results_*.tar.xz 2>/dev/null')
50for l in files:lines() do 50for l in files:lines() do
51 local lsub = l:sub(1, -8) 51 local lsub = l:sub(1, -8)
52 if 0 == oldest then 52
53 local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6') 53 local dt = os.date('!%s', os.time{year = l:sub(-23, -20), month = l:sub(-18, -17), day = l:sub(-15, -14), hour = l:sub(-12, -11), minute = l:sub(-9, -8)}) - (60 * 60)
54 whn = whn:sub(2, -2) 54 if dt < oldest then oldest = dt; print('\nOldest time is ' .. oldest) end
55 local status, new = APT.execute('TZ="GMT" date -d "' .. whn:sub(9, 18) .. ' ' .. whn:sub(20, 21) .. ':' .. whn:sub(23, 24) .. '" "+%s"') 55
56 oldest = tonumber("0" .. new:sub(2, -2)) - (60 * 60)
57 if -1 < APT.verbosity then print('\nOldest time is ' .. oldest) end
58 end
59 if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end 56 if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end
60 os.execute('tar -xf ' .. l) 57 os.execute('tar -xf ' .. l)
61 58
@@ -79,6 +76,7 @@ for l in files:lines() do
79 end 76 end
80 os.execute('rm -fr ' .. lsub .. '/' .. k .. '/merged/pool') 77 os.execute('rm -fr ' .. lsub .. '/' .. k .. '/merged/pool')
81 end 78 end
79
82 local results = {} 80 local results = {}
83 local f = l:sub(1, -8) .. "/" .. k .. ".lua" 81 local f = l:sub(1, -8) .. "/" .. k .. ".lua"
84 if APT.checkFile(f) then 82 if APT.checkFile(f) then
@@ -90,8 +88,10 @@ for l in files:lines() do
90 rfile:close() 88 rfile:close()
91 end 89 end
92 end 90 end
91
93 end 92 end
94 end 93 end
94
95 local fls = io.popen('ls -1 ' .. lsub .. '/*.lua 2>/dev/null') 95 local fls = io.popen('ls -1 ' .. lsub .. '/*.lua 2>/dev/null')
96 for k in fls:lines() do 96 for k in fls:lines() do
97 fixResults(k) 97 fixResults(k)