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'
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"""
>>> 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):
import gbp.log
from gbp.command_wrappers import Command
from gbp.pkg import compressor_opts
-from gbp.deb import UpstreamSource
+from gbp.deb import DebianPkgPolicy
class PristineTar(Command):
"""The pristine-tar branch in a git repository"""
@param output_dir: the directory to put the tarball into
@type output_dir: C{str}
"""
- name = UpstreamSource.build_tarball_name(package,
- version,
- comp_type,
- output_dir)
+ name = DebianPkgPolicy.build_tarball_name(package,
+ version,
+ comp_type,
+ output_dir)
self._checkout(name)
def commit(self, archive, upstream):