3 Given /^Tails ([[:alnum:]~.]+) has been released$/ do |version|
4 create_git unless git_exists?
6 old_branch = current_branch
8 fatal_system 'git checkout --quiet stable'
9 old_entries = File.open('debian/changelog', &:read)
10 File.open('debian/changelog', 'w') do |changelog|
11 changelog.write(<<~END_OF_CHANGELOG)
12 tails (#{version}) stable; urgency=low
14 * New upstream release.
16 -- Tails developers <tails@boum.org> Tue, 31 Jan 2012 15:12:57 +0100
21 fatal_system "git commit --quiet debian/changelog -m 'Release #{version}'"
22 fatal_system "git tag '#{version.gsub('~', '-')}'"
24 if old_branch != 'stable'
25 fatal_system "git checkout --quiet '#{old_branch}'"
26 fatal_system "git merge --quiet 'stable'"
30 Given /^Tails ([[:alnum:].-]+) has been tagged$/ do |version|
31 fatal_system "git tag '#{version}'"
34 Given /^Tails ([[:alnum:].]+) has not been released yet$/ do |version|
35 !File.exist? ".git/refs/tags/#{version}"
38 Given %r{^the last version mentioned in debian/changelog is ([[:alnum:]~.]+)$} do |version|
39 last = `dpkg-parsechangelog --show-field Version --count 1`.strip
40 raise StandardError, 'dpkg-parsechangelog failed.' if $CHILD_STATUS != 0
43 fatal_system "debchange -v '#{version}' 'New upstream release'"
47 Given %r{^the last versions mentioned in debian/changelog are ([[:alnum:]~.]+) and ([[:alnum:]~.]+)$} do |version_a, version_b|
48 step "the last version mentioned in debian/changelog is #{version_a}"
49 step "the last version mentioned in debian/changelog is #{version_b}"
52 Given %r{^no frozen APT snapshot is encoded in config/APT_snapshots\.d$} do
53 ['debian', 'debian-security', 'torproject'].map do |origin|
54 File.open("config/APT_snapshots.d/#{origin}/serial", 'w+') do |serial|
55 serial.write("latest\n")
60 Given %r{^frozen APT snapshots are encoded in config/APT_snapshots\.d$} do
61 ['debian', 'torproject'].map do |origin|
62 File.open("config/APT_snapshots.d/#{origin}/serial", 'w+') do |serial|
63 serial.write("2016060602\n")
66 # We never freeze debian-security
67 File.open('config/APT_snapshots.d/debian-security/serial', 'w+') do |serial|
68 serial.write("latest\n")
72 Given %r{I am working on the ([[:alnum:]./_-]+) base branch$} do |branch|
73 create_git unless git_exists?
75 fatal_system "git checkout --quiet '#{branch}'" if current_branch != branch
77 File.open('config/base_branch', 'w+') do |base_branch_file|
78 base_branch_file.write("#{branch}\n")
82 Given /^I checkout the ([[:alnum:]~.-]+) tag$/ do |tag|
83 create_git unless git_exists?
84 fatal_system "git checkout --quiet #{tag}"
87 Given %r{I am working on the ([[:alnum:]./_-]+) branch based on ([[:alnum:]./_-]+)$} do |branch, base|
88 create_git unless git_exists?
90 if current_branch != branch
91 fatal_system "git checkout --quiet -b '#{branch}' '#{base}'"
94 File.open('config/base_branch', 'w+') do |base_branch_file|
95 base_branch_file.write("#{base}\n")
99 When /^I successfully run "?([[:alnum:] -]+)"?$/ do |command|
100 @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
101 if $CHILD_STATUS != 0
103 "#{command} failed. Exit code: #{$CHILD_STATUS}"
107 When /^I run "?([[:alnum:] -]+)"?$/ do |command|
108 @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
109 @exit_code = $CHILD_STATUS.exitstatus
112 Then /^I should see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
113 @output.should have_suite(suite)
116 Then /^I should see only the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
117 assert_equal(1, @output.lines.count)
118 @output.should have_suite(suite)
121 Then /^I should not see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
122 @output.should_not have_suite(suite)
125 Given %r{^the config/APT_overlays\.d directory is empty$} do
126 Dir.glob('config/APT_overlays.d/*').empty? \
127 || raise('config/APT_overlays.d/ is not empty')
130 Given %r{^config/APT_overlays\.d contains ['"]?([[:alnum:].-]+)['"]?$} do |suite|
131 FileUtils.touch("config/APT_overlays.d/#{suite}")
134 Then /^it should fail$/ do
135 assert_not_equal(0, @exit_code)
138 Given %r{^the (config/base_branch) file does not exist$} do |file|
142 Given %r{^the (config/APT_overlays\.d) directory does not exist$} do |dir|
146 Given %r{^the config/base_branch file is empty$} do
147 File.truncate('config/base_branch', 0)
150 Then /^I should see the ([[:alnum:].-]+) tagged snapshot$/ do |tag|
151 @output.should have_tagged_snapshot(tag)
154 Then /^I should see a time\-based snapshot$/ do
155 @output.should have_time_based_snapshot