summaryrefslogtreecommitdiff
path: root/bumper.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-02-14 13:14:23 +0200
committerLars Wirzenius <liw@liw.fi>2016-02-14 13:35:46 +0200
commita5f6c84f32855c1516a9d284b0bba33202c7b66c (patch)
tree56176341826c3fce1fc0173917454871fd7e6a53 /bumper.yarn
parent70668a5053c800b9b5a5d4f964f79e503928b11b (diff)
downloadbumper-a5f6c84f32855c1516a9d284b0bba33202c7b66c.tar.gz
Add +git suffix to version after release
Diffstat (limited to 'bumper.yarn')
-rw-r--r--bumper.yarn56
1 files changed, 51 insertions, 5 deletions
diff --git a/bumper.yarn b/bumper.yarn
index 4921335..a3d0400 100644
--- a/bumper.yarn
+++ b/bumper.yarn
@@ -70,9 +70,33 @@ to have the right version number.
AND in foo, tag foo-3.2, NEWS matches
... "^Version 3.2, released \\d\\d\\d\\d-\\d\\d-\\d\\d$"
AND in foo, tag foo-3.2, has Debian version 3.2-1
- AND file foolib/version.py in foo contains
- ... "__version__ = "3.2"\n__version_info__ = (3, 2)\n"
+Further, Bumper updates the files in master to have a version number
+with `+git` appended, so that any non-release builds (builds not from
+the tag) won't report a version number that looks like a release.
+
+ AND file foolib/version.py in foo contains
+ ... "__version__ = "3.2+git"\n__version_info__ = (3, 2, '+git')\n"
+ AND file debian/changelog in foo matches
+ ... "foo \\(3\\.2\\+git-1\\) UNRELEASED;"
+ AND file NEWS in foo matches
+ ... "Version 3\\.2\\+git, not yet released"
+
+We can also make a second release.
+
+ WHEN user runs "bumper 3.4 foolib/version.py" in the foo directory
+ THEN git repository foo has tag foo-3.4, signed with AA8CD13C
+ AND in foo, tag foo-3.4, foolib/version.py contains
+ ... "__version__ = "3.4"\n__version_info__ = (3, 4)\n"
+ AND in foo, tag foo-3.4, NEWS matches
+ ... "^Version 3.4, released \\d\\d\\d\\d-\\d\\d-\\d\\d$"
+ AND in foo, tag foo-3.4, has Debian version 3.4-1
+ AND file foolib/version.py in foo contains
+ ... "__version__ = "3.4+git"\n__version_info__ = (3, 4, '+git')\n"
+ AND file debian/changelog in foo matches
+ ... "foo \\(3\\.4\\+git-1\\) UNRELEASED;"
+ AND file NEWS in foo matches
+ ... "Version 3\\.4\\+git, not yet released"
# Appendix: Scenario step implementations
@@ -133,6 +157,8 @@ for Bumper.
cliapp.runcmd(
['dch', '--create', '-v', '0.0-1', '--package', project, ''],
cwd=dirname)
+ cliapp.runcmd(['git', 'add', 'debian'], cwd=dirname)
+ cliapp.runcmd(['git', 'commit', '-m', 'Add debian packaging'], cwd=dirname)
IMPLEMENTS WHEN user runs "bumper (\S+) (\S+)" in the (\S+) directory
import cliapp, yarnstep
@@ -149,8 +175,21 @@ for Bumper.
wanted_data_escaped = yarnstep.get_next_match()
wanted_data = yarnstep.unescape_backslashes(wanted_data_escaped)
actual_data = yarnstep.cat(os.path.join(dirname, filename))
+ print 'wanted_data:', repr(wanted_data)
+ print 'actual_data:', repr(actual_data)
assert wanted_data == actual_data
+ IMPLEMENTS THEN file (\S+) in (\S+) matches "(.*)"
+ import re, os, yarnstep
+ filename = yarnstep.get_next_match()
+ dirname = yarnstep.get_next_match_as_datadir_path()
+ wanted_data_escaped = yarnstep.get_next_match()
+ wanted_data = yarnstep.unescape_backslashes(wanted_data_escaped)
+ actual_data = yarnstep.cat(os.path.join(dirname, filename))
+ print 'wanted_data:', repr(wanted_data)
+ print 'actual_data:', repr(actual_data)
+ assert re.search(wanted_data, actual_data)
+
IMPLEMENTS THEN in (\S+), tag (\S+), (\S+) contains "(.*)"
import cliapp, yarnstep
dirname = yarnstep.get_next_match_as_datadir_path()
@@ -161,6 +200,8 @@ for Bumper.
actual_data = cliapp.runcmd(
['git', 'cat-file', 'blob', '{}:{}'.format(tag, filename)],
cwd=dirname)
+ print 'wanted_data:', repr(wanted_data)
+ print 'actual_data:', repr(actual_data)
assert wanted_data == actual_data
IMPLEMENTS THEN in (\S+), tag (\S+), (\S+) matches "(.*)"
@@ -173,15 +214,20 @@ for Bumper.
actual_data = cliapp.runcmd(
['git', 'cat-file', 'blob', '{}:{}'.format(tag, filename)],
cwd=dirname)
+ print 'wanted_data:', repr(wanted_data)
+ print 'actual_data:', repr(actual_data)
assert re.search(wanted_data, actual_data, flags=re.M)
IMPLEMENTS THEN in (\S+), tag (\S+), has Debian version (\S+)
- import os, yarnstep
+ import os, cliapp, yarnstep
dirname = yarnstep.get_next_match_as_datadir_path()
- tagname = yarnstep.get_next_match()
+ tag = yarnstep.get_next_match()
version = yarnstep.get_next_match()
- text = yarnstep.cat(os.path.join(dirname, 'debian/changelog'))
+ text = cliapp.runcmd(
+ ['git', 'cat-file', 'blob', '{}:debian/changelog'.format(tag)],
+ cwd=dirname)
line1, _ = text.split('\n', 1)
+ print 'line1:', repr(line1)
assert '({})'.format(version) in line1
assert line1.split()[2] != 'UNRELEASED;'