From 7180a2a41e66b3f4a4a78b84b60ea9ccf65f01ff Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Tue, 23 Jun 2009 11:44:26 +0200 Subject: [PATCH] fix e2-install-e2 to install branches properly Signed-off-by: Gordon Hecker --- Changelog | 1 + doc/manual/basic.text | 4 +++- global/e2-install-e2.lua.in | 20 ++++++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Changelog b/Changelog index f037406..dc6b4aa 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ NEXT: * temporary build directories are located in a version specific directory now + * e2-install-e2 installs branches properly now. Git refs can be specified. e2factory-2.3.1 * bugfixes diff --git a/doc/manual/basic.text b/doc/manual/basic.text index 53d1273..305fb05 100644 --- a/doc/manual/basic.text +++ b/doc/manual/basic.text @@ -25,7 +25,9 @@ Example: 2_3_0 -.e2/extensions holds a table specifying a list of extensions. +.e2/extensions holds a table specifying a list of extensions. The ref +must be a valid git ref. If the string has a '/' the ref is passed to +git as-is, otherwise it is translated into a tag by prepending 'refs/tags/' Example: diff --git a/global/e2-install-e2.lua.in b/global/e2-install-e2.lua.in index bc3fe1f..b7f2ab9 100755 --- a/global/e2-install-e2.lua.in +++ b/global/e2-install-e2.lua.in @@ -122,7 +122,11 @@ end local ref if tag == "^" then e2lib.warnf("WOTHER", "using e2 version by branch") - ref = string.format("refs/heads/%s", branch) + if branch:match("/") then + ref = branch + else + ref = string.format("remotes/origin/%s", branch) + end else ref = string.format("refs/tags/%s", tag) end @@ -146,8 +150,7 @@ end e2lib.chdir(destdir) -- checkout ref -local args = string.format("--track -b tmp '%s'", ref) -rc, re = e2lib.git(nil, "checkout", args) +rc, re = e2lib.git(nil, "checkout", ref) if not rc then e2lib.abort(e:cat(re)) end @@ -158,7 +161,13 @@ for _,ex in ipairs(extensions) do if not rc then e2lib.abort(e:cat(re)) end - e2lib.logf(2, "fetching extension: %s (tag %s)", ex.name, ex.ref) + local ref + if ex.ref:match("/") then + ref = ex.ref + else + ref = string.format("refs/tags/%s", ex.ref) + end + e2lib.logf(2, "fetching extension: %s (%s)", ex.name, ref) local server = config.site.e2_server local location = string.format("%s/%s.git", config.site.e2_base, ex.name) local destdir = ex.name @@ -175,8 +184,7 @@ for _,ex in ipairs(extensions) do e2lib.chdir(destdir) -- checkout ref - local args = string.format("--track -b tmp '%s'", ex.ref) - rc, re = e2lib.git(nil, "checkout", args) + rc, re = e2lib.git(nil, "checkout", ref) if not rc then e2lib.abort(e:cat(re)) end -- 2.39.5