aboutsummaryrefslogtreecommitdiffstats
path: root/main/aports-build/report-build-errors.lua
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-11-17 08:46:55 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-11-17 08:47:40 +0000
commit94c6a0c04d64a54dc422b8a635e3601c375a3155 (patch)
tree39b6033b7bd3d09c4f452118a7daea6747f33d25 /main/aports-build/report-build-errors.lua
parentb9e3afbeb66666215134345d7ac82d1bdea70fec (diff)
downloadaports-94c6a0c04d64a54dc422b8a635e3601c375a3155.tar.bz2
aports-94c6a0c04d64a54dc422b8a635e3601c375a3155.tar.xz
main/aports-build: add support for uploading logs
we need upload logs for arm builders
Diffstat (limited to 'main/aports-build/report-build-errors.lua')
-rw-r--r--main/aports-build/report-build-errors.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/main/aports-build/report-build-errors.lua b/main/aports-build/report-build-errors.lua
index 3145b15993..8809430a69 100644
--- a/main/aports-build/report-build-errors.lua
+++ b/main/aports-build/report-build-errors.lua
@@ -10,7 +10,35 @@ local urlprefix=("http://build.alpinelinux.org/buildlogs/%s"):format(hostname)
local m = {}
+--local logtarget="distfiles.alpinelinux.org:/var/cache/distfiles/buildlogs/"..hostname
+
+function shell_escape(args)
+ local ret = {}
+ for _,a in pairs(args) do
+ s = tostring(a)
+ if s:match("[^A-Za-z0-9_/:=-]") then
+ s = "'"..s:gsub("'", "'\\''").."'"
+ end
+ table.insert(ret,s)
+ end
+ return table.concat(ret, " ")
+end
+
+function run(args)
+ local h = io.popen(shell_escape(args))
+ local outstr = h:read("*a")
+ return h:close(), outstr
+end
+
function m.postbuild(aport, success, repodest, arch, logfile)
+ -- upload log
+ local loghost,logdirprefix = (logtarget or ""):match("(.*):(.*)")
+ if logfile and loghost and logdirprefix then
+ local logdir = logdirprefix.."/"..aport:get_repo_name().."/"..aport.pkgname.."/"
+ run{"ssh", loghost, "mkdir", "-p", logdir}
+ run{"scp", logfile, loghost..":"..logdir}
+ end
+
if not success then
local topic = ("build/%s/errors"):format(hostname)
local payload = json.encode{