diff options
authorNatanael Copa <>2019-01-09 12:56:51 +0000
committerNatanael Copa <>2019-01-09 13:50:35 +0000
commit8b67cf79d9da6331b512b9e4504522bcc5eb08e8 (patch)
parentc0db4733641302439c7384e3654d3df575c1a1ce (diff)
buildrepo: refactor plugin API
simplify the args passed to plugin hooks: prerepo(conf, repo, stats) prebuild(conf, aport, progress) postbuild(conf, aport, success) postrepo(conf, repo, stats) By passing over conf we reduce number of args passed to hook function and we make it possible to set config options in /etc/buildrepo/config.lua that is passed on to the hook. This is useful for setting things like mqtt broker, url prefix for buildlogs and similar.
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/buildrepo.lua b/bin/buildrepo.lua
index e633baa..296f56b 100755
--- a/bin/buildrepo.lua
+++ b/bin/buildrepo.lua
@@ -191,7 +191,7 @@ for _, repo in pairs(args) do
stats[repo].total_aports = total_aports
-- run prerepo hooks
- plugins_prerepo(repo, conf.aportsdir, conf.repodest, abuild.arch, stats[repo], opts)
+ plugins_prerepo(conf, repo, stats[repo])
-- find out what needs to be built
for aport in db:each_need_build() do
@@ -218,9 +218,9 @@ for _, repo in pairs(args) do
warn("%s: Skipped due to missing dependencies", aport.pkgname)
elseif not (opts.s and skip_aport(aport)) then
log_progress(progress, repo, aport)
- plugins_prebuild(aport, progress, conf.repodest, abuild.arch, aport.logfile, opts)
+ plugins_prebuild(conf, aport, progress)
local success = build_aport(aport, conf.repodest, aport.logfile, opts.R)
- plugins_postbuild(aport, success, conf.repodest, abuild.arch, aport.logfile, opts)
+ plugins_postbuild(conf, aport, success)
if success then
built = built + 1
@@ -261,7 +261,7 @@ for _, repo in pairs(args) do
stats[repo].time = os.clock() - start_time
-- run portrepo hooks
- plugins_postrepo(repo, conf.aportsdir, conf.repodest, abuild.arch, stats[repo], opts)
+ plugins_postrepo(conf, repo, stats[repo])
for repo, stat in pairs(stats) do