From: Gordon Hecker Date: Tue, 28 Apr 2009 15:15:29 +0000 (+0200) Subject: support installing local extensions X-Git-Tag: e2factory-2.3.1pre1~31 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=8d0e3a27f3010e51b454acd0af0a570d95f022a1;p=e2factory.git support installing local extensions Signed-off-by: Gordon Hecker --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index cdefb9c..9f8bc59 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -826,7 +826,7 @@ function e2lib.use_global_config() assert_type(config.site.e2_branch, "config.site.e2_branch", "string") assert_type(config.site.e2_tag, "config.site.e2_tag", "string") assert_type(config.site.e2_server, "config.site.e2_server", "string") - assert_type(config.site.e2_location, "config.site.e2_location", "string") + assert_type(config.site.e2_base, "config.site.e2_base", "string") end --- get the global configuration diff --git a/global/e2-install-e2.lua.in b/global/e2-install-e2.lua.in index 347aa6f..80cfaa4 100755 --- a/global/e2-install-e2.lua.in +++ b/global/e2-install-e2.lua.in @@ -125,32 +125,57 @@ if not rc then e2lib.abort(e:cat(re)) end --- clone e2 -local server = config.site.e2_server -local location = config.site.e2_location -local destdir = "e2" -local skip_checkout = false -rc, re = generic_git.git_clone_from_server(scache, server, location, destdir, - skip_checkout) -if not rc then - e2lib.abort(e:cat(re)) +local _ext = {} +local extensions = {} +-- 'e2factory' is handled like any other extension, but enabled by default +_ext["e2factory"] = true +exf = io.open("extensions", "r") +if exf then + for ex in exf:lines() do + _ext[ex] = true + end + exf:close() end - -e2lib.chdir(destdir) - --- checkout ref -local args = string.format("--track -b tmp '%s'", ref) -rc, re = e2lib.git(nil, "checkout", args) -if not rc then - e2lib.abort(e:cat(re)) +for ex,_ in pairs(_ext) do + table.insert(extensions, ex) end --- build and install -local cmd = string.format("make PREFIX='%s' local install-local", +for _,ex in ipairs(extensions) do + -- change to the project root directory + rc, re = e2lib.chdir(root .. "/.e2") + if not rc then + e2lib.abort(e:cat(re)) + end + print("installing extension: " .. ex) + local server = config.site.e2_server + local location = string.format("%s/%s.git", config.site.e2_base, ex) + local destdir = ex + local skip_checkout = false + rc, re = e2lib.rm(destdir, "-r") + if not rc then + e2lib.abort(e:cat(re)) + end + rc, re = generic_git.git_clone_from_server(scache, server, location, + destdir, skip_checkout) + if not rc then + e2lib.abort(e:cat(re)) + end + e2lib.chdir(destdir) + + -- checkout ref + local args = string.format("--track -b tmp '%s'", ref) + rc, re = e2lib.git(nil, "checkout", args) + if not rc then + e2lib.abort(e:cat(re)) + end + + -- build and install + local cmd = string.format("make PREFIX='%s' local install-local", install_prefix) -rc, re = e2lib.callcmd_capture(cmd) -if not rc then - e2lib.abort(e:cat(re)) + rc, re = e2lib.callcmd_capture(cmd) + if not rc then + e2lib.abort(e:cat(re)) + end end e2lib.finish() diff --git a/global/e2.conf.in b/global/e2.conf.in index 312c481..c0459c0 100644 --- a/global/e2.conf.in +++ b/global/e2.conf.in @@ -7,6 +7,7 @@ config { site = { e2_server = "projects", e2_location = "e2factory.git", + e2_base = "." e2_branch = "e2factory-2.3", e2_tag = "e2factory-2.3.0", },