diff options
Diffstat (limited to 'gbp/deb.py')
-rw-r--r-- | gbp/deb.py | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -18,6 +18,12 @@ from errors import GbpError # the valid characters. debian_version_chars = 'a-zA-Z\d.~+-' +# compression types, extra options and extensions +compressor_opts = { 'gzip' : [ '-n', 'gz' ], + 'bzip2' : [ '', 'bz2' ], + 'lzma' : [ '', 'lzma' ], + 'xz' : [ '', 'xz' ] } + class NoChangelogError(Exception): """no changelog found""" pass @@ -140,11 +146,12 @@ def parse_changelog(changelog): except TypeError: raise ParseChangeLogError, output.split('\n')[0] return cp - -def orig_file(cp): + +def orig_file(cp, compression): "The name of the orig.tar.gz belonging to changelog cp" - return "%s_%s.orig.tar.gz" % (cp['Source'], cp['Upstream-Version']) + ext = compressor_opts[compression][1] + return "%s_%s.orig.tar.%s" % (cp['Source'], cp['Upstream-Version'], ext) def is_native(cp): @@ -160,15 +167,15 @@ def has_epoch(cp): except KeyError: return False -def has_orig(cp, dir): +def has_orig(cp, compression, dir): "Check if orig.tar.gz exists in dir" try: - os.stat( os.path.join(dir, orig_file(cp)) ) + os.stat( os.path.join(dir, orig_file(cp, compression)) ) except OSError: return False return True -def symlink_orig(cp, orig_dir, output_dir, force=False): +def symlink_orig(cp, compression, orig_dir, output_dir, force=False): """ symlink orig.tar.gz from orig_dir to output_dir @return: True if link was created or src == dst @@ -180,8 +187,8 @@ def symlink_orig(cp, orig_dir, output_dir, force=False): if orig_dir == output_dir: return True - src = os.path.join(orig_dir, orig_file(cp)) - dst = os.path.join(output_dir, orig_file(cp)) + src = os.path.join(orig_dir, orig_file(cp, compression)) + dst = os.path.join(output_dir, orig_file(cp, compression)) if not os.access(src, os.F_OK): return False try: |