-
Notifications
You must be signed in to change notification settings - Fork 199
/
check-release.lua
59 lines (53 loc) · 1.63 KB
/
check-release.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- basic check for release readiness
--[====[
devel/check-release
===================
Basic checks for release readiness
]====]
local ok = true
function err(s)
dfhack.printerr(s)
ok = false
end
function warn(s)
dfhack.color(COLOR_YELLOW)
dfhack.print(s .. '\n')
dfhack.color(nil)
end
local dfhack_ver = dfhack.getDFHackVersion()
local git_desc = dfhack.getGitDescription()
local git_commit = dfhack.getGitCommit()
if not dfhack.isRelease() then
err('This build is not tagged as a release')
print[[
This is probably due to missing git tags.
Try running `git fetch origin --tags` in the DFHack source tree.
]]
end
local expected_git_desc = ('%s-0-g%s'):format(dfhack_ver, git_commit:sub(1, 8))
if git_desc:sub(1, #expected_git_desc) ~= expected_git_desc then
err(([[Bad git description:
Expected %s, got %s]]):format(expected_git_desc, git_desc))
print[[
Ensure that the DFHack source tree is up-to-date (`git pull`) and CMake is
installing DFHack to this DF folder.
]]
end
if not dfhack.gitXmlMatch() then
err('library/xml submodule commit does not match tracked commit\n' ..
('Expected %s, got %s'):format(
dfhack.getGitXmlExpectedCommit():sub(1, 7),
dfhack.getGitXmlCommit():sub(1, 7)
))
print('Try running `git submodule update` in the DFHack source tree.')
end
if dfhack.isPrerelease() then
warn('This build is marked as a prerelease.')
print('If this is not intentional, be sure your DFHack tree is up-to-date\n' ..
'(`git pull`) and try again.')
end
if not ok then
err('This build is not release-ready!')
else
print('Release checks succeeded')
end