diff options
| author | onefang | 2019-12-01 01:41:16 +1000 |
|---|---|---|
| committer | onefang | 2019-12-01 01:41:16 +1000 |
| commit | 0f6c928194683f3bb85cedb1e92ed3f0cd67c84a (patch) | |
| tree | d3440c35f6207c1315922e88e68117cf9477f7b7 | |
| parent | We no longer use wget. (diff) | |
| download | apt-panopticon-0f6c928194683f3bb85cedb1e92ed3f0cd67c84a.zip apt-panopticon-0f6c928194683f3bb85cedb1e92ed3f0cd67c84a.tar.gz apt-panopticon-0f6c928194683f3bb85cedb1e92ed3f0cd67c84a.tar.bz2 apt-panopticon-0f6c928194683f3bb85cedb1e92ed3f0cd67c84a.tar.xz | |
Much work on the Updated tests.
Plus keep a history of results.
| -rwxr-xr-x | apt-panopticon-report-email.lua | 2 | ||||
| -rwxr-xr-x | apt-panopticon-report-web.lua | 2 | ||||
| -rwxr-xr-x | apt-panopticon.lua | 243 |
3 files changed, 206 insertions, 41 deletions
diff --git a/apt-panopticon-report-email.lua b/apt-panopticon-report-email.lua index b9c1b30..eb2a0a7 100755 --- a/apt-panopticon-report-email.lua +++ b/apt-panopticon-report-email.lua | |||
| @@ -240,7 +240,7 @@ if nil == file then C("opening mirrors file - " .. e) else | |||
| 240 | local protocol = status(k, results, "Protocol") | 240 | local protocol = status(k, results, "Protocol") |
| 241 | local sanity = "[skip]" | 241 | local sanity = "[skip]" |
| 242 | local integrity = status(k, results, "Integrity") | 242 | local integrity = status(k, results, "Integrity") |
| 243 | local updated = "[skip]" | 243 | local updated = status(k, results, "Updated") |
| 244 | 244 | ||
| 245 | -- DNS-RR test. | 245 | -- DNS-RR test. |
| 246 | if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then | 246 | if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then |
diff --git a/apt-panopticon-report-web.lua b/apt-panopticon-report-web.lua index 9a90860..753a23c 100755 --- a/apt-panopticon-report-web.lua +++ b/apt-panopticon-report-web.lua | |||
| @@ -278,7 +278,7 @@ if nil == file then C("opening mirrors file - " .. e) else | |||
| 278 | local protocol = status(k, results, "Protocol") | 278 | local protocol = status(k, results, "Protocol") |
| 279 | local sanity = "[<font color='gray'><b>skip</b></font>]" | 279 | local sanity = "[<font color='gray'><b>skip</b></font>]" |
| 280 | local integrity = status(k, results, "Integrity") | 280 | local integrity = status(k, results, "Integrity") |
| 281 | local updated = "[<font color='gray'><b>skip</b></font>]" | 281 | local updated = status(k, results, "Updated") |
| 282 | 282 | ||
| 283 | -- DNS-RR test. | 283 | -- DNS-RR test. |
| 284 | if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then | 284 | if ("deb.devuan.org" ~= k) and (nil ~= mirrors["deb.devuan.org"]) then |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index d40a74c..d66e32d 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
| @@ -45,7 +45,7 @@ options = | |||
| 45 | "Protocol", | 45 | "Protocol", |
| 46 | -- "URLSanity", | 46 | -- "URLSanity", |
| 47 | "Integrity", | 47 | "Integrity", |
| 48 | -- "Updated", | 48 | "Updated", |
| 49 | }, | 49 | }, |
| 50 | }, | 50 | }, |
| 51 | timeout = | 51 | timeout = |
| @@ -100,7 +100,7 @@ local referenceDebs = | |||
| 100 | local referenceDevs = | 100 | local referenceDevs = |
| 101 | { | 101 | { |
| 102 | -- Devuan package. NOTE this one should not get redirected, but that's more a warning than an error. | 102 | -- Devuan package. NOTE this one should not get redirected, but that's more a warning than an error. |
| 103 | "merged/pool/DEVUAN/main/d/desktop-base/desktop-base_2.0.3_all.deb", | 103 | "merged/pool/DEVUAN/main/d/desktop-base/desktop-base_3.0_all.deb", |
| 104 | "merged/pool/DEVUAN/main/u/util-linux/util-linux_2.32.1-0.1+devuan2.1_amd64.deb", | 104 | "merged/pool/DEVUAN/main/u/util-linux/util-linux_2.32.1-0.1+devuan2.1_amd64.deb", |
| 105 | } | 105 | } |
| 106 | local arg = {} | 106 | local arg = {} |
| @@ -354,6 +354,11 @@ local checkExes = function (exe) | |||
| 354 | return tonumber(count) | 354 | return tonumber(count) |
| 355 | end | 355 | end |
| 356 | 356 | ||
| 357 | local checkFile = function(f) | ||
| 358 | local h, e = io.open(f, "r") | ||
| 359 | if nil == h then return false else h:close(); return true end | ||
| 360 | end | ||
| 361 | |||
| 357 | local repoExists = function (r) | 362 | local repoExists = function (r) |
| 358 | r = r:match("([%a-]*)") | 363 | r = r:match("([%a-]*)") |
| 359 | if nil == r then return false end | 364 | if nil == r then return false end |
| @@ -610,34 +615,106 @@ end | |||
| 610 | 615 | ||
| 611 | 616 | ||
| 612 | local addDownload = function(host, URL, f, r, k) | 617 | local addDownload = function(host, URL, f, r, k) |
| 618 | local file = k:match(".*/([%w%.%+%-_]*)$") -- Get the filename. | ||
| 619 | local o, e = io.open("results/" .. host .. "/merged/dists/" .. r .. k, "r") | ||
| 620 | if nil ~= o then | ||
| 621 | o:close() | ||
| 622 | -- Curls "check timestamp and overwrite file" stuff sucks. | ||
| 623 | -- -R means the destination file gets the timestamp of the remote file. | ||
| 624 | -- Can only do ONE timestamp check per command. | ||
| 625 | -- This doesn't work either. All downloads get all these headers. Pffft | ||
| 626 | -- local status, ts = execute('TZ="GMT" ls -l --time-style="+%a, %d %b %Y %T %Z" results/' .. host .. "/merged/dists/" .. r .. k .. ' | cut -d " " -f 6-11') | ||
| 627 | -- f:write('header "If-Modified-Since: ' .. ts:sub(2, -2) .. '"\n') | ||
| 628 | -- Curl will DELETE the existing file if the timestamp fails to download a new one, unless we change directory first, | ||
| 629 | -- which wont work with multiple files in multiple directories. WTF? | ||
| 630 | os.execute(" mv results/" .. host .. "/merged/dists/" .. r .. k .. | ||
| 631 | " results/" .. host .. "/merged/dists/" .. r .. k .. ".old") | ||
| 632 | end | ||
| 633 | |||
| 634 | D('Downloading http://' .. host .. URL .. '/merged/dists/' .. r .. k) | ||
| 613 | f:write('url "' .. 'http://' .. host .. URL .. '/merged/dists/' .. r .. k .. '"\n') | 635 | f:write('url "' .. 'http://' .. host .. URL .. '/merged/dists/' .. r .. k .. '"\n') |
| 614 | f:write('output "results/' .. host .. '/merged/dists/' .. r .. k .. '"\n') | 636 | f:write('output "results/' .. host .. '/merged/dists/' .. r .. k .. '"\n') |
| 615 | -- Curls "check timestamp and overwrite file" stuff sucks. | ||
| 616 | -- Can only do ONE timestamp check per command. | ||
| 617 | -- Will DELETE the existing file if the timestamp fails to download a new one, unless we change directory first, which wont work here. | ||
| 618 | os.execute("if [ -f results/" .. host .. "/merged/dists/" .. r .. k .. " ]; then mv" .. | ||
| 619 | " results/" .. host .. "/merged/dists/" .. r .. k .. | ||
| 620 | " results/" .. host .. "/merged/dists/" .. r .. k .. ".old; fi") | ||
| 621 | end | 637 | end |
| 622 | 638 | ||
| 623 | local postDownload = function(host, r, k) | 639 | local postDownload = function(host, r, k) |
| 640 | local file = k:match(".*/([%w%.%+%-_]*)$") -- Get the filename. | ||
| 641 | local dir = k:sub(1, 0 - (#file + 1)) | ||
| 624 | os.execute("if [ -f results/" .. host .. "/merged/dists/" .. r .. k .. ".old ]" .. | 642 | os.execute("if [ -f results/" .. host .. "/merged/dists/" .. r .. k .. ".old ]" .. |
| 625 | " && [ ! -f results/" .. host .. "/merged/dists/" .. r .. k .. " ]; then cp" .. | 643 | " && [ ! -f results/" .. host .. "/merged/dists/" .. r .. k .. " ]; then cp -a" .. |
| 626 | " results/" .. host .. "/merged/dists/" .. r .. k .. ".old" .. | 644 | " results/" .. host .. "/merged/dists/" .. r .. k .. ".old" .. |
| 627 | " results/" .. host .. "/merged/dists/" .. r .. k .. "; fi") | 645 | " results/" .. host .. "/merged/dists/" .. r .. k .. "; fi") |
| 646 | if ".gz" == k:sub(-3, -1) then execute("gzip -dfk results/" .. host .. "/merged/dists/" .. r .. k) end | ||
| 647 | if ".xz" == k:sub(-3, -1) then execute("xz -dfk results/" .. host .. "/merged/dists/" .. r .. k .. " 2>/dev/null") end | ||
| 628 | if testing("Integrity") then | 648 | if testing("Integrity") then |
| 629 | if ".gpg" == k:sub(-4, -1) then | 649 | if ".gpg" == k:sub(-4, -1) then |
| 630 | local status, out = execute("gpgv --keyring /usr/share/keyrings/devuan-keyring.gpg results/" .. host .. "/merged/dists/" .. r .. k .. | 650 | local status, out = execute("gpgv --keyring /usr/share/keyrings/devuan-keyring.gpg results/" .. host .. "/merged/dists/" .. r .. k .. |
| 631 | " results/" .. host .. "/merged/dists/" .. r .. k:sub(1, -5) .. " 2>/dev/null") | 651 | " results/" .. host .. "/merged/dists/" .. r .. k:sub(1, -5) .. " 2>/dev/null") |
| 632 | if "0" ~= status then E("GPG check failed - " .. host .. "/merged/dists/" .. r .. k, "http", "Integrity", host) end | 652 | if "0" ~= status then E("GPG check failed - " .. host .. "/merged/dists/" .. r .. k, "http", "Integrity", host) end |
| 633 | end | 653 | end |
| 654 | -- TODO - should check the PGP sig of InRelease as well. | ||
| 655 | end | ||
| 656 | if testing("Integrity") or testing("Updated") then | ||
| 657 | if options.referenceSite.value == host then | ||
| 658 | if "Packages." == file:sub(1, 9) then | ||
| 659 | -- TODO - compare the SHA256 sums in pkgmaster's Release for both the packed and unpacked versions. | ||
| 660 | local Pp, e = io.open('results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed', "w+") | ||
| 661 | if nil == Pp then W('opening results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed' .. ' file - ' .. e) else | ||
| 662 | local pp = {} | ||
| 663 | if checkFile('results_old/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages') then | ||
| 664 | for l in io.lines('results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages') do | ||
| 665 | if "Package: " == l:sub(1, 9) then | ||
| 666 | if 0 ~= #pp then | ||
| 667 | Pp:write(r .. " | ") | ||
| 668 | for i = 1, 6 do | ||
| 669 | if nil == pp[i] then print(host .. " " .. r .. " " .. dir .. " " .. i) else Pp:write(pp[i] .. " | ") end | ||
| 670 | end | ||
| 671 | Pp:write("\n") | ||
| 672 | end | ||
| 673 | pp = {} | ||
| 674 | pp[1] = l:sub(10, -1) | ||
| 675 | elseif "Version: " == l:sub(1, 9) then | ||
| 676 | pp[2] = l:sub(10, -1) | ||
| 677 | elseif "Filename: " == l:sub(1, 10) then | ||
| 678 | pp[3] = l:sub(11, -1) | ||
| 679 | elseif "Size: " == l:sub(1, 6) then | ||
| 680 | pp[4] = l:sub(7, -1) | ||
| 681 | elseif "MD5sum: " == l:sub(1, 8) then | ||
| 682 | pp[5] = l:sub(9, -1) | ||
| 683 | elseif "SHA256: " == l:sub(1, 8) then | ||
| 684 | pp[6] = l:sub(9, -1) | ||
| 685 | end | ||
| 686 | end | ||
| 687 | else | ||
| 688 | W("Can't find file results_old/pkgmaster.devuan.org/merged/dists/" .. r .. dir .. "Packages") | ||
| 689 | end | ||
| 690 | Pp:close() | ||
| 691 | os.execute('sort results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed >results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed-sorted') | ||
| 692 | os.execute('rm results/' .. host .. '/merged/dists/'.. r .. dir .. 'Packages.parsed') | ||
| 693 | if checkFile('results_old/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages.parsed-sorted') then | ||
| 694 | execute('diff -U 0 results_old/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages.parsed-sorted ' .. | ||
| 695 | 'results/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages.parsed-sorted ' .. | ||
| 696 | ' | grep -E "^-" | grep -Ev "^\\+\\+\\+|^---" >>results/OLD_PACKAGES_' .. r .. '.txt') | ||
| 697 | execute('diff -U 0 results_old/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages.parsed-sorted ' .. | ||
| 698 | 'results/pkgmaster.devuan.org/merged/dists/' .. r .. dir .. 'Packages.parsed-sorted ' .. | ||
| 699 | ' | grep -E "^\\+" | grep -Ev "^\\+\\+\\+|^---" >>results/NEW_Packages_' .. r .. '.txt') | ||
| 700 | -- Find the smallest new package for each release. | ||
| 701 | os.execute('sort -b -k 9,9 -n results/NEW_Packages_' .. r .. '.txt >results/NEW_Packages_' .. r .. '.sorted.txt') | ||
| 702 | os.execute('grep -s " | pool/DEBIAN/" results/NEW_Packages_' .. r .. '.sorted.txt 2>/dev/null | head -n 1 >results/NEW_Packages_' .. r .. '.test.txt') | ||
| 703 | os.execute('grep -s " | pool/DEBIAN-SECURITY/" results/NEW_Packages_' .. r .. '.sorted.txt 2>/dev/null | head -n 1 >>results/NEW_Packages_' .. r .. '.test.txt') | ||
| 704 | os.execute('grep -s " | pool/DEVUAN/" results/NEW_Packages_' .. r .. '.sorted.txt 2>/dev/null | head -n 1 >>results/NEW_Packages_' .. r .. '.test.txt') | ||
| 705 | else | ||
| 706 | W("Can't find file results_old/pkgmaster.devuan.org/merged/dists/" .. r .. dir .. "Packages.parsed-sorted") | ||
| 707 | end | ||
| 708 | end | ||
| 709 | end | ||
| 710 | end | ||
| 634 | end | 711 | end |
| 635 | end | 712 | end |
| 636 | 713 | ||
| 637 | local downloadLock = "flock -n results/curl-" | 714 | local downloadLock = "flock -n results/curl-" |
| 638 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -L -z 'results/stamp.old' -v -R " | 715 | local download = "curl --connect-timeout " .. options.timeout.value .. " --create-dirs -L -z 'results/stamp.old' -v -R " |
| 639 | local downloads = function(host, URL, release, list) | 716 | local downloads = function(host, URL, release, list) |
| 640 | if nil == URL then URL = "/" end | 717 | if nil == URL then URL = "" end |
| 641 | local lock = "%s-" .. host .. ".lock" | 718 | local lock = "%s-" .. host .. ".lock" |
| 642 | local log = " --stderr results/curl-%s_" .. host .. ".log" | 719 | local log = " --stderr results/curl-%s_" .. host .. ".log" |
| 643 | local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock:format("META") .. " " .. download .. log:format("META") .. " -K results/" .. host .. ".curl" | 720 | local cm = "ionice -c3 nice -n 19 " .. downloadLock .. lock:format("META") .. " " .. download .. log:format("META") .. " -K results/" .. host .. ".curl" |
| @@ -648,24 +725,19 @@ local downloads = function(host, URL, release, list) | |||
| 648 | 725 | ||
| 649 | if nil ~= list then | 726 | if nil ~= list then |
| 650 | if "" ~= list then | 727 | if "" ~= list then |
| 651 | for l in list:gmatch("\n*([^\n]+)\n*") do | 728 | if nil ~= release then |
| 652 | addDownload(host, URL, f, release, "/" .. l) | 729 | for l in list:gmatch("\n*([^\n]+)\n*") do |
| 730 | addDownload(host, URL, f, release, "/" .. l) | ||
| 731 | end | ||
| 732 | else | ||
| 733 | D('Downlaading http://' .. host .. URL .. '/merged/' .. list) | ||
| 734 | f:write('url "' .. 'http://' .. host .. URL .. '/merged/' .. list .. '"\n') | ||
| 735 | f:write('output "results/' .. host .. '/merged/' .. list .. '"\n') | ||
| 653 | end | 736 | end |
| 654 | f:close() | 737 | f:close() |
| 655 | return | 738 | return |
| 656 | end | 739 | end |
| 657 | else | 740 | else |
| 658 | |||
| 659 | --[[ | ||
| 660 | for i, s in pairs(referenceDevs) do | ||
| 661 | cm = cm .. " https://" .. host .. URL .. "/" .. s | ||
| 662 | end | ||
| 663 | for i, s in pairs(referenceDebs) do | ||
| 664 | cm = cm .. " https://" .. host .. URL .. "/" .. s | ||
| 665 | end | ||
| 666 | execute(cm) | ||
| 667 | ]] | ||
| 668 | |||
| 669 | for i, s in pairs(releases) do | 741 | for i, s in pairs(releases) do |
| 670 | for j, k in pairs(releaseFiles) do | 742 | for j, k in pairs(releaseFiles) do |
| 671 | if repoExists(s .. k) then | 743 | if repoExists(s .. k) then |
| @@ -678,6 +750,7 @@ local downloads = function(host, URL, release, list) | |||
| 678 | fork(cm) | 750 | fork(cm) |
| 679 | end | 751 | end |
| 680 | 752 | ||
| 753 | |||
| 681 | local getMirrors = function () | 754 | local getMirrors = function () |
| 682 | local mirrors = {} | 755 | local mirrors = {} |
| 683 | local host = "" | 756 | local host = "" |
| @@ -818,6 +891,13 @@ if 0 < #arg then | |||
| 818 | arg[1] = arg[1]:sub(1, -2) | 891 | arg[1] = arg[1]:sub(1, -2) |
| 819 | end | 892 | end |
| 820 | local pu = url.parse("http://" .. arg[1]) | 893 | local pu = url.parse("http://" .. arg[1]) |
| 894 | |||
| 895 | if testing("Integrity") or testing("Updated") then | ||
| 896 | if origin and options.referenceSite.value == pu.host then | ||
| 897 | -- if not keep then execute("rm -fr results/" .. pu.host) end | ||
| 898 | end | ||
| 899 | end | ||
| 900 | |||
| 821 | if nil ~= arg[2] then | 901 | if nil ~= arg[2] then |
| 822 | logFile, e = io.open("results/LOG_" .. pu.host .. "_" .. arg[2] .. ".html", "a+") | 902 | logFile, e = io.open("results/LOG_" .. pu.host .. "_" .. arg[2] .. ".html", "a+") |
| 823 | else | 903 | else |
| @@ -840,25 +920,22 @@ if 0 < #arg then | |||
| 840 | results[v] = tests | 920 | results[v] = tests |
| 841 | end | 921 | end |
| 842 | end | 922 | end |
| 843 | if testing("Integrity") or testing("Updated") then | ||
| 844 | if nil == arg[2] then | ||
| 845 | I("Starting file downloads for " .. pu.host) | ||
| 846 | -- if not keep then execute("rm -fr results/" .. pu.host) end | ||
| 847 | downloads(pu.host, pu.path) | ||
| 848 | -- checkExes("apt-panopticon.lua " .. sendArgs) | ||
| 849 | -- checkExes(downloadLock) | ||
| 850 | end | ||
| 851 | end | ||
| 852 | if origin then | 923 | if origin then |
| 924 | if testing("Integrity") or testing("Updated") then | ||
| 925 | if origin and (options.roundRobin.value ~= pu.host) then | ||
| 926 | I("Starting file downloads for " .. pu.host) | ||
| 927 | downloads(pu.host, pu.path) | ||
| 928 | end | ||
| 929 | end | ||
| 853 | checkFiles(pu.host, pu.host, pu.path); | 930 | checkFiles(pu.host, pu.host, pu.path); |
| 854 | else | 931 | else |
| 855 | checkHost(pu.host, pu.host, pu.path, arg[2], arg[3]) | 932 | checkHost(pu.host, pu.host, pu.path, arg[2], arg[3]) |
| 856 | end | 933 | end |
| 857 | 934 | ||
| 858 | if testing("Integrity") or testing("Updated") then | 935 | if testing("Integrity") or testing("Updated") then |
| 859 | if nil == arg[2] then | 936 | if origin and (options.roundRobin.value ~= pu.host) then |
| 860 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end | 937 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end |
| 861 | os.execute("rm -f results/" .. pu.host .. ".curl") | 938 | os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") |
| 862 | for i, n in pairs(releases) do | 939 | for i, n in pairs(releases) do |
| 863 | for l, o in pairs(releaseFiles) do | 940 | for l, o in pairs(releaseFiles) do |
| 864 | if repoExists(i .. o) then | 941 | if repoExists(i .. o) then |
| @@ -866,7 +943,85 @@ if 0 < #arg then | |||
| 866 | end | 943 | end |
| 867 | end | 944 | end |
| 868 | 945 | ||
| 946 | os.execute('sort -k 3 results/' .. pu.host .. '/merged/dists/' .. n .. '/Release >results/' .. pu.host .. '/merged/dists/' .. n .. '/Release.SORTED') | ||
| 947 | if options.referenceSite.value == pu.host then | ||
| 948 | execute('diff -U 0 results_old/pkgmaster.devuan.org/merged/dists/' .. n .. '/Release.SORTED ' .. | ||
| 949 | 'results/pkgmaster.devuan.org/merged/dists/' .. n .. '/Release.SORTED ' .. | ||
| 950 | '| grep -v "@@" | grep "^+" | grep "Packages.xz$" | cut -c 77- >results/NEW_Release_' .. n .. '.txt') | ||
| 951 | else | ||
| 952 | -- TODO - compare to the pkgmaster copy. | ||
| 953 | end | ||
| 954 | |||
| 955 | local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r") | ||
| 956 | if nil == dfile then W("opening results/NEW_Release_" .. n .. " file - " .. e) else | ||
| 957 | local diff = dfile:read("*a") | ||
| 958 | if "" ~= diff then | ||
| 959 | downloads(pu.host, pu.path, n, diff) | ||
| 960 | end | ||
| 961 | end | ||
| 962 | |||
| 963 | end | ||
| 964 | |||
| 965 | downloads(pu.host, pu.path, "", "") | ||
| 966 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end | ||
| 967 | os.execute("rm -f results/" .. pu.host .. ".curl; rm results/curl-" .. "META-" .. pu.host .. ".lock") | ||
| 968 | |||
| 969 | for i, n in pairs(releases) do | ||
| 970 | local dfile, e = io.open('results/NEW_Release_' .. n .. '.txt', "r") | ||
| 971 | if nil == dfile then W("opening results/NEW_Release_" .. n .. ".txt file - " .. e) else | ||
| 972 | local diff = dfile:read("*a") | ||
| 973 | for l in diff:gmatch("\n*([^\n]+)\n*") do | ||
| 974 | postDownload(pu.host, n, "/" .. l) | ||
| 975 | end | ||
| 976 | end | ||
| 977 | if options.referenceSite.value == pu.host then | ||
| 978 | -- In case it wasn't dealt with already. | ||
| 979 | os.execute('touch results/NEW_Packages_' .. n .. '.test.txt') | ||
| 980 | end | ||
| 981 | end | ||
| 982 | |||
| 983 | |||
| 984 | for i, n in pairs(releases) do | ||
| 985 | local nfile, e = io.open('results/NEW_Packages_' .. n .. '.test.txt', "r") | ||
| 986 | if nil == nfile then W("opening results/NEW_Packages_" .. n .. ".test.txt file - " .. e) else | ||
| 987 | for l in nfile:lines() do | ||
| 988 | local p = l:match('(pool/.*%.deb)') | ||
| 989 | if nil ~= p then | ||
| 990 | downloads(pu.host, pu.path, nil, p) | ||
| 991 | end | ||
| 992 | end | ||
| 993 | end | ||
| 869 | end | 994 | end |
| 995 | downloads(pu.host, pu.path, nil, "") | ||
| 996 | while 0 < checkExes(downloadLock .. "META-" .. pu.host .. ".lock") do os.execute("sleep 10") end | ||
| 997 | for i, n in pairs(releases) do | ||
| 998 | local nfile, e = io.open('results/NEW_Packages_' .. n .. '.test.txt', "r") | ||
| 999 | if nil == nfile then W("opening results/NEW_Packages_" .. n .. ".test.txt file - " .. e) else | ||
| 1000 | for l in nfile:lines() do | ||
| 1001 | local v, p, sz, m, sha = l:match(' | (.+) | (pool/.+%.deb) | (%d.+) | (%x.+) | (%x.+) |') | ||
| 1002 | if nil ~= p then | ||
| 1003 | local status, fsz = execute('ls -l results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 5-5') | ||
| 1004 | if testing("Integrity") then | ||
| 1005 | if sz ~= fsz:sub(2, -2) then -- The sub bit is to slice off the EOLs at each end. | ||
| 1006 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) | ||
| 1007 | print('|' .. sz .. '~=' .. fsz:sub(2, -2) .. '|') | ||
| 1008 | else | ||
| 1009 | local status, fm = execute('md5sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') | ||
| 1010 | if m ~= fm:sub(2, -2) then E('Package MD5 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end | ||
| 1011 | local status, fsha = execute('sha256sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') | ||
| 1012 | if sha ~= fsha:sub(2, -2) then E('Package SHA256 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end | ||
| 1013 | end | ||
| 1014 | end | ||
| 1015 | if testing("Updated") then | ||
| 1016 | if sz ~= fsz:sub(2, -2) then | ||
| 1017 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Updated', pu.host) | ||
| 1018 | end | ||
| 1019 | end | ||
| 1020 | end | ||
| 1021 | end | ||
| 1022 | end | ||
| 1023 | end | ||
| 1024 | |||
| 870 | end | 1025 | end |
| 871 | end | 1026 | end |
| 872 | 1027 | ||
| @@ -880,14 +1035,21 @@ if 0 < #arg then | |||
| 880 | logPost() | 1035 | logPost() |
| 881 | logFile:close() | 1036 | logFile:close() |
| 882 | else | 1037 | else |
| 883 | os.execute("mkdir -p results; if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp") | 1038 | local dt = os.date('!%Y-%m-%d-%H-%M') |
| 1039 | local fodt = io.popen('TZ="GMT" date -r results/stamp +%Y-%m-%d-%H-%M', 'r') | ||
| 1040 | odt = fodt:read('*l') | ||
| 1041 | fodt:close() | ||
| 1042 | os.execute(' rm results_old; ln -s results_' .. odt .. ' results_old') | ||
| 1043 | os.execute('mkdir -p results_' .. dt .. '; rm results; ln -s results_' .. dt .. ' results') | ||
| 1044 | os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp') | ||
| 1045 | os.execute("rm -f results/*.check") | ||
| 884 | if not keep then | 1046 | if not keep then |
| 885 | os.execute("rm -f results/*.curl") | 1047 | os.execute("rm -f results/*.curl") |
| 886 | os.execute("rm -f results/*.log") | 1048 | os.execute("rm -f results/*.log") |
| 887 | os.execute("rm -f results/*.html") | 1049 | os.execute("rm -f results/*.html") |
| 888 | os.execute("rm -f results/*.txt") | 1050 | os.execute("rm -f results/*.txt") |
| 889 | end | 1051 | end |
| 890 | os.execute("rm -f results/*.check") | 1052 | |
| 891 | logFile, e = io.open("results/LOG_apt-panopticon.html", "a+") | 1053 | logFile, e = io.open("results/LOG_apt-panopticon.html", "a+") |
| 892 | if nil == logFile then C("opening log file - " .. e); return end | 1054 | if nil == logFile then C("opening log file - " .. e); return end |
| 893 | logPre() | 1055 | logPre() |
| @@ -895,6 +1057,10 @@ else | |||
| 895 | os.execute("mkdir -p results") | 1057 | os.execute("mkdir -p results") |
| 896 | mirrors = getMirrors() | 1058 | mirrors = getMirrors() |
| 897 | checkHost(options.referenceSite.value) | 1059 | checkHost(options.referenceSite.value) |
| 1060 | for i, n in pairs(releases) do | ||
| 1061 | while not checkFile('results/NEW_Packages_' .. n .. '.test.txt') do os.execute("sleep 10") end | ||
| 1062 | end | ||
| 1063 | |||
| 898 | for k, m in pairs(mirrors) do | 1064 | for k, m in pairs(mirrors) do |
| 899 | if "/" == m.BaseURL:sub(-1, -1) then | 1065 | if "/" == m.BaseURL:sub(-1, -1) then |
| 900 | W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL, "", "", m.FQDN) | 1066 | W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL, "", "", m.FQDN) |
| @@ -911,10 +1077,9 @@ else | |||
| 911 | if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end | 1077 | if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end |
| 912 | end | 1078 | end |
| 913 | end | 1079 | end |
| 1080 | |||
| 914 | while 1 <= checkExes("apt-panopticon.lua " .. sendArgs) do os.execute("sleep 10") end | 1081 | while 1 <= checkExes("apt-panopticon.lua " .. sendArgs) do os.execute("sleep 10") end |
| 915 | if testing("Integrity") or testing("Updated") then | 1082 | |
| 916 | while 0 < checkExes(downloadLock) do os.execute("sleep 10") end | ||
| 917 | end | ||
| 918 | os.execute("rm -f results/*.check; rm -f results/*.lock") | 1083 | os.execute("rm -f results/*.check; rm -f results/*.lock") |
| 919 | 1084 | ||
| 920 | -- Create the reports. | 1085 | -- Create the reports. |
