blob: c265b324215a9e76f3202bb11ad1bd42392ad152 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001#!/usr/bin/env python
2# Copyright 2016 the V8 project authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import os
7import tarfile
8
9os.chdir(os.path.dirname(os.path.abspath(__file__)))
10
Ben Murdochda12d292016-06-02 14:46:10 +010011# Workaround for slow grp and pwd calls.
12tarfile.grp = None
13tarfile.pwd = None
14
Ben Murdoch097c5b22016-05-18 11:27:45 +010015def filter_git(tar_info):
16 if tar_info.name.startswith(os.path.join('data', '.git')):
17 return None
18 else:
Ben Murdochda12d292016-06-02 14:46:10 +010019 tar_info.uname = tar_info.gname = "test262"
Ben Murdoch097c5b22016-05-18 11:27:45 +010020 return tar_info
21
22with tarfile.open('data.tar', 'w') as tar:
23 tar.add('data', filter=filter_git)