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 'DEBEMAIL=tails@boum.org ' \
44 "debchange -v '#{version}' 'New upstream release'"
48 Given %r{^the last versions mentioned in debian/changelog are ([[:alnum:]~.]+) and ([[:alnum:]~.]+)$} do |version_a, version_b|
49 step "the last version mentioned in debian/changelog is #{version_a}"
50 step "the last version mentioned in debian/changelog is #{version_b}"
53 Given %r{^no frozen APT snapshot is encoded in config/APT_snapshots\.d$} do
54 ['debian', 'debian-security', 'torproject'].map do |origin|
55 File.open("config/APT_snapshots.d/#{origin}/serial", 'w+') do |serial|
56 serial.write("latest\n")
61 Given %r{^frozen APT snapshots are encoded in config/APT_snapshots\.d$} do
62 ['debian', 'torproject'].map do |origin|
63 File.open("config/APT_snapshots.d/#{origin}/serial", 'w+') do |serial|
64 serial.write("2016060602\n")
67 # We never freeze debian-security
68 File.open('config/APT_snapshots.d/debian-security/serial', 'w+') do |serial|
69 serial.write("latest\n")
73 Given %r{I am working on the ([[:alnum:]./_-]+) base branch$} do |branch|
74 create_git unless git_exists?
76 fatal_system "git checkout --quiet '#{branch}'" if current_branch != branch
78 File.open('config/base_branch', 'w+') do |base_branch_file|
79 base_branch_file.write("#{branch}\n")
83 Given /^I checkout the ([[:alnum:]~.-]+) tag$/ do |tag|
84 create_git unless git_exists?
85 fatal_system "git checkout --quiet #{tag}"
88 Given %r{I am working on the ([[:alnum:]./_-]+) branch based on ([[:alnum:]./_-]+)$} do |branch, base|
89 create_git unless git_exists?
91 if current_branch != branch
92 fatal_system "git checkout --quiet -b '#{branch}' '#{base}'"
95 File.open('config/base_branch', 'w+') do |base_branch_file|
96 base_branch_file.write("#{base}\n")
100 When /^I successfully run "?([[:alnum:] -]+)"?$/ do |command|
101 @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
102 if $CHILD_STATUS != 0
104 "#{command} failed. Exit code: #{$CHILD_STATUS}"
108 When /^I run "?([[:alnum:] -]+)"?$/ do |command|
109 @output = `#{File.expand_path("../../../auto/scripts/#{command}", __FILE__)}`
110 @exit_code = $CHILD_STATUS.exitstatus
113 Then /^I should see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
114 @output.should have_suite(suite)
117 Then /^I should see only the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
118 assert_equal(1, @output.lines.count)
119 @output.should have_suite(suite)
122 Then /^I should not see the ['"]?([[:alnum:].-]+)['"]? suite$/ do |suite|
123 @output.should_not have_suite(suite)
126 Given %r{^the config/APT_overlays\.d directory is empty$} do
127 Dir.glob('config/APT_overlays.d/*').empty? \
128 || raise('config/APT_overlays.d/ is not empty')
131 Given %r{^config/APT_overlays\.d contains ['"]?([[:alnum:].-]+)['"]?$} do |suite|
132 FileUtils.touch("config/APT_overlays.d/#{suite}")
135 Then /^it should fail$/ do
136 assert_not_equal(0, @exit_code)
139 Given %r{^the (config/base_branch) file does not exist$} do |file|
143 Given %r{^the (config/APT_overlays\.d) directory does not exist$} do |dir|
147 Given %r{^the config/base_branch file is empty$} do
148 File.truncate('config/base_branch', 0)
151 Then /^I should see the ([[:alnum:].-]+) tagged snapshot$/ do |tag|
152 @output.should have_tagged_snapshot(tag)
155 Then /^I should see a time-based snapshot$/ do
156 @output.should have_time_based_snapshot