summaryrefslogtreecommitdiff
path: root/gbp/pkg
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-07-09 16:10:37 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:22:07 +0200
commit811539ed2a6a5ec37300629102a7b4bf177d1182 (patch)
treed0482a10c9c35408c6b531fbf419ef449421fa21 /gbp/pkg
parent6bfdaeb3e98c4183c190e6f04d472d035622e6ca (diff)
downloadgit-buildpackage-811539ed2a6a5ec37300629102a7b4bf177d1182.tar.gz
git-buildpackage-811539ed2a6a5ec37300629102a7b4bf177d1182.tar.bz2
git-buildpackage-811539ed2a6a5ec37300629102a7b4bf177d1182.zip
Introduce PkgPolicy.is_valid_orig_archive()
A new method for checking if the given filename is usable as a orig (upstream) source archive. Also, takes this method into use in the UpstreamSource class. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/pkg')
-rw-r--r--gbp/pkg/__init__.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py
index ad471629..e80e94be 100644
--- a/gbp/pkg/__init__.py
+++ b/gbp/pkg/__init__.py
@@ -131,6 +131,14 @@ class PkgPolicy(object):
raise NotImplementedError("Class needs to provide upstreamversion_re")
return True if cls.upstreamversion_re.match(version) else False
+ @classmethod
+ def is_valid_orig_archive(cls, filename):
+ "Is this a valid orig source archive"
+ (base, arch_fmt, compression) = parse_archive_filename(filename)
+ if arch_fmt == 'tar' and compression:
+ return True
+ return False
+
@staticmethod
def guess_upstream_src_version(filename, extra_regex=r''):
"""
@@ -264,16 +272,7 @@ class UpstreamSource(object):
self._orig = False
return
- parts = self._path.split('.')
- try:
- if parts[-1] == 'tgz':
- self._orig = True
- elif parts[-2] == 'tar':
- if (parts[-1] in compressor_opts or
- parts[-1] in compressor_aliases):
- self._orig = True
- except IndexError:
- self._orig = False
+ self._orig = self._pkg_policy.is_valid_orig_archive(os.path.basename(self.path))
def is_orig(self):
"""