diff options
author | Guido Günther <agx@sigxcpu.org> | 2018-11-24 17:17:10 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-11-24 17:17:10 +0100 |
commit | dacca59e1a968f79253dca901e212e868954fcff (patch) | |
tree | 6f7fa2a659f47dcb86d5079519d2187b0cddd12d /gbp | |
parent | a55d19f20a301b727874649b2519f9596bc3e084 (diff) |
pristine-tar: support checking in/out upstream signatures
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/deb/policy.py | 8 | ||||
-rw-r--r-- | gbp/deb/pristinetar.py | 13 | ||||
-rw-r--r-- | gbp/pkg/pristinetar.py | 14 |
3 files changed, 29 insertions, 6 deletions
diff --git a/gbp/deb/policy.py b/gbp/deb/policy.py index 6664f4ff..d05d05cb 100644 --- a/gbp/deb/policy.py +++ b/gbp/deb/policy.py @@ -96,3 +96,11 @@ class DebianPkgPolicy(PkgPolicy): if dir: tarball = os.path.join(dir, tarball) return tarball + + @staticmethod + def build_signature_name(*args, **kwargs): + """ + Given a source package's I{name}, I{version} and I{compression} + return the name of the corresponding upstream tarball signature file. + """ + return DebianPkgPolicy.build_tarball_name(*args, **kwargs) + '.asc' diff --git a/gbp/deb/pristinetar.py b/gbp/deb/pristinetar.py index 843e52e9..1b9317d5 100644 --- a/gbp/deb/pristinetar.py +++ b/gbp/deb/pristinetar.py @@ -45,7 +45,7 @@ class DebianPristineTar(PristineTar): return super(DebianPristineTar, self).has_commit(name_regexp) def checkout(self, package, version, comp_type, output_dir, component=None, - quiet=False): + quiet=False, signature=False): """ Checkout the orig tarball for package I{package} of I{version} and compression type I{comp_type} to I{output_dir} @@ -59,9 +59,18 @@ class DebianPristineTar(PristineTar): @param output_dir: the directory to put the tarball into @type output_dir: C{str} """ + signaturefile = None name = DebianPkgPolicy.build_tarball_name(package, version, comp_type, output_dir, component=component) - super(DebianPristineTar, self).checkout(name, quiet=quiet) + if signature: + signaturefile = DebianPkgPolicy.build_signature_name(package, + version, + comp_type, + output_dir, + component=component) + super(DebianPristineTar, self).checkout(name, + quiet=quiet, + signaturefile=signaturefile) diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py index 40d7dd30..76f1d3c8 100644 --- a/gbp/pkg/pristinetar.py +++ b/gbp/pkg/pristinetar.py @@ -83,17 +83,20 @@ class PristineTar(Command): return commit return None - def checkout(self, archive, quiet=False): + def checkout(self, archive, quiet=False, signaturefile=None): """ Checkout an orig archive from pristine-tar branch @param archive: the name of the orig archive @type archive: C{str} """ + args = ['checkout', archive] self.run_error = 'Pristine-tar couldn\'t checkout "%s": {stderr_or_reason}' % os.path.basename(archive) - self.__call__(['checkout', archive], quiet=quiet) + if signaturefile: + args += ['-s', signaturefile] + self.__call__(args, quiet=quiet) - def commit(self, archive, upstream, quiet=False): + def commit(self, archive, upstream, quiet=False, signaturefile=None): """ Commit an archive I{archive} to the pristine tar branch using upstream branch ${upstream}. @@ -103,9 +106,12 @@ class PristineTar(Command): @param upstream: the upstream branch to diff against @type upstream: C{str} """ + args = ['commit', archive, upstream] self.run_error = ("Couldn't commit to '%s' with upstream '%s': {stderr_or_reason}" % (self.branch, upstream)) - self.__call__(['commit', archive, upstream], quiet=quiet) + if signaturefile: + args += ['-s', signaturefile] + self.__call__(args, quiet=quiet) def verify(self, archive, quiet=False): """Verify an archive's I{archive} checksum using to the pristine tar branch""" |