aboutsummaryrefslogtreecommitdiff
path: root/scripts/evil-release-stable
blob: e573d17f8c0f6b53300eca004a49752672c8046e (plain)
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
#!/usr/bin/env ruby

# Copyright (c) 2015 Frank Fischer <frank-fischer@shadow-soft.de>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see  <http://www.gnu.org/licenses/>


# This script releases a new (minor) stable release given that some
# new commits on the stable branch since the last tag exist.

Dir.chdir File.dirname(__FILE__)

def die(msg = "Failed")
	STDERR.puts msg
	exit 1
end

def run(cmd)
	system(cmd) or die(cmd)
end

run 'hg pull -r stable'
run 'hg update -r stable'

tag = `hg tags`.split("\n").select{|line| line =~ /^\d+\.\d+\.\d+/}.map do |line|
	tag, rev = line.split
	major, minor, tiny = tag.split(/\./).map(&:to_i)
	[major, minor, tiny, rev[/\d+/].to_i]
end.max

tag or die 'No tagged revision found'

stable = `hg log -r stable`[/changeset:\s*(\d+)/,1]
stable or die 'No stable branch found'
stable = stable.to_i

if tag[3] != stable
	new_tag = "#{tag[0]}.#{tag[1]}.#{tag[2]+1}"
	run "make -C .. nversion VERSION='#{new_tag}'"
	run "hg commit -m 'update version to #{new_tag}'"
	run "hg gexport"
	run "git tag -a -m 'version #{new_tag}' #{new_tag} stable"
	run "git push git@gitorious.org:evil/evil.git #{new_tag}"
	run "git push git@gitorious.org:evil/evil.git stable"
	run "hg pull -r stable"
	run "hg push -r stable bby://evil"
end