From 3a5b852470e1dd7ea40ec5efa0c85c3ca9ae315d Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 27 Apr 2015 17:32:59 -0400 Subject: [PATCH] Ported packaging script from Hg to Git --- premake5.lua | 9 ---- scripts/package.lua | 14 ++++-- scripts/release.lua | 113 -------------------------------------------- 3 files changed, 10 insertions(+), 126 deletions(-) delete mode 100644 scripts/release.lua diff --git a/premake5.lua b/premake5.lua index 88e1f2ba..f6ceaa43 100644 --- a/premake5.lua +++ b/premake5.lua @@ -41,15 +41,6 @@ } - newaction { - trigger = "release", - description = "Merges current branch to release; updates version and tags", - execute = function () - include (path.join(corePath, "scripts/release.lua")) - end - } - - newaction { trigger = "test", description = "Run the automated test suite", diff --git a/scripts/package.lua b/scripts/package.lua index c0f0cd57..3f433ae8 100644 --- a/scripts/package.lua +++ b/scripts/package.lua @@ -40,7 +40,7 @@ -- Make sure I've got what I've need to be happy. -- - local required = { "hg", "make", "gcc", "premake5", "zip" } + local required = { "git", "make", "gcc", "premake5", "zip" } for _, value in ipairs(required) do local z = execQuiet("%s --version", value) if z ~= 0 then @@ -54,7 +54,7 @@ -- os.chdir("..") - local text = os.outputof(string.format('hg cat -r %s src/host/premake.c', branch)) + local text = os.outputof(string.format('git show %s:src/host/premake.c', branch)) local _, _, version = text:find('VERSION%s*"([%w%p]+)"') local pkgName = "premake-" .. version @@ -88,18 +88,24 @@ os.rmdir(pkgName) print("Cloning source code") - z = os.executef("hg clone .. -r %s %s", branch, pkgName) + z = os.executef("git clone .. %s", pkgName) if z ~= 0 then error("clone failed", 0) end + os.chdir(pkgName) + + z = os.executef("git checkout %s", branch) + if z ~= 0 then + error("unable to checkout branch " .. branch, 0) + end + -- -- Make absolutely sure the embedded scripts have been updated -- print("Updating embedded scripts...") - os.chdir(pkgName) z = execQuiet("premake5 embed") if z ~= 0 then error("failed to update the embedded scripts", 0) diff --git a/scripts/release.lua b/scripts/release.lua deleted file mode 100644 index 3f523204..00000000 --- a/scripts/release.lua +++ /dev/null @@ -1,113 +0,0 @@ --- --- Merge the current working branch to Premake's release branch, --- update the embedded version number and tag the result. --- - - --- --- Helper function: run a command while hiding its output. --- - - local function execQuiet(cmd, ...) - cmd = string.format(cmd, unpack(arg)) .. " > _output_.log 2> _error_.log" - local z = os.execute(cmd) - os.remove("_output_.log") - os.remove("_error_.log") - return z - end - - --- --- Check the command line arguments, and show some help if needed. --- - - local usage = 'usage is: release \n' .. - ' is of the form "5.0", "5.0.1", or "5.0-rc1"\n' - - local usage = 'usage is: release \n' - if #_ARGS ~= 1 then - error(usage, 0) - end - - local version = _ARGS[1] - - --- --- Make sure I've got what I've need to be happy. --- - - local required = { "hg" } - for _, value in ipairs(required) do - local z = execQuiet("%s --version", value) - if z ~= 0 then - error("required tool '" .. value .. "' not found", 0) - end - end - - --- --- Figure out what I'm doing. --- - - os.chdir("..") - local branch = os.outputof("hg branch"):gsub("%s+$", "") - - --- --- Make sure I'm sure. --- - - printf("") - printf("I am about to") - printf(" ...merge %s to the release branch", branchName) - printf(" ...update the embedded version to \"%s\"", version) - printf(" ...commit and tag the merged result") - printf("") - printf("Does this look right to you? If so, press [Enter] to begin.") - io.read() - - --- --- Pull down the release branch. --- - - print("Preparing release folder") - - os.mkdir("release") - os.chdir("release") - os.rmdir(version) - - print("Cloning source code") - local z = os.executef("hg clone .. -r release %s", branch, version) - if z ~= 0 then - error("clone failed", 0) - end - - --- --- Merge in the release working branch. --- - - error("merge of release working branch is not yet implemented") - - --- --- Update the version number in premake.c --- - - print("Updating version number...") - - os.chdir(version) - io.input("src/host/premake.c") - local text = io.read("*a") - text = text:gsub("HEAD", version) - io.output("src/host/premake.c") - io.write(text) - io.close() - - --- --- Commit and tag merged revision. --- - - error("commit and tag of merged branch is not yet implemented")