From 7fa77aa695e2a3e618cff50df0e4e0a4dc5cefc5 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 24 Jan 2014 09:42:08 +0000 Subject: 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. --- buildrepo.lua | 16 ++++++++++++++-- 1 file 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 -- cgit v1.2.3