summaryrefslogtreecommitdiff
path: root/gbp
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-06-05 14:20:03 +0300
commit303d00181de6199bd67e678af1584a6d985f82cf (patch)
tree41313433766a10cec4a4e79a258fd6f695d159cb /gbp
parent64ed0b157a3d157c7851b425c67fb0fdea4f4648 (diff)
downloadgit-buildpackage-303d00181de6199bd67e678af1584a6d985f82cf.tar.gz
git-buildpackage-303d00181de6199bd67e678af1584a6d985f82cf.tar.bz2
git-buildpackage-303d00181de6199bd67e678af1584a6d985f82cf.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')
-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 28cd4219..0c3f4aeb 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 has_orig(orig_file, dir):
"Check if orig tarball exists in dir"
@@ -202,16 +210,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):
"""