summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Nagaev <bnagaev@gmail.com>2016-02-15 05:53:48 (GMT)
committerBoris Nagaev <bnagaev@gmail.com>2016-04-20 20:35:13 (GMT)
commit1a1c1ebf00162d7549fd7ff07c7b776c5221b73b (patch)
treeba2a3ac0648571fbed59e51600250a93a5df4025
parent2b397e0bedf4b68d7d1861a866276c7b10e5a689 (diff)
downloadmxe-1a1c1ebf00162d7549fd7ff07c7b776c5221b73b.zip
mxe-1a1c1ebf00162d7549fd7ff07c7b776c5221b73b.tar.gz
mxe-1a1c1ebf00162d7549fd7ff07c7b776c5221b73b.tar.bz2
build-pkg: move top-level code to main() function
-rwxr-xr-xtools/build-pkg.lua68
1 files changed, 36 insertions, 32 deletions
diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua
index d087031..4f16d0b 100755
--- a/tools/build-pkg.lua
+++ b/tools/build-pkg.lua
@@ -917,36 +917,40 @@ local function makeMxeSourcePackage()
makePackage(name, files, deps, ver, d1, d2)
end
-assert(not io.open('usr/.git'), 'Remove usr/')
-local MXE_DIR_EXPECTED = '/usr/lib/mxe'
-if MXE_DIR ~= MXE_DIR_EXPECTED then
- log("Warning! Building in dir %s, not in %s",
- MXE_DIR, MXE_DIR_EXPECTED)
-end
-gitInit()
-assert(execute(("%s check-requirements MXE_TARGETS=%q"):format(
- tool 'make', table.concat(TARGETS, ' '))))
-if not max_items then
- local cmd = ('%s download -j 6 -k'):format(tool 'make')
- while not execute(cmd) do end
-end
-gitAdd()
-gitCommit('Initial commit')
-gitTag(GIT_INITIAL)
-local items, item2deps, item2ver = getItems()
-local build_list = sortForBuild(items, item2deps)
-assert(isTopoOrdered(build_list, items, item2deps))
-build_list = sliceArray(build_list, max_items)
-local unbroken, item2files = buildPackages(build_list, item2deps)
-gitCheckout(GIT_ALL, unbroken, makeItem2Index(build_list))
-makeDebs(unbroken, item2deps, item2ver, item2files)
-if not no_debs then
- makeMxeRequirementsPackage('wheezy')
- makeMxeRequirementsPackage('jessie')
-end
-makeMxeSourcePackage()
-if #unbroken < #build_list then
- local code = 1
- local close = true
- os.exit(code, close)
+local function main()
+ assert(not io.open('usr/.git'), 'Remove usr/')
+ local MXE_DIR_EXPECTED = '/usr/lib/mxe'
+ if MXE_DIR ~= MXE_DIR_EXPECTED then
+ log("Warning! Building in dir %s, not in %s",
+ MXE_DIR, MXE_DIR_EXPECTED)
+ end
+ gitInit()
+ assert(execute(("%s check-requirements MXE_TARGETS=%q"):format(
+ tool 'make', table.concat(TARGETS, ' '))))
+ if not max_items then
+ local cmd = ('%s download -j 6 -k'):format(tool 'make')
+ while not execute(cmd) do end
+ end
+ gitAdd()
+ gitCommit('Initial commit')
+ gitTag(GIT_INITIAL)
+ local items, item2deps, item2ver = getItems()
+ local build_list = sortForBuild(items, item2deps)
+ assert(isTopoOrdered(build_list, items, item2deps))
+ build_list = sliceArray(build_list, max_items)
+ local unbroken, item2files = buildPackages(build_list, item2deps)
+ gitCheckout(GIT_ALL, unbroken, makeItem2Index(build_list))
+ makeDebs(unbroken, item2deps, item2ver, item2files)
+ if not no_debs then
+ makeMxeRequirementsPackage('wheezy')
+ makeMxeRequirementsPackage('jessie')
+ end
+ makeMxeSourcePackage()
+ if #unbroken < #build_list then
+ local code = 1
+ local close = true
+ os.exit(code, close)
+ end
end
+
+main()