diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-08-02 15:27:28 -0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-08-02 15:27:28 -0300 |
commit | 6b326e2e5c7d6c9899e6d196fc7fb96af2c0d207 (patch) | |
tree | dca5dc0903537b373a37adcc946f89c86b2df66b /gbp/pkg | |
parent | 864c30905f865e9d407e5830d63cbd3c8cc5a8cf (diff) |
pristine-tar: add feature detection
so we can run tests with older pristine-tar not supporting verify
Diffstat (limited to 'gbp/pkg')
-rw-r--r-- | gbp/pkg/pristinetar.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py index 4b7a87ee..cd7c5123 100644 --- a/gbp/pkg/pristinetar.py +++ b/gbp/pkg/pristinetar.py @@ -16,6 +16,7 @@ # <http://www.gnu.org/licenses/> """Handle checkin and checkout of archives from the pristine-tar branch""" +import re import os import gbp.log from gbp.command_wrappers import Command @@ -30,6 +31,25 @@ class PristineTar(Command): self.repo = repo super(PristineTar, self).__init__(self.cmd, cwd=repo.path, capture_stderr=True) + def _has_feature(self, feature): + """ + Check if pristine_tar has a certain feature enabled. + + @param feature: feature / command option to check + @type feature: C{str} + @return: True if feature is supported + @rtype: C{bool} + """ + self.call(['--help'], quiet=True) # There's no --help so we always exit 1 + r = re.compile('.* pristine-tar .* %s' % feature) + for line in self.stderr.splitlines(): + if r.match(line): + return True + return False + + def has_feature_verify(self): + return self._has_feature("verify") + def has_commit(self, archive_regexp): """ Do we have a pristine-tar commit for a package matching I{archive_regexp}. |