diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2019-12-17 00:10:01 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-01-21 17:36:53 +0100 |
commit | 2f1c1577e74c36d17aa9f8956e95c42018c71925 (patch) | |
tree | b864c8b9ebe646515d1451a8d360e81a88fd394b /gbp/pkg | |
parent | bddd221ee61f8fca61f5a7e17ee47019862c1da7 (diff) |
add option to export tarballs with upstream signature
Add option `--upstream-signatures=[on|auto|off]` to export-orig.
Add option `--git-upstream-signatures=[on|auto|off]` to buildpackage.
Closes: 872864
Diffstat (limited to 'gbp/pkg')
-rw-r--r-- | gbp/pkg/pristinetar.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py index 5c0892b7..e8534076 100644 --- a/gbp/pkg/pristinetar.py +++ b/gbp/pkg/pristinetar.py @@ -63,25 +63,38 @@ class PristineTar(Command): @param archive_regexp: archive name to look for (regexp wildcards allowed) @type archive_regexp: C{str} """ - return True if self.get_commit(archive_regexp) else False + return True if self.get_commit(archive_regexp)[0] else False + + def _commit_contains_file(self, commit, regexp): + """Does the given commit contain a file with the given regex""" + files = self.repo.get_commit_info(commit)['files'] + cregex = re.compile(regexp) + for _, v in files.items(): + for f in v: + if cregex.match(f.decode()): + return True + return False def get_commit(self, archive_regexp): """ Get the pristine-tar commit of a package matching I{archive_regexp}. + Checks also whether the commit contains a signature file. @param archive_regexp: archive name to look for (regexp wildcards allowed) @type archive_regexp: C{str} + @return: Commit, True if commit contains a signature file + @rtype: C{tuple} of C{str} and C{bool} """ if not self.repo.has_pristine_tar_branch(): - return None + return None, False regex = ('pristine-tar .* %s' % archive_regexp) commits = self.repo.grep_log(regex, self.branch, merges=False) if commits: commit = commits[-1] gbp.log.debug("Found pristine-tar commit at '%s'" % commit) - return commit - return None + return commit, self._commit_contains_file(commit, '%s.asc' % archive_regexp) + return None, False def checkout(self, archive, quiet=False, signaturefile=None): """ |