summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2018-03-18 13:47:24 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2018-03-18 13:47:24 +0000
commitd802d85375b49ec3ea34dbac3700603097d42128 (patch)
tree70a25f17c79fe192c9b37d2b39b3f137bf6c0c15
parent6c7f4bd03eb244905b827d6f2c780ba7b4aa82ae (diff)
downloadgp-packaging-tools-d802d85375b49ec3ea34dbac3700603097d42128.tar.bz2
Initial version of system branch tooling
-rwxr-xr-xgp-build-sysbranch107
1 files changed, 107 insertions, 0 deletions
diff --git a/gp-build-sysbranch b/gp-build-sysbranch
new file mode 100755
index 0000000..a2f10ad
--- /dev/null
+++ b/gp-build-sysbranch
@@ -0,0 +1,107 @@
+#!/usr/bin/lua5.2
+-- -*- Lua -*-
+
+-- Purpose: Build a system branch of Gitano, testing it along the way.
+-- Wherever the branch isn't available, use master
+--
+-- In order to successfully work, this needs to know all the dependencies
+-- and acquire them all. This list is currently manually configured...
+--
+-- Each will be built in turn, and used when building onward
+
+local ALL_REPOS = {
+ -- Simple ones
+ "luxio", "lua-scrypt", "tongue",
+ -- Ones which might be complex
+ "lace", "clod", "gall", "supple",
+ -- We don't include gitano itself since it's different from
+ -- the rest in terms of build/install.
+}
+
+local repobase = "git://git.gitano.org.uk/"
+
+local branch = ...
+
+print("Preparing workspace for " .. tostring(branch))
+
+print("=> Clearing anything which might have been there before...")
+os.execute("rm -rf " .. branch)
+os.execute("mkdir -p " .. branch)
+
+local used_branch = false
+
+print("=> Cloning all the repos...")
+local function _clone(reponame, branchname)
+ print(" => " .. reponame .. " (" .. branchname .. ")")
+ os.execute("git clone -q -b " .. branchname .. " " .. repobase .. reponame ..
+ ".git " .. branch .. "/" .. reponame)
+end
+
+local function clone(reponame)
+ local hasit = assert(
+ io.popen("git ls-remote --refs " .. repobase ..
+ reponame .. ".git refs/heads/" .. branch, "r")):read("*l")
+ if hasit and hasit ~= "" then
+ _clone(reponame, branch)
+ used_branch = true
+ else
+ _clone(reponame, "master")
+ end
+end
+
+for _, repo in ipairs(ALL_REPOS) do
+ clone(repo)
+end
+clone("gitano")
+
+if not used_branch then
+ print("=> Not continuing, didn't use branch name (" .. branch .. ")")
+ os.exit(1)
+end
+
+print("=> Performing library builds...")
+
+local basedir = assert(io.popen("cd " .. branch .. " && pwd", "r")):read("*l")
+
+local fh = assert(io.open(basedir .. "/init.lua", "w"))
+fh:write([[
+package.path = package.path .. ";]] .. basedir .. [[/inst/share/lua/5.1/?.lua"
+package.cpath = package.cpath .. ";]] .. basedir .. [[/inst/lib/lua/5.1/?.so"
+]])
+fh:close()
+
+local function run_in(reponame, cmd)
+ local bits = {
+ "cd " .. branch .. "/" .. reponame,
+ "&&",
+ "env",
+ "PREFIX=" .. basedir .. "/inst",
+ -- For Luxio
+ "INST_LUADIR='" .. basedir .. "/inst/share/lua/5.1/'",
+ "INST_LIBDIR='" .. basedir .. "/inst/lib/lua/5.1/'",
+ -- For everyone
+ "LUA_INIT='@" .. basedir .. "/init.lua'",
+ cmd,
+ "LUA_VER=5.1",
+ -- For Supple
+ "BAKE_SUPPLE_PATHS='1'",
+ "SUPPLE_LUA_PATH='" .. basedir .. "/inst/share/lua/5.1/?.lua'",
+ "SUPPLE_LUA_CPATH='" .. basedir .. "/inst/lib/lua/5.1/?.so'",
+ }
+ print(" => " .. reponame)
+ local cmd = table.concat(bits, " ")
+ print(cmd)
+ if not os.execute(cmd) then
+ print("FAILED")
+ os.exit(1)
+ end
+end
+
+for _, repo in ipairs(ALL_REPOS) do
+ run_in(repo, "make clean all install")
+end
+
+-- Finally we need to get Gitano to run...
+
+print("=> test gitano")
+run_in("gitano", "make test YARN_ARGS=\"--env LUA_INIT='@" .. basedir .. "/init.lua'\"")