aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-08-06 18:11:50 -0300
committerGuido Günther <agx@sigxcpu.org>2017-08-06 18:11:50 -0300
commitd5f5e86ff4de5dbc6d436610424cf3d8221e144b (patch)
tree4198184ed32aed8a19f70543c536a030ff24706b
parentf09442516bf1d5cbabccea5a4cca7373af2cd7c1 (diff)
DebianSource: releasability check based on UNRELEASED
-rw-r--r--gbp/deb/source.py8
-rw-r--r--tests/15_test_DebianSource.py28
2 files changed, 36 insertions, 0 deletions
diff --git a/gbp/deb/source.py b/gbp/deb/source.py
index 1a0a99e4..e3a0362b 100644
--- a/gbp/deb/source.py
+++ b/gbp/deb/source.py
@@ -79,6 +79,14 @@ class DebianSource(object):
except IOError as e:
raise DebianSourceError("Failed to determine source format: %s" % e)
+ def is_releasable(self):
+ """
+ Check if package is releasable
+
+ Debian's current practive is to check for UNRELEASED in the distribution.
+ """
+ return self.changelog.distribution != 'UNRELEASED'
+
@property
def changelog(self):
"""
diff --git a/tests/15_test_DebianSource.py b/tests/15_test_DebianSource.py
index a9f43d32..98d5f706 100644
--- a/tests/15_test_DebianSource.py
+++ b/tests/15_test_DebianSource.py
@@ -84,3 +84,31 @@ class TestDebianSource(testutils.DebianGitTestRepo):
self._commit_format('3.0', 'quilt')
source = DebianSource(GitVfs(self.repo))
self.assertFalse(source.is_native())
+
+ def test_is_releasable(self):
+ source = DebianSource('.')
+ os.makedirs('debian/')
+ with open('debian/changelog', 'w') as f:
+ f.write("""git-buildpackage (0.2.3) unstable; urgency=low
+
+ * git doesn't like '~' in tag names so replace this with a dot when tagging
+
+ -- Guido Guenther <agx@sigxcpu.org> Mon, 2 Oct 2006 18:30:20 +0200
+""")
+ source = DebianSource('.')
+ self.assertEquals(source.changelog.distribution, "unstable")
+ self.assertTrue(source.is_releasable())
+
+ def test_is_not_releasable(self):
+ source = DebianSource('.')
+ os.makedirs('debian/')
+ with open('debian/changelog', 'w') as f:
+ f.write("""git-buildpackage (0.2.3) UNRELEASED; urgency=low
+
+ * git doesn't like '~' in tag names so replace this with a dot when tagging
+
+ -- Guido Guenther <agx@sigxcpu.org> Mon, 2 Oct 2006 18:30:20 +0200
+""")
+ source = DebianSource('.')
+ self.assertEquals(source.changelog.distribution, "UNRELEASED")
+ self.assertFalse(source.is_releasable())