From 8b67cf79d9da6331b512b9e4504522bcc5eb08e8 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 9 Jan 2019 12:56:51 +0000 Subject: 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. --- bin/buildrepo.lua | 8 ++++---- 1 file 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 end @@ -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]) end for repo, stat in pairs(stats) do -- cgit v1.2.3