]> git.e2factory.org Git - e2factory.git/commitdiff
support installing local extensions
authorGordon Hecker <gh@emlix.com>
Tue, 28 Apr 2009 15:15:29 +0000 (17:15 +0200)
committerGordon Hecker <gh@emlix.com>
Tue, 5 May 2009 15:08:06 +0000 (17:08 +0200)
Signed-off-by: Gordon Hecker <gh@emlix.com>
generic/e2lib.lua
global/e2-install-e2.lua.in
global/e2.conf.in

index cdefb9c4c09c92026c8c89db68786f9b4342862f..9f8bc59848e5f21b5258e1fcbb3bc9f4ee84e329 100644 (file)
@@ -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
index 347aa6f20b21cc2a7e6e77985457021587f171c6..80cfaa45e3ae63bd11b08b9ffa08a9d4ea937b10 100755 (executable)
@@ -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()
index 312c48139f980c4a499911cea60e7a95f35e163e..c0459c09d339fa741a3fc48a6585146db7c0eb5f 100644 (file)
@@ -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",
        },