diff options
Diffstat (limited to 'main/aports-build/report-build-errors.lua')
-rw-r--r-- | main/aports-build/report-build-errors.lua | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/main/aports-build/report-build-errors.lua b/main/aports-build/report-build-errors.lua index 4002f93ee2..275b213f86 100644 --- a/main/aports-build/report-build-errors.lua +++ b/main/aports-build/report-build-errors.lua @@ -6,12 +6,8 @@ local f = io.open("/proc/sys/kernel/hostname") hostname = f:read() f:close() -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 @@ -30,13 +26,17 @@ function run(args) return h:close(), outstr end -function m.postbuild(aport, success, repodest, arch, logfile) +function m.postbuild(conf, aport, success) -- upload log - local loghost,logdirprefix = (logtarget or ""):match("(.*):(.*)") - if logfile and loghost and logdirprefix then - local logdir = logdirprefix.."/"..aport:get_repo_name().."/"..aport.pkgname.."/" + local loghost,logdirprefix = (conf.logtarget or ""):match("(.*):(.*)") + if aport.logfile and loghost and logdirprefix then + local logdir = logdirprefix.."/"..hostname.."/"..aport:get_repo_name().."/"..aport.pkgname.."/" run{"ssh", loghost, "mkdir", "-p", logdir} - run{"scp", logfile, loghost..":"..logdir} + run{"scp", aport.logfile, loghost..":"..logdir} + end + + if not conf.mqttbroker then + return end local topic = ("build/%s/errors"):format(hostname) @@ -47,14 +47,15 @@ function m.postbuild(aport, success, repodest, arch, logfile) pkgname = aport.pkgname, hostname = hostname, reponame = aport:get_repo_name(), - logurl = ("%s/%s/%s-%s-r%s.log"):format( - urlprefix, + logurl = ("%s/%s/%s/%s-%s-r%s.log"):format( + conf.logurlprefix or "https://build.alpinelinux.org/buildlogs", + hostname, (string.match(aport.dir,"[^/]+/[^/]+$")), aport.pkgname, aport.pkgver, aport.pkgrel), status = success } end - publish.single(topic, payload, nil, true, "msg.alpinelinux.org") + publish.single(topic, payload, nil, true, conf.mqttbroker) end return m |