diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-02-08 14:54:59 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-06-30 09:02:43 +0200 |
commit | cc1ebfd18013c6086881665de55b5ce937aa534e (patch) | |
tree | c07c412c0ec7833aecab6235eb69a564d77250fb /gbp/pkg | |
parent | e9d239bb02b0e7bea06c01fb3572330620658209 (diff) |
PristineTar: move Debian-specific stuff to DebianPristineTar
Continuation to the PristineTar refactoring, makes the "common"
PristineTar independent of DebianPkgPolicy. This commit moves the
Debian-specific has_commit() and checkout() methods to DebianPristineTar
class and replaces them with more generic functions in the base class.
Also, drops the Debian-specific get_commit() method completely, as it
was not used outside the PristineTar class itself.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/pkg')
-rw-r--r-- | gbp/pkg/pristinetar.py | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py index a2f191fd..08c52d9e 100644 --- a/gbp/pkg/pristinetar.py +++ b/gbp/pkg/pristinetar.py @@ -16,11 +16,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Handle checkin and checkout of archives from the pristine-tar branch""" -import os, re +import os import gbp.log from gbp.command_wrappers import Command -from gbp.pkg import compressor_opts -from gbp.deb import DebianPkgPolicy class PristineTar(Command): """The pristine-tar branch in a git repository""" @@ -31,41 +29,28 @@ class PristineTar(Command): self.repo = repo super(PristineTar, self).__init__(self.cmd, cwd=repo.path) - def has_commit(self, package, version, comp_type=None): + def has_commit(self, archive_regexp): """ Do we have a pristine-tar commit for package I{package} at version {version} with compression type I{comp_type}? - @param package: the package to look for - @type package: C{str} - @param version: the upstream version to look for - @type version: C{str} - @param comp_type: the compression type - @type comp_type: C{str} + @param archive_regexp: archive name to look for (regexp wildcards allowed) + @type archive_regexp: C{str} """ - return True if self.get_commit(package, version, comp_type) else False + return True if self.get_commit(archive_regexp) else False - def get_commit(self, package, version, comp_type=None): + def get_commit(self, archive_regexp): """ Get the pristine-tar commit of package I{package} in version I{version} and compression type I{comp_type} - @param package: the package to look for - @type package: C{str} - @param version: the version to look for - @param comp_type: the compression type - @type comp_type: C{str} + @param archive_regexp: archive name to look for (regexp wildcards allowed) + @type archive_regexp: C{str} """ if not self.repo.has_pristine_tar_branch(): return None - if not comp_type: - ext = '\w\+' - else: - ext = compressor_opts[comp_type][1] - - regex = ('pristine-tar .* %s_%s\.orig\.tar\.%s' % - (package, version, ext)) + regex = ('pristine-tar .* %s' % archive_regexp) commits = self.repo.grep_log(regex, self.branch) if commits: commit = commits[-1] @@ -73,29 +58,15 @@ class PristineTar(Command): return commit return None - def _checkout(self, archive): - self.run_error = 'Couldn\'t checkout "%s"' % os.path.basename(archive) - self.__call__(['checkout', archive]) - - def checkout(self, package, version, comp_type, output_dir): + def checkout(self, archive): """ - Checkout the orig tarball for package I{package} of I{version} and - compression type I{comp_type} to I{output_dir} + Checkout an orig archive from pristine-tar branch - @param package: the package to generate the orig tarball for - @type package: C{str} - @param version: the version to check generate the orig tarball for - @type version: C{str} - @param comp_type: the compression type of the tarball - @type comp_type: C{str} - @param output_dir: the directory to put the tarball into - @type output_dir: C{str} + @param archive: the name of the orig archive + @type archive: C{str} """ - name = DebianPkgPolicy.build_tarball_name(package, - version, - comp_type, - output_dir) - self._checkout(name) + self.run_error = 'Couldn\'t checkout "%s"' % os.path.basename(archive) + self.__call__(['checkout', archive]) def commit(self, archive, upstream): """ |