aboutsummaryrefslogtreecommitdiff
path: root/gbp/deb/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/deb/__init__.py')
-rw-r--r--gbp/deb/__init__.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/gbp/deb/__init__.py b/gbp/deb/__init__.py
index 0b5168e..c0919c3 100644
--- a/gbp/deb/__init__.py
+++ b/gbp/deb/__init__.py
@@ -60,6 +60,34 @@ class DebianPkgPolicy(PkgPolicy):
letters (a-z), digits (0-9), full stops (.), plus signs (+), minus signs
(-), colons (:) and tildes (~)"""
+ @staticmethod
+ def build_tarball_name(name, version, compression, dir=None):
+ """
+ Given a source package's I{name}, I{version} and I{compression}
+ return the name of the corresponding upstream tarball.
+
+ >>> DebianPkgPolicy.build_tarball_name('foo', '1.0', 'bzip2')
+ 'foo_1.0.orig.tar.bz2'
+ >>> DebianPkgPolicy.build_tarball_name('bar', '0.0~git1234', 'xz')
+ 'bar_0.0~git1234.orig.tar.xz'
+
+ @param name: the source package's name
+ @type name: C{str}
+ @param version: the upstream version
+ @type version: C{str}
+ @param compression: the desired compression
+ @type compression: C{str}
+ @param dir: a directory to prepend
+ @type dir: C{str}
+ @return: the tarballs name corresponding to the input parameters
+ @rtype: C{str}
+ """
+ ext = compressor_opts[compression][1]
+ tarball = "%s_%s.orig.tar.%s" % (name, version, ext)
+ if dir:
+ tarball = os.path.join(dir, tarball)
+ return tarball
+
class DpkgCompareVersions(gbpc.Command):
cmd='/usr/bin/dpkg'
@@ -290,34 +318,6 @@ class UpstreamSource(object):
if m:
return (m.group('package'), m.group('version'))
- @staticmethod
- def build_tarball_name(name, version, compression, dir=None):
- """
- Given a source package's I{name}, I{version} and I{compression}
- return the name of the corresponding upstream tarball.
-
- >>> UpstreamSource.build_tarball_name('foo', '1.0', 'bzip2')
- 'foo_1.0.orig.tar.bz2'
- >>> UpstreamSource.build_tarball_name('bar', '0.0~git1234', 'xz')
- 'bar_0.0~git1234.orig.tar.xz'
-
- @param name: the source package's name
- @type name: C{str}
- @param version: the upstream version
- @type version: C{str}
- @param compression: the desired compression
- @type compression: C{str}
- @param dir: a directory to prepend
- @type dir: C{str}
- @return: the tarballs name corresponding to the input parameters
- @rtype: C{str}
- """
- ext = compressor_opts[compression][1]
- tarball = "%s_%s.orig.tar.%s" % (name, version, ext)
- if dir:
- tarball = os.path.join(dir, tarball)
- return tarball
-
class DscFile(object):
"""Keeps all needed data read from a dscfile"""
@@ -438,9 +438,9 @@ def orig_file(cp, compression):
>>> orig_file({'Source': 'bar', 'Upstream-Version': '0.0~git1234'}, "xz")
'bar_0.0~git1234.orig.tar.xz'
"""
- return UpstreamSource.build_tarball_name(cp['Source'],
- cp['Upstream-Version'],
- compression)
+ return DebianPkgPolicy.build_tarball_name(cp['Source'],
+ cp['Upstream-Version'],
+ compression)
def parse_uscan(out):