summaryrefslogtreecommitdiffstats
path: root/buildrepo.lua
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-01-24 09:42:08 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-01-24 09:42:08 +0000
commit7fa77aa695e2a3e618cff50df0e4e0a4dc5cefc5 (patch)
tree9db5a8729d7d009d6e993bc785fd25b940c02ff4 /buildrepo.lua
parentfccce8fb522b156df704e3e62420d70127d57685 (diff)
downloadlua-aports-7fa77aa695e2a3e618cff50df0e4e0a4dc5cefc5.tar.bz2
lua-aports-7fa77aa695e2a3e618cff50df0e4e0a4dc5cefc5.tar.xz
buildrepo: compare timestamp with APKBUILD when decide to skip build
We compare if APKBUILD is newer than src/ dir to decide if we should try build the aport or skip it.
Diffstat (limited to 'buildrepo.lua')
-rwxr-xr-xbuildrepo.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/buildrepo.lua b/buildrepo.lua
index d7d14f3..f9670c7 100755
--- a/buildrepo.lua
+++ b/buildrepo.lua
@@ -55,14 +55,26 @@ local function parse_opts(opthelp, raw_args)
return opts, args
end
+local function skip_aport(aport)
+ local dirattr = lfs.attributes(aport.dir.."/src/")
+ local fileattr = lfs.attributes(aport.dir.."/APKBUILD")
+ if not dirattr or not fileattr then
+ return false
+ end
+ if os.difftime(fileattr.modification, dirattr.modification) > 0 then
+ return false
+ end
+ warn("%s: Skipped due to previous build failure", aport.pkgname)
+ return true
+end
+
local function build_aport(aport, repodest, logdir, skip_failed)
local success, errmsg = lfs.chdir(aport.dir)
if not success then
err("%s", errmsg)
return nil
end
- if skip_failed and lfs.attributes(aport.dir.."/src/") then
- warn("%s: Skipped due to previous build failure", aport.pkgname)
+ if skip_failed and skip_aport(aport) then
return nil
end
local log