if type(filters) != type([]):
raise GbpError("Filters must be a list")
- self._unpack_archive(dir, filters)
+ if self._unpack_archive(dir, filters):
+ ret = type(self)(dir, prefix=self._prefix)
+ else:
+ ret = self
src_dir = os.path.join(dir, self._prefix)
- self.unpacked = src_dir if os.path.isdir(src_dir) else dir
+ ret.unpacked = src_dir if os.path.isdir(src_dir) else dir
+ return ret
def _unpack_archive(self, dir, filters):
"""
- Unpack packed upstream sources into a given directory.
+ Unpack packed upstream sources into a given directory. Return True if
+ the output was filtered, otherwise False.
"""
ext = os.path.splitext(self.path)[1]
if ext in [ ".zip", ".xpi" ]:
self._unpack_zip(dir)
else:
self._unpack_tar(dir, filters)
+ if filters:
+ return True
+ return False
def _unpack_zip(self, dir):
try:
if source.is_tarball(): # the tarball was filtered on unpack
repacked.unpacked = source.unpacked
else: # otherwise unpack the generated tarball get a filtered tree
- repacked.unpack(unpack_dir, filters)
+ repacked.unpack(unpack_dir)
return repacked
dirs['tmp'] = os.path.abspath(tempfile.mkdtemp(dir='..'))
upstream = DebianUpstreamSource(src.tgz)
- upstream.unpack(dirs['tmp'], options.filters)
+ upstream = upstream.unpack(dirs['tmp'], options.filters)
format = [(options.upstream_tag, "Upstream"), (options.debian_tag, "Debian")][src.native]
tag = repo.version_to_tag(format[0], src.upstream_version)
if not source.is_dir():
unpack_dir = tempfile.mkdtemp(prefix='unpack', dir=tmpdir)
- source.unpack(unpack_dir, options.filters)
+ source = source.unpack(unpack_dir, options.filters)
gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked))
if orig_needs_repack(source, options):
if spec.orig_src:
orig_tarball = os.path.join(dirs['src'], spec.orig_src['filename'])
sources = RpmUpstreamSource(orig_tarball)
- sources.unpack(dirs['origsrc'], options.filters)
+ sources = sources.unpack(dirs['origsrc'], options.filters)
else:
sources = None