1 # vim: set fileencoding=utf-8 :
3 # (C) 2012 Guido Günther <agx@sigxcpu.org>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, please see
16 # <http://www.gnu.org/licenses/>
17 """Handle checkin and checkout of archives from the pristine-tar branch"""
19 from gbp.pkg.compressor import Compressor
20 from gbp.pkg.pristinetar import PristineTar
21 from gbp.deb import DebianPkgPolicy
24 class DebianPristineTar(PristineTar):
25 """The pristine-tar branch in a Debian git repository"""
26 def has_commit(self, package, version, comp_type=None):
28 Do we have a pristine-tar commit for package I{package} at version
29 {version} with compression type I{comp_type}?
31 @param package: the package to look for
33 @param version: the upstream version to look for
35 @param comp_type: the compression type
36 @type comp_type: C{str}
41 ext = Compressor.Exts[comp_type]
43 name_regexp = r'%s_%s\.orig\.tar\.%s' % (package, version, ext)
45 return super(DebianPristineTar, self).has_commit(name_regexp)
47 def checkout(self, package, version, comp_type, output_dir, component=None,
50 Checkout the orig tarball for package I{package} of I{version} and
51 compression type I{comp_type} to I{output_dir}
53 @param package: the package to generate the orig tarball for
55 @param version: the version to check generate the orig tarball for
57 @param comp_type: the compression type of the tarball
58 @type comp_type: C{str}
59 @param output_dir: the directory to put the tarball into
60 @type output_dir: C{str}
62 name = DebianPkgPolicy.build_tarball_name(package,
67 super(DebianPristineTar, self).checkout(name, quiet=quiet)