Ported packaging script from Hg to Git

This commit is contained in:
Jason Perkins 2015-04-27 17:32:59 -04:00
parent 6c8162f6ef
commit 3a5b852470
3 changed files with 10 additions and 126 deletions

View File

@ -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 { newaction {
trigger = "test", trigger = "test",
description = "Run the automated test suite", description = "Run the automated test suite",

View File

@ -40,7 +40,7 @@
-- Make sure I've got what I've need to be happy. -- 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 for _, value in ipairs(required) do
local z = execQuiet("%s --version", value) local z = execQuiet("%s --version", value)
if z ~= 0 then if z ~= 0 then
@ -54,7 +54,7 @@
-- --
os.chdir("..") 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 _, _, version = text:find('VERSION%s*"([%w%p]+)"')
local pkgName = "premake-" .. version local pkgName = "premake-" .. version
@ -88,18 +88,24 @@
os.rmdir(pkgName) os.rmdir(pkgName)
print("Cloning source code") 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 if z ~= 0 then
error("clone failed", 0) error("clone failed", 0)
end 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 -- Make absolutely sure the embedded scripts have been updated
-- --
print("Updating embedded scripts...") print("Updating embedded scripts...")
os.chdir(pkgName)
z = execQuiet("premake5 embed") z = execQuiet("premake5 embed")
if z ~= 0 then if z ~= 0 then
error("failed to update the embedded scripts", 0) error("failed to update the embedded scripts", 0)

View File

@ -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 <version>\n' ..
' <version> is of the form "5.0", "5.0.1", or "5.0-rc1"\n'
local usage = 'usage is: release <version>\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")