From c5c610b0853821a8ba824ff7a96d3bfc5d8562e7 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 20 Apr 2016 09:07:15 +0300 Subject: build-pkg, second pass: fix fail on broken package If a package is found to be broken on the first pass, then prev_files = nil, because this structure is filled only for non-broken packages. See https://github.com/mxe/mxe/pull/1243#issuecomment-211137555 --- tools/build-pkg.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 56b1aaa..0af1d33 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -602,13 +602,15 @@ local function prepareTree(pass, item, item2deps, prev_files, item2index) item2index, 'first' ) - -- Remove files of item from previous build. - for _, file in ipairs(prev_files) do - os.remove(file) - end removeEmptyDirs() - gitAdd() - gitCommit(("Remove %s to rebuild it"):format(item, pass)) + if prev_files then + -- Remove files of item from previous build. + for _, file in ipairs(prev_files) do + os.remove(file) + end + gitAdd() + gitCommit(("Remove %s to rebuild it"):format(item, pass)) + end else error("Unknown pass: " .. pass) end -- cgit v0.12