def check_tarball(resdir, tfilter=None, rootmod=None): test_res = os.path.join(resources, resdir) man = parse_manifest(os.path.join(test_res, "manifest")) tarroot = os.path.join(test_res, "root") if tfilter is None: tfilter = _tar_filter with tmpdir() as staging: if rootmod is not None: newroot = os.path.join(staging, "root") rsync(tarroot, newroot) tarroot = newroot rootmod(tarroot) tname = os.path.join(staging, "test.tar.gz") tf = tarfile.open(tname, mode="w:gz") tf.add(tarroot, arcname=".", filter=tfilter) tf.close() with open_compressed_tarball(tname) as tar: man.check_tarball(tar)
def check_manifest(resdir, manifest): mfile = os.path.join(resources, resdir, manifest) return parse_manifest(mfile)