diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-01 11:46:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-01 11:47:25 +0000 |
commit | 7bab5142ee01178cdc6e5ef25a7dce48a8f68488 (patch) | |
tree | dd146d32f7c8ddf8e06c2d86b96be636ace713c0 /main/lua-aports | |
parent | f9e00b1a201a80dd46f66d570f3b90d0b2c78de1 (diff) | |
download | aports-7bab5142ee01178cdc6e5ef25a7dce48a8f68488.tar.bz2 aports-7bab5142ee01178cdc6e5ef25a7dce48a8f68488.tar.xz |
main/lua-aports: upgrade to 0.5
Diffstat (limited to 'main/lua-aports')
-rw-r--r-- | main/lua-aports/0001-buildrepo-add-support-for-plugins.d.patch | 85 | ||||
-rw-r--r-- | main/lua-aports/0002-buildrepo-refactor.patch | 148 | ||||
-rw-r--r-- | main/lua-aports/APKBUILD | 22 | ||||
-rw-r--r-- | main/lua-aports/update-index.patch | 13 |
4 files changed, 5 insertions, 263 deletions
diff --git a/main/lua-aports/0001-buildrepo-add-support-for-plugins.d.patch b/main/lua-aports/0001-buildrepo-add-support-for-plugins.d.patch deleted file mode 100644 index d7c78e1e85..0000000000 --- a/main/lua-aports/0001-buildrepo-add-support-for-plugins.d.patch +++ /dev/null @@ -1,85 +0,0 @@ -From ace87a06e5782b6f7f2235094f32847fe836ea15 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Wed, 22 Jul 2015 15:57:35 +0200 -Subject: [PATCH 1/2] buildrepo: add support for plugins.d - -Make it possible to add hooks that are execute pre and post build. - -This can be used for posting build error messages, copying build logs -etc. ---- - buildrepo.lua | 34 +++++++++++++++++++++++++++++----- - 1 file changed, 29 insertions(+), 5 deletions(-) - -diff --git a/buildrepo.lua b/buildrepo.lua -index bc0a784..4fb9f12 100755 ---- a/buildrepo.lua -+++ b/buildrepo.lua -@@ -4,6 +4,8 @@ local abuild = require("aports.abuild") - local apkrepo = require("aports.apkrepo") - local lfs = require("lfs") - -+local pluginsdir = "/etc/buildrepo/plugins.d" -+ - local function warn(formatstr, ...) - io.stderr:write(("WARNING: %s\n"):format(formatstr:format(...))) - io.stderr:flush() -@@ -75,6 +77,26 @@ local function skip_aport(aport) - return true - end - -+local function run_plugins(dirpath, func, ...) -+ local a = lfs.attributes(dirpath) -+ if a == nil or a.mode ~= "directory" then -+ return -+ end -+ local flist = {} -+ for f in lfs.dir(dirpath) do -+ if string.match(f, ".lua$") then -+ table.insert(flist, f) -+ end -+ end -+ table.sort(flist) -+ for i = 1,#flist do -+ local m = dofile(dirpath.."/"..flist[i]) -+ if type(m[func]) == "function" then -+ m[func](...) -+ end -+ end -+end -+ - local function build_aport(aport, repodest, logdir) - local success, errmsg = lfs.chdir(aport.dir) - if not success then -@@ -92,10 +114,16 @@ local function build_aport(aport, repodest, logdir) - logredirect = ("> '%s' 2>&1"):format(logfile) - end - local cmd = ("REPODEST='%s' abuild -r -m %s"):format(repodest, logredirect) -- success = os.execute(cmd) -+ run_plugins(pluginsdir, "prebuild", aport, logfile) -+ if opts.n then -+ success = true -+ else -+ success = os.execute(cmd) -+ end - if not success then - err("%s: Failed to build", aport.pkgname) - end -+ run_plugins(pluginsdir, "postbuild", aport, success, logfile) - return success - end - -@@ -136,10 +164,6 @@ aportsdir = opts.a or ("%s/aports"):format(homedir) - repodest = opts.d or abuild.repodest or ("%s/packages"):format(homedir) - logdirbase = opts.l - --if opts.n then -- build_aport = function() return true end --end -- - stats = {} - for _,repo in pairs(args) do - local db = require('aports.db').new(aportsdir, repo) --- -2.4.6 - diff --git a/main/lua-aports/0002-buildrepo-refactor.patch b/main/lua-aports/0002-buildrepo-refactor.patch deleted file mode 100644 index c140e8d83d..0000000000 --- a/main/lua-aports/0002-buildrepo-refactor.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 62478e8dc18cac0ffc3d30917f057b1d1d75f9f0 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Wed, 22 Jul 2015 17:00:31 +0200 -Subject: [PATCH 2/2] buildrepo: refactor - -- pass logfile directly to build_aport -- run the plugin hooks from loop -- pass progress status to prebuild plugins ---- - buildrepo.lua | 84 +++++++++++++++++++++++++++++++++++------------------------ - 1 file changed, 50 insertions(+), 34 deletions(-) - -diff --git a/buildrepo.lua b/buildrepo.lua -index 4fb9f12..5c4b931 100755 ---- a/buildrepo.lua -+++ b/buildrepo.lua -@@ -97,36 +97,54 @@ local function run_plugins(dirpath, func, ...) - end - end - --local function build_aport(aport, repodest, logdir) -+local function plugins_prebuild(...) -+ return run_plugins(pluginsdir, "prebuild", ...) -+end -+ -+local function plugins_postbuild(...) -+ return run_plugins(pluginsdir, "postbuild", ...) -+end -+ -+local function logfile_path(logdirbase, repo, aport) -+ if logdirbase == nil then -+ return nil -+ end -+ local dir = ("%s/%s/%s"):format(logdirbase, repo, aport.pkgname) -+ if not lfs.attributes(dir) then -+ local path = "" -+ for n in string.gmatch(dir, "[^/]+") do -+ path = path.."/"..n -+ lfs.mkdir(path) -+ end -+ end -+ return ("%s/%s-%s-r%s.log"):format(dir, aport.pkgname, aport.pkgver, aport.pkgrel) -+end -+ -+ -+local function build_aport(aport, repodest, logfile) - local success, errmsg = lfs.chdir(aport.dir) - if not success then - err("%s", errmsg) - return nil - end - local logredirect = "" -- if logdir ~= nil then -- local dir = ("%s/%s"):format(logdir, aport.pkgname) -- if not lfs.attributes(dir) then -- assert(lfs.mkdir(dir), dir) -- end -- local logfile = ("%s/%s-%s-r%s.log"):format(dir, aport.pkgname, aport.pkgver, aport.pkgrel) -- -+ if logfile ~= nil then - logredirect = ("> '%s' 2>&1"):format(logfile) - end - local cmd = ("REPODEST='%s' abuild -r -m %s"):format(repodest, logredirect) -- run_plugins(pluginsdir, "prebuild", aport, logfile) -- if opts.n then -- success = true -- else -- success = os.execute(cmd) -- end -+ success = os.execute(cmd) - if not success then - err("%s: Failed to build", aport.pkgname) - end -- run_plugins(pluginsdir, "postbuild", aport, success, logfile) - return success - end - -+local function log_progress(progress, repo, aport) -+ info("%d/%d %d/%d %s/%s %s-r%s", -+ progress.tried, progress.total, -+ progress.repo_built, progress.repo_total, -+ repo, aport.pkgname, aport.pkgver, aport.pkgrel) -+end - ----------------------------------------------------------------- - local opthelp = [[ - -a DIR Set the aports base dir to DIR instead of $HOME/aports -@@ -164,6 +182,10 @@ aportsdir = opts.a or ("%s/aports"):format(homedir) - repodest = opts.d or abuild.repodest or ("%s/packages"):format(homedir) - logdirbase = opts.l - -+if opts.n then -+ build_aport = function() return true end -+end -+ - stats = {} - for _,repo in pairs(args) do - local db = require('aports.db').new(aportsdir, repo) -@@ -199,34 +221,28 @@ for _,repo in pairs(args) do - unsorted[aport.pkgname] = true - end - -- if logdirbase ~= nil then -- logdir = ("%s/%s"):format(logdirbase, repo) -- if not lfs.attributes(logdir) then -- assert(lfs.mkdir(logdir), logdir) -- end -- end -- - -- build packages - local built = 0 - local tried = 0 - for aport in db:each_in_build_order(pkgs) do -+ local logfile = logfile_path(logdirbase, repo, aport) - tried = tried + 1 -- local totally_built = stats[repo].relevant_aports - #pkgs + built -+ local progress = { tried = tried, total = #pkgs, -+ repo_built = stats[repo].relevant_aports - #pkgs + built, -+ repo_total = stats[repo].relevant_aports, -+ } - if not db:known_deps_exists(aport) then - warn("%s: Skipped due to missing dependencies", aport.pkgname) - elseif not (opts.s and skip_aport(aport)) then -- info("%d/%d %d/%d %s/%s %s-r%s", -- tried, #pkgs, -- totally_built, -- stats[repo].relevant_aports, -- repo, aport.pkgname, -- aport.pkgver, aport.pkgrel) -- if build_aport(aport, repodest, logdir) then -+ log_progress(progress, repo, aport) -+ plugins_prebuild(aport, progress, logfile) -+ local success = build_aport(aport, repodest, logfile) -+ plugins_postbuild(aport, success, logfile) -+ if success then - built = built + 1 -- else -- if not opts.k then -- os.exit(1) -- end -+ end -+ if not success and not opts.k then -+ os.exit(1) - end - end - end --- -2.4.6 - diff --git a/main/lua-aports/APKBUILD b/main/lua-aports/APKBUILD index 14d001af4f..97f15c00c0 100644 --- a/main/lua-aports/APKBUILD +++ b/main/lua-aports/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=lua-aports -pkgver=0.4 -pkgrel=2 +pkgver=0.5 +pkgrel=0 pkgdesc="Lua modules for parsing aports tree" url="http://dev.alpinelinux.org/archive/lua-aports/" arch="noarch" @@ -13,9 +13,6 @@ install="" replaces="abuild" subpackages="" source="http://dev.alpinelinux.org/archive/lua-aports/lua-aports-$pkgver.tar.xz - 0001-buildrepo-add-support-for-plugins.d.patch - 0002-buildrepo-refactor.patch - update-index.patch " _builddir="$srcdir"/lua-aports-$pkgver @@ -38,15 +35,6 @@ package() { make DESTDIR="$pkgdir" install || return 1 } -md5sums="61abfaedf5d7599d1322e62029b24a3e lua-aports-0.4.tar.xz -400c3f87e3bfc0cece732ccc7273ab15 0001-buildrepo-add-support-for-plugins.d.patch -45f3610919c1bddea841d4c91bccb3de 0002-buildrepo-refactor.patch -c5994a11f98774a5d804f6710474104e update-index.patch" -sha256sums="b29670416a476fd390083b1b013c099c727e1c4e56171cc5f7ab767dcf41aacc lua-aports-0.4.tar.xz -fbee2b352b8a353b4f904a26cc311cc60f79eaa6b1202566a6c311e4c2bb4144 0001-buildrepo-add-support-for-plugins.d.patch -99f971b242b283beea788d3d31d48b5143c1e134ae448c2bf7303b595159c6cf 0002-buildrepo-refactor.patch -c4f7701cdccff92775f5561397a521abf627d245f511abdfbf7f144111f33f3e update-index.patch" -sha512sums="06571ce33872d846c8a72d31c8b8e86ce1824f3ae39875c4fe7dfcc6f69968ebb53b4ce4cf7349a1a717be2572dcea1b79f06d90d03f9fef88cc06703b830273 lua-aports-0.4.tar.xz -0d1bb484c6281b61e1e5b8862b7f73f1f2da9d4bc77260309f8bbd6a9ffd8c733424d42c194593a7434209277284dcf0bf8bea07d6b083df371b462e131cd3c9 0001-buildrepo-add-support-for-plugins.d.patch -0af8a5ed6b57b8d72c4ec3715c02d3d47dc9bf7a88da665b15e2f7cabbe81e8d3b871acea28e85a962c1b2872e921efadb72674f71ef7a8a0ba7d9e5834bb11e 0002-buildrepo-refactor.patch -f8e9c0e50853bf144ac345bab8fdf12ea669162b8555202d3ca63ad6520bb5360bb40f74f65ea3750abec49290d4e54f125bc88df057a99aef749c5cdd32bc79 update-index.patch" +md5sums="068ddedda0968d3e000637d2db8da4cd lua-aports-0.5.tar.xz" +sha256sums="fb7ff16a884ed17f6856dc241ec17f0d1586f6d07b83dc5aebc1b320b772d4a9 lua-aports-0.5.tar.xz" +sha512sums="7047f0c902c8f65e8a45ed221e793dd0a0c8abf77f85b21b2d23c4f3c19ab12d9862565615718223ff2633465b85026f260bba4d5851a898475974c93f40797d lua-aports-0.5.tar.xz" diff --git a/main/lua-aports/update-index.patch b/main/lua-aports/update-index.patch deleted file mode 100644 index 40764fdfa8..0000000000 --- a/main/lua-aports/update-index.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/buildrepo.lua b/buildrepo.lua -index bc0a784..498d6c3 100755 ---- a/buildrepo.lua -+++ b/buildrepo.lua -@@ -227,7 +227,7 @@ for _,repo in pairs(args) do - end - - -- generate new apkindex -- if not opts.n then -+ if not opts.n and built > 0 then - info("Updating apk index") - apkrepo.update_index(("%s/%s"):format(repodest, repo), - abuild.arch, db:git_describe()) |